Skip to content

Commit

Permalink
add trojan configuration link
Browse files Browse the repository at this point in the history
Signed-off-by: Uncle Jack <[email protected]>
  • Loading branch information
unclejacki committed Jul 14, 2024
1 parent 15c254e commit 67c1d46
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub fn generate_link(config: &Config, host: &str) -> Link {
.filter_map(|inbound| match inbound.protocol {
Protocol::Vless => Some(generate_vless_link(&inbound, host)),
Protocol::Vmess => Some(generate_vmess_link(&inbound, host)),
Protocol::Trojan => Some(generate_trojan_link(&inbound, host)),
_ => None,
})
.collect();
Expand Down Expand Up @@ -51,3 +52,10 @@ fn generate_vmess_link(config: &Inbound, host: &str) -> String {
);
format!("vmess://{}", URL_SAFE.encode(config.to_string()))
}

fn generate_trojan_link(config: &Inbound, host: &str) -> String {
format!(
"trojan://{}@{}:443?security=tls&type=ws&path={}#tunl",
config.password, host, config.path
)
}

0 comments on commit 67c1d46

Please sign in to comment.