This commit is contained in:
Alexey
2026-01-07 18:16:01 +03:00
parent 5016160ac3
commit 85cb4092d5
3 changed files with 37 additions and 6 deletions

View File

@@ -154,6 +154,9 @@ pub struct ProxyConfig {
#[serde(default)] #[serde(default)]
pub listeners: Vec<ListenerConfig>, pub listeners: Vec<ListenerConfig>,
#[serde(default)]
pub show_link: Vec<String>,
} }
fn default_port() -> u16 { 443 } fn default_port() -> u16 { 443 }
@@ -208,6 +211,7 @@ impl Default for ProxyConfig {
fake_cert_len: default_fake_cert_len(), fake_cert_len: default_fake_cert_len(),
upstreams: Vec::new(), upstreams: Vec::new(),
listeners: Vec::new(), listeners: Vec::new(),
show_link: Vec::new(),
} }
} }
} }

View File

@@ -99,9 +99,36 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
listener_conf.ip listener_conf.ip
}; };
for (user, secret) in &config.users { // Show links for configured users
info!("Link for {}: tg://proxy?server={}&port={}&secret={}", if !config.show_link.is_empty() {
user, public_ip, config.port, secret); info!("--- Proxy Links for {} ---", public_ip);
for user_name in &config.show_link {
if let Some(secret) = config.users.get(user_name) {
info!("User: {}", user_name);
// Classic
if config.modes.classic {
info!(" Classic: tg://proxy?server={}&port={}&secret={}",
public_ip, config.port, secret);
}
// DD (Secure)
if config.modes.secure {
info!(" DD: tg://proxy?server={}&port={}&secret=dd{}",
public_ip, config.port, secret);
}
// EE-TLS (FakeTLS)
if config.modes.tls {
let domain_hex = hex::encode(&config.tls_domain);
info!(" EE-TLS: tg://proxy?server={}&port={}&secret=ee{}{}",
public_ip, config.port, secret, domain_hex);
}
} else {
warn!("User '{}' specified in show_link not found in users list", user_name);
}
}
info!("-----------------------------------");
} }
listeners.push(listener); listeners.push(listener);

View File

@@ -149,9 +149,9 @@ pub trait FrameCodec: Send + Sync {
/// Create a frame codec for the given protocol tag /// Create a frame codec for the given protocol tag
pub fn create_codec(proto_tag: ProtoTag) -> Box<dyn FrameCodec> { pub fn create_codec(proto_tag: ProtoTag) -> Box<dyn FrameCodec> {
match proto_tag { match proto_tag {
ProtoTag::Abridged => Box::new(super::frame_codec::AbridgedCodec::new()), ProtoTag::Abridged => Box::new(crate::stream::frame_codec::AbridgedCodec::new()),
ProtoTag::Intermediate => Box::new(super::frame_codec::IntermediateCodec::new()), ProtoTag::Intermediate => Box::new(crate::stream::frame_codec::IntermediateCodec::new()),
ProtoTag::Secure => Box::new(super::frame_codec::SecureCodec::new()), ProtoTag::Secure => Box::new(crate::stream::frame_codec::SecureCodec::new()),
} }
} }