Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Missing utls for SIP003 v2ray transport #2226

Open
zedifen opened this issue Oct 28, 2024 · 0 comments
Open

[Feature Request] Missing utls for SIP003 v2ray transport #2226

zedifen opened this issue Oct 28, 2024 · 0 comments

Comments

@zedifen
Copy link
Contributor

zedifen commented Oct 28, 2024

According to sing-box documentation, utls can be configured in tls settings.

However, when using shadowsocks with v2ray-plugin (v2ray WebSocket transport) with TLS, it seems the only way to make configuration is through plugin_opts.

I understand that sing-box is now using its built-in v2ray-plugin support, and by checking the source code (transport/sip003/v2ray.go), it's clear that there's no utls-related code in it.

Luckily, it's not hard to attach an option.OutboundUTLSOptions to the existing tlsOptions. I made a simple patch as below and it's working.

diff --git a/transport/sip003/v2ray.go b/transport/sip003/v2ray.go
index c142180bbf..078adea278 100644
--- a/transport/sip003/v2ray.go
+++ b/transport/sip003/v2ray.go
@@ -25,6 +25,13 @@ func newV2RayPlugin(ctx context.Context, pluginOpts Args, router adapter.Router,
 	if _, loaded := pluginOpts.Get("tls"); loaded {
 		tlsOptions.Enabled = true
 	}
+	if utlsFingerprint, utlsLoaded := pluginOpts.Get("utls"); utlsLoaded {
+		tlsOptions.Enabled = true
+		tlsOptions.UTLS = &option.OutboundUTLSOptions{
+			Enabled:     true,
+			Fingerprint: utlsFingerprint,
+		}
+	}
 	if certPath, certLoaded := pluginOpts.Get("cert"); certLoaded {
 		tlsOptions.CertificatePath = certPath
 	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant