From 1e71c5d8031542b1fd1e35538b09652856938f14 Mon Sep 17 00:00:00 2001 From: Dawsh Date: Fri, 29 Nov 2024 21:30:23 +0330 Subject: [PATCH] feat(sing-box): support tuic and shadowtls --- v2share/data.py | 1 + v2share/singbox.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/v2share/data.py b/v2share/data.py index a9d5882..f32356d 100644 --- a/v2share/data.py +++ b/v2share/data.py @@ -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 diff --git a/v2share/singbox.py b/v2share/singbox.py index 25c2263..9d66102 100644 --- a/v2share/singbox.py +++ b/v2share/singbox.py @@ -14,6 +14,8 @@ "vless", "hysteria2", "wireguard", + "shadowtls", + "tuic", ] supported_transports = ["tcp", "ws", "quic", "httpupgrade", "grpc", None] @@ -46,6 +48,8 @@ def render(self, sort: bool = True, shuffle: bool = False): "trojan", "shadowsocks", "wireguard", + "tuic", + "shadowtls", ] urltest_tags = [ outbound["tag"] @@ -59,6 +63,8 @@ def render(self, sort: bool = True, shuffle: bool = False): "trojan", "shadowsocks", "wireguard", + "tuic", + "shadowtls", "urltest", ] selector_tags = [ @@ -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]):