From f8bddb162edfa529d94e1a81f16a0c106a02ac43 Mon Sep 17 00:00:00 2001 From: Jason Lyu Date: Wed, 25 Oct 2023 09:36:02 +0800 Subject: [PATCH] Improve(proxy/ss): allow explicit none cipher mode (#312) --- engine/parse.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/parse.go b/engine/parse.go index 234dc40..c4cba68 100644 --- a/engine/parse.go +++ b/engine/parse.go @@ -130,11 +130,13 @@ func parseShadowsocks(u *url.URL) (proxy.Proxy, error) { obfsMode, obfsHost string ) - if pass, set := u.User.Password(); set { + if ss := u.User.String(); ss == "" { + method = "dummy" // none cipher mode + } else if pass, set := u.User.Password(); set { method = u.User.Username() password = pass } else { - data, _ := base64.RawURLEncoding.DecodeString(u.User.String()) + data, _ := base64.RawURLEncoding.DecodeString(ss) userInfo := strings.SplitN(string(data), ":", 2) if len(userInfo) == 2 { method = userInfo[0]