Skip to content

Commit

Permalink
feat(sing-box): support tuic and shadowtls
Browse files Browse the repository at this point in the history
  • Loading branch information
khodedawsh committed Nov 29, 2024
1 parent 5705eaf commit 1e71c5d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions v2share/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class V2Data:
allowed_ips: Optional[List[str]] = None
congestion_control: Optional[str] = None
tuic_udp_relay_mode: Optional[str] = None
shadowtls_version: Optional[int] = None
disable_sni: bool = False
enable_mux: bool = False
allow_insecure: bool = False
Expand Down
15 changes: 15 additions & 0 deletions v2share/singbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"vless",
"hysteria2",
"wireguard",
"shadowtls",
"tuic",
]
supported_transports = ["tcp", "ws", "quic", "httpupgrade", "grpc", None]

Expand Down Expand Up @@ -46,6 +48,8 @@ def render(self, sort: bool = True, shuffle: bool = False):
"trojan",
"shadowsocks",
"wireguard",
"tuic",
"shadowtls",
]
urltest_tags = [
outbound["tag"]
Expand All @@ -59,6 +63,8 @@ def render(self, sort: bool = True, shuffle: bool = False):
"trojan",
"shadowsocks",
"wireguard",
"tuic",
"shadowtls",
"urltest",
]
selector_tags = [
Expand Down Expand Up @@ -216,6 +222,15 @@ def create_outbound(config: V2Data):
],
}
)
elif config.protocol == "shadowtls":
if config.shadowtls_version:
outbound["version"] = config.shadowtls_version
if config.shadowtls_version in {2, 3}:
outbound["password"] = config.password
elif config.protocol == "tuic":
outbound["password"] = config.password
outbound["uuid"] = str(config.uuid)

return outbound

def add_proxies(self, proxies: List[V2Data]):
Expand Down

0 comments on commit 1e71c5d

Please sign in to comment.