mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
36 lines
981 B
Go
36 lines
981 B
Go
package convert
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// https://v2.hysteria.network/zh/docs/developers/URI-Scheme/
|
|
func TestConvertsV2Ray_normal(t *testing.T) {
|
|
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"
|
|
|
|
expected := []map[string]interface{}{
|
|
{
|
|
"name": "hy2test",
|
|
"type": "hysteria2",
|
|
"server": "example.com",
|
|
"port": "8443",
|
|
"sni": "real.example.com",
|
|
"obfs": "salamander",
|
|
"obfs-password": "gawrgura",
|
|
"alpn": []string{"h3", "h4"},
|
|
"password": "letmein",
|
|
"up": "114",
|
|
"down": "514",
|
|
"skip-cert-verify": true,
|
|
"fingerprint": "deadbeef",
|
|
},
|
|
}
|
|
|
|
proxies, err := ConvertsV2Ray([]byte(hy2test))
|
|
|
|
assert.Nil(t, err)
|
|
assert.Equal(t, expected, proxies)
|
|
}
|