chore: Refine converter packet encoding parse
This commit is contained in:
parent
0c354c748a
commit
d38ceb78c9
2 changed files with 8 additions and 9 deletions
|
@ -144,14 +144,6 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
||||||
if encryption := query.Get("encryption"); encryption != "" {
|
if encryption := query.Get("encryption"); encryption != "" {
|
||||||
vmess["cipher"] = encryption
|
vmess["cipher"] = encryption
|
||||||
}
|
}
|
||||||
if packetEncoding := query.Get("packetEncoding"); packetEncoding != "" {
|
|
||||||
switch packetEncoding {
|
|
||||||
case "packet":
|
|
||||||
vmess["packet-addr"] = true
|
|
||||||
case "xudp":
|
|
||||||
vmess["xudp"] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proxies = append(proxies, vmess)
|
proxies = append(proxies, vmess)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ func handleVShareLink(names map[string]int, url *url.URL, scheme string, proxy m
|
||||||
proxy["port"] = url.Port()
|
proxy["port"] = url.Port()
|
||||||
proxy["uuid"] = url.User.Username()
|
proxy["uuid"] = url.User.Username()
|
||||||
proxy["udp"] = true
|
proxy["udp"] = true
|
||||||
proxy["xudp"] = true
|
|
||||||
proxy["skip-cert-verify"] = false
|
proxy["skip-cert-verify"] = false
|
||||||
proxy["tls"] = false
|
proxy["tls"] = false
|
||||||
tls := strings.ToLower(query.Get("security"))
|
tls := strings.ToLower(query.Get("security"))
|
||||||
|
@ -26,6 +25,14 @@ func handleVShareLink(names map[string]int, url *url.URL, scheme string, proxy m
|
||||||
proxy["servername"] = sni
|
proxy["servername"] = sni
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch query.Get("packetEncoding") {
|
||||||
|
case "none":
|
||||||
|
case "packet":
|
||||||
|
proxy["packet-addr"] = true
|
||||||
|
default:
|
||||||
|
proxy["xudp"] = true
|
||||||
|
}
|
||||||
|
|
||||||
network := strings.ToLower(query.Get("type"))
|
network := strings.ToLower(query.Get("type"))
|
||||||
if network == "" {
|
if network == "" {
|
||||||
network = "tcp"
|
network = "tcp"
|
||||||
|
|
Loading…
Reference in a new issue