github.com/kelleygo/clashcore@v1.0.2/common/convert/converter_test.go (about) 1 package convert 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 // https://v2.hysteria.network/zh/docs/developers/URI-Scheme/ 10 func TestConvertsV2Ray_normal(t *testing.T) { 11 hy2test := "hysteria2://letmein@example.com:8443/?insecure=1&obfs=salamander&obfs-password=gawrgura&pinSHA256=deadbeef&sni=real.example.com&up=114&down=514&alpn=h3,h4#hy2test" 12 13 expected := []map[string]interface{}{ 14 { 15 "name": "hy2test", 16 "type": "hysteria2", 17 "server": "example.com", 18 "port": "8443", 19 "sni": "real.example.com", 20 "obfs": "salamander", 21 "obfs-password": "gawrgura", 22 "alpn": []string{"h3", "h4"}, 23 "password": "letmein", 24 "up": "114", 25 "down": "514", 26 "skip-cert-verify": true, 27 "fingerprint": "deadbeef", 28 }, 29 } 30 31 proxies, err := ConvertsV2Ray([]byte(hy2test)) 32 33 assert.Nil(t, err) 34 assert.Equal(t, expected, proxies) 35 }