fix: Converter for password of ss2022

fix: Converter for password of ss2022

fixup! fix: Converter for password of ss2022 and ws

fix: Converter for password of ss2022 and ws
This commit is contained in:
gVisor bot 2022-06-22 22:18:13 +08:00
parent 99281e6f93
commit 4fbcd740e1

View file

@ -114,7 +114,6 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
headers := make(map[string]any) headers := make(map[string]any)
wsOpts := make(map[string]any) wsOpts := make(map[string]any)
//headers["Host"] = RandHost()
headers["User-Agent"] = RandUserAgent() headers["User-Agent"] = RandUserAgent()
wsOpts["path"] = query.Get("path") wsOpts["path"] = query.Get("path")
@ -209,9 +208,9 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
case "ws": case "ws":
headers := make(map[string]any) headers := make(map[string]any)
wsOpts := make(map[string]any) wsOpts := make(map[string]any)
headers["User-Agent"] = RandUserAgent()
headers["Host"] = []string{query.Get("host")} headers["Host"] = query.Get("host")
wsOpts["path"] = []string{query.Get("path")} wsOpts["path"] = query.Get("path")
wsOpts["headers"] = headers wsOpts["headers"] = headers
vless["ws-opts"] = wsOpts vless["ws-opts"] = wsOpts
@ -305,10 +304,10 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
wsOpts := make(map[string]any) wsOpts := make(map[string]any)
wsOpts["path"] = []string{"/"} wsOpts["path"] = []string{"/"}
if values["host"] != "" && values["host"] != nil { if values["host"] != "" && values["host"] != nil {
headers["Host"] = []string{values["host"].(string)} headers["Host"] = values["host"].(string)
} }
if values["path"] != "" && values["path"] != nil { if values["path"] != "" && values["path"] != nil {
wsOpts["path"] = []string{values["path"].(string)} wsOpts["path"] = values["path"].(string)
} }
wsOpts["headers"] = headers wsOpts["headers"] = headers
vmess["ws-opts"] = wsOpts vmess["ws-opts"] = wsOpts
@ -348,9 +347,9 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
) )
if password, found = urlSS.User.Password(); !found { if password, found = urlSS.User.Password(); !found {
dcBuf, err := encRaw.DecodeString(cipher) dcBuf, _ := enc.DecodeString(cipher)
if err != nil { if !strings.Contains(string(dcBuf), "2022-blake3") {
continue dcBuf, _ = encRaw.DecodeString(cipher)
} }
cipher, password, found = strings.Cut(string(dcBuf), ":") cipher, password, found = strings.Cut(string(dcBuf), ":")
if !found { if !found {