From c3671a154d43eb531df3d1b94d24e7317caffc4d Mon Sep 17 00:00:00 2001 From: MetaCubeX Date: Wed, 22 Jun 2022 22:18:13 +0800 Subject: [PATCH 1/3] fix: Converter for password of ss2022 and ws --- common/convert/converter.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/common/convert/converter.go b/common/convert/converter.go index eb01524b..fad13068 100644 --- a/common/convert/converter.go +++ b/common/convert/converter.go @@ -114,7 +114,6 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) { headers := make(map[string]any) wsOpts := make(map[string]any) - //headers["Host"] = RandHost() headers["User-Agent"] = RandUserAgent() wsOpts["path"] = query.Get("path") @@ -209,9 +208,9 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) { case "ws": headers := make(map[string]any) wsOpts := make(map[string]any) - - headers["Host"] = []string{query.Get("host")} - wsOpts["path"] = []string{query.Get("path")} + headers["User-Agent"] = RandUserAgent() + headers["Host"] = query.Get("host") + wsOpts["path"] = query.Get("path") wsOpts["headers"] = headers vless["ws-opts"] = wsOpts @@ -305,10 +304,10 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) { wsOpts := make(map[string]any) wsOpts["path"] = []string{"/"} if values["host"] != "" && values["host"] != nil { - headers["Host"] = []string{values["host"].(string)} + headers["Host"] = values["host"].(string) } if values["path"] != "" && values["path"] != nil { - wsOpts["path"] = []string{values["path"].(string)} + wsOpts["path"] = values["path"].(string) } wsOpts["headers"] = headers vmess["ws-opts"] = wsOpts @@ -348,10 +347,7 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) { ) if password, found = urlSS.User.Password(); !found { - dcBuf, err := encRaw.DecodeString(cipher) - if err != nil { - continue - } + dcBuf, _ := encRaw.DecodeString(cipher) cipher, password, found = strings.Cut(string(dcBuf), ":") if !found { continue From 449946cc15d7e27b125b2b30eee93fabb2ae5b65 Mon Sep 17 00:00:00 2001 From: MetaCubeX Date: Thu, 23 Jun 2022 00:18:30 +0800 Subject: [PATCH 2/3] fixup! fix: Converter for password of ss2022 and ws --- common/convert/converter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/convert/converter.go b/common/convert/converter.go index fad13068..6661ce1b 100644 --- a/common/convert/converter.go +++ b/common/convert/converter.go @@ -347,7 +347,7 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) { ) if password, found = urlSS.User.Password(); !found { - dcBuf, _ := encRaw.DecodeString(cipher) + dcBuf, _ := enc.DecodeString(cipher) cipher, password, found = strings.Cut(string(dcBuf), ":") if !found { continue From dbb834d964a6f03c47187d88defef8f97d233cb6 Mon Sep 17 00:00:00 2001 From: MetaCubeX Date: Thu, 23 Jun 2022 00:40:08 +0800 Subject: [PATCH 3/3] fix: Converter for password of ss2022 --- common/convert/converter.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/convert/converter.go b/common/convert/converter.go index 6661ce1b..ab0d43e1 100644 --- a/common/convert/converter.go +++ b/common/convert/converter.go @@ -348,6 +348,9 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) { if password, found = urlSS.User.Password(); !found { dcBuf, _ := enc.DecodeString(cipher) + if !strings.Contains(cipher, "2022-blake3") { + dcBuf, _ = encRaw.DecodeString(cipher) + } cipher, password, found = strings.Cut(string(dcBuf), ":") if !found { continue