From 56a559a5e61c1239f5cda12fdfc5203678dfdb3a Mon Sep 17 00:00:00 2001 From: hiddify <114227601+hiddify-com@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:26:48 +0330 Subject: [PATCH] fix: shadowsocks generation --- ray2sing/shadowsocks.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ray2sing/shadowsocks.go b/ray2sing/shadowsocks.go index 8f54e02..6656557 100644 --- a/ray2sing/shadowsocks.go +++ b/ray2sing/shadowsocks.go @@ -17,12 +17,17 @@ func parseShadowsocks(configStr string) (map[string]string, error) { // If there's an error in decoding, use the original string encryption_method = parsedURL.User.Username() password, _ = parsedURL.User.Password() + } else { // If decoding is successful, use the decoded string userDetails := strings.SplitN(userInfo, ":", 2) encryption_method = userDetails[0] password = userDetails[1] } + if password == "" { + password = encryption_method + encryption_method = "none" + } server := map[string]string{ "encryption_method": encryption_method, @@ -42,6 +47,10 @@ func ShadowsocksSingbox(shadowsocksUrl string) (*T.Outbound, error) { } decoded := u.Params defaultMethod := "chacha20-ietf-poly1305" + if u.Password == "" { + u.Password = u.Username + u.Username = "none" + } if u.Username != "" { defaultMethod = u.Username }