Skip to content

Commit

Permalink
fix: shadowsocks generation
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Nov 10, 2024
1 parent 190b549 commit 56a559a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ray2sing/shadowsocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
Expand Down

0 comments on commit 56a559a

Please sign in to comment.