|
|
@@ -177,6 +177,32 @@ func TestParse_XhttpExtraAndSnakeCaseFields(t *testing.T) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func TestParse_VmessWSPathWithoutHostKey(t *testing.T) {
|
|
|
+ // Some generators omit "host" when it equals the address; the path must
|
|
|
+ // still be honored (matching the TS parser), not dropped to the default.
|
|
|
+ inner := `{"v":"2","add":"h","port":443,"id":"11111111-2222-4333-8444-555555555555","net":"ws","path":"/api","tls":"tls"}`
|
|
|
+ link := "vmess://" + base64.StdEncoding.EncodeToString([]byte(inner))
|
|
|
+ res, err := ParseLink(link)
|
|
|
+ if err != nil {
|
|
|
+ t.Fatalf("parse: %v", err)
|
|
|
+ }
|
|
|
+ wss := streamSub(t, res, "wsSettings")
|
|
|
+ if wss["path"] != "/api" {
|
|
|
+ t.Errorf("wsSettings path = %v, want /api (dropped when host key absent)", wss["path"])
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func TestParse_Hysteria2VerifyPeerCertByName(t *testing.T) {
|
|
|
+ res, err := ParseLink("hysteria2://[email protected]:443?security=tls&sni=decoy.com&vcn=real-cert.com#r")
|
|
|
+ if err != nil {
|
|
|
+ t.Fatalf("parse: %v", err)
|
|
|
+ }
|
|
|
+ tls := streamSub(t, res, "tlsSettings")
|
|
|
+ if tls["verifyPeerCertByName"] != "real-cert.com" {
|
|
|
+ t.Errorf("verifyPeerCertByName = %v, want real-cert.com (vcn param ignored)", tls["verifyPeerCertByName"])
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func TestParse_TCPHTTPHeader(t *testing.T) {
|
|
|
res, err := ParseLink("vless://[email protected]:443?type=tcp&headerType=http&host=ex.com&path=%2F")
|
|
|
if err != nil {
|