mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-05 08:01:26 +00:00
conf: Add Trojan over WebSocket over TLS (TLS + WebSockeet + Trojan) support
This commit is contained in:
1 parent
1acca315ae
commit
df48f511fb
2 files changed
+32
No files matched your search
@@ -56,22 +56,34 @@ iOS TF 测试公开链接:https://testflight.apple.com/join/std0FFCS
|
||||
loglevel = info
|
||||
dns-server = 114.114.114.114, 223.5.5.5
|
||||
always-real-ip = tracker, apple.com
|
||||
|
||||
# Local HTTP CONNECT proxy
|
||||
interface = 127.0.0.1
|
||||
port = 1087
|
||||
|
||||
# Local SOCKS5 proxy with UDP Associate support
|
||||
socks-interface = 127.0.0.1
|
||||
socks-port = 1086
|
||||
|
||||
[Proxy]
|
||||
Direct = direct
|
||||
Reject = reject
|
||||
|
||||
# Shadowsocks
|
||||
SS = ss, 1.2.3.4, 8485, encrypt-method=chacha20-ietf-poly1305, password=123456
|
||||
|
||||
# VMess
|
||||
VMess = vmess, my.domain.com, 8001, username=0eb5486e-e1b5-49c5-aa75-d15e54dfac9d
|
||||
|
||||
# VMess over WebSocket over TLS (TLS + WebSocket + VMess)
|
||||
VMessWSS = vmess, my.domain.com, 443, username=0eb5486e-e1b5-49c5-aa75-d15e54dfac9d, ws=true, tls=true, ws-path=/v2
|
||||
|
||||
# Trojan (with TLS)
|
||||
Trojan = trojan, 4.3.2.1, 443, password=123456, sni=www.domain.com
|
||||
|
||||
# Trojan over WebSocket over TLS (TLS + WebSocket + Trojan)
|
||||
TrojanWS = trojan, 4.3.2.1, 443, password=123456, sni=www.domain.com, ws=true, ws-path=/abc
|
||||
|
||||
[Proxy Group]
|
||||
# fallback 等效于 failover
|
||||
Fallback = fallback, Trojan, VMessWSS, SS, interval=600, timeout=5
|
||||
|
||||
@@ -663,6 +663,20 @@ pub fn to_internal(conf: Config) -> Result<internal::Config> {
|
||||
tls_outbound.settings = tls_settings;
|
||||
tls_outbound.tag = format!("{}_tls_xxx", ext_proxy.tag.clone());
|
||||
|
||||
// ws
|
||||
let mut ws_outbound = internal::Outbound::new();
|
||||
ws_outbound.protocol = "ws".to_string();
|
||||
ws_outbound.bind = ext_proxy.interface.clone();
|
||||
let mut ws_settings = internal::WebSocketOutboundSettings::new();
|
||||
if let Some(ext_ws_path) = &ext_proxy.ws_path {
|
||||
ws_settings.path = ext_ws_path.clone();
|
||||
} else {
|
||||
ws_settings.path = "/".to_string();
|
||||
}
|
||||
let ws_settings = ws_settings.write_to_bytes().unwrap();
|
||||
ws_outbound.settings = ws_settings;
|
||||
ws_outbound.tag = format!("{}_ws_xxx", ext_proxy.tag.clone());
|
||||
|
||||
// plain trojan
|
||||
let mut settings = internal::TrojanOutboundSettings::new();
|
||||
if let Some(ext_address) = &ext_proxy.address {
|
||||
@@ -683,6 +697,9 @@ pub fn to_internal(conf: Config) -> Result<internal::Config> {
|
||||
chain_outbound.tag = ext_proxy.tag.clone();
|
||||
let mut chain_settings = internal::ChainOutboundSettings::new();
|
||||
chain_settings.actors.push(tls_outbound.tag.clone());
|
||||
if ext_proxy.ws.unwrap() {
|
||||
chain_settings.actors.push(ws_outbound.tag.clone());
|
||||
}
|
||||
chain_settings.actors.push(outbound.tag.clone());
|
||||
let chain_settings = chain_settings.write_to_bytes().unwrap();
|
||||
chain_outbound.settings = chain_settings;
|
||||
@@ -693,6 +710,9 @@ pub fn to_internal(conf: Config) -> Result<internal::Config> {
|
||||
// the chain outbound will be the default one to use
|
||||
outbounds.push(chain_outbound);
|
||||
outbounds.push(tls_outbound);
|
||||
if ext_proxy.ws.unwrap() {
|
||||
outbounds.push(ws_outbound);
|
||||
}
|
||||
outbounds.push(outbound);
|
||||
}
|
||||
"vmess" => {
|
||||
|
||||
Reference in new issue
Block a user