From d38ceb78c91465f1385a32ca52db6f1f493cec58 Mon Sep 17 00:00:00 2001 From: H1JK Date: Tue, 10 Jan 2023 18:25:05 +0800 Subject: [PATCH] chore: Refine converter packet encoding parse --- common/convert/converter.go | 8 -------- common/convert/v.go | 9 ++++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/common/convert/converter.go b/common/convert/converter.go index 33d20cc8..851920a6 100644 --- a/common/convert/converter.go +++ b/common/convert/converter.go @@ -144,14 +144,6 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) { if encryption := query.Get("encryption"); 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) continue } diff --git a/common/convert/v.go b/common/convert/v.go index 53e28ff2..29be4a9f 100644 --- a/common/convert/v.go +++ b/common/convert/v.go @@ -15,7 +15,6 @@ func handleVShareLink(names map[string]int, url *url.URL, scheme string, proxy m proxy["port"] = url.Port() proxy["uuid"] = url.User.Username() proxy["udp"] = true - proxy["xudp"] = true proxy["skip-cert-verify"] = false proxy["tls"] = false 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 } + switch query.Get("packetEncoding") { + case "none": + case "packet": + proxy["packet-addr"] = true + default: + proxy["xudp"] = true + } + network := strings.ToLower(query.Get("type")) if network == "" { network = "tcp"