diff --git a/src/config/mod.rs b/src/config/mod.rs index 455d4da..d8a4806 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -154,6 +154,9 @@ pub struct ProxyConfig { #[serde(default)] pub listeners: Vec, + + #[serde(default)] + pub show_link: Vec, } fn default_port() -> u16 { 443 } @@ -208,6 +211,7 @@ impl Default for ProxyConfig { fake_cert_len: default_fake_cert_len(), upstreams: Vec::new(), listeners: Vec::new(), + show_link: Vec::new(), } } } diff --git a/src/main.rs b/src/main.rs index dfdb806..45bd872 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,9 +99,36 @@ async fn main() -> Result<(), Box> { listener_conf.ip }; - for (user, secret) in &config.users { - info!("Link for {}: tg://proxy?server={}&port={}&secret={}", - user, public_ip, config.port, secret); + // Show links for configured users + if !config.show_link.is_empty() { + 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); diff --git a/src/stream/frame.rs b/src/stream/frame.rs index 32270eb..42f6c74 100644 --- a/src/stream/frame.rs +++ b/src/stream/frame.rs @@ -149,9 +149,9 @@ pub trait FrameCodec: Send + Sync { /// Create a frame codec for the given protocol tag pub fn create_codec(proto_tag: ProtoTag) -> Box { match proto_tag { - ProtoTag::Abridged => Box::new(super::frame_codec::AbridgedCodec::new()), - ProtoTag::Intermediate => Box::new(super::frame_codec::IntermediateCodec::new()), - ProtoTag::Secure => Box::new(super::frame_codec::SecureCodec::new()), + ProtoTag::Abridged => Box::new(crate::stream::frame_codec::AbridgedCodec::new()), + ProtoTag::Intermediate => Box::new(crate::stream::frame_codec::IntermediateCodec::new()), + ProtoTag::Secure => Box::new(crate::stream::frame_codec::SecureCodec::new()), } }