mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-16 15:17:14 +00:00
fix(link): map vcn to verifyPeerCertByName in applySecurity (#6479)
Go share-link importer dropped verifyPeerCertByName for VLESS/Trojan/SS TLS while the TS parser and Hysteria2 path already kept it. Fixes #6477. Co-authored-by: mrchatam <287639636+mrchatam@users.noreply.github.com>
This commit is contained in:
@@ -666,6 +666,7 @@ func applySecurity(stream map[string]any, p url.Values) {
|
||||
tls["alpn"] = splitComma(alpn)
|
||||
}
|
||||
tls["echConfigList"] = p.Get("ech")
|
||||
tls["verifyPeerCertByName"] = p.Get("vcn")
|
||||
tls["pinnedPeerCertSha256"] = p.Get("pcs")
|
||||
case "reality":
|
||||
re := stream["realitySettings"].(map[string]any)
|
||||
|
||||
@@ -123,12 +123,12 @@ func TestParse_RealitySecurityMapped(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParse_TLSSecurityMapped(t *testing.T) {
|
||||
res, err := ParseLink("trojan://pw@h.com:443?type=tcp&security=tls&sni=SNI&fp=chrome&alpn=h2,http/1.1&ech=ECH&pcs=PCS")
|
||||
res, err := ParseLink("trojan://pw@h.com:443?type=tcp&security=tls&sni=SNI&fp=chrome&alpn=h2,http/1.1&ech=ECH&vcn=VCN&pcs=PCS")
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
tls := streamSub(t, res, "tlsSettings")
|
||||
if tls["serverName"] != "SNI" || tls["fingerprint"] != "chrome" || tls["echConfigList"] != "ECH" || tls["pinnedPeerCertSha256"] != "PCS" {
|
||||
if tls["serverName"] != "SNI" || tls["fingerprint"] != "chrome" || tls["echConfigList"] != "ECH" || tls["verifyPeerCertByName"] != "VCN" || tls["pinnedPeerCertSha256"] != "PCS" {
|
||||
t.Errorf("tlsSettings fields = %#v", tls)
|
||||
}
|
||||
if alpn, _ := tls["alpn"].([]string); !reflect.DeepEqual(alpn, []string{"h2", "http/1.1"}) {
|
||||
|
||||
Reference in New Issue
Block a user