fix: hy2 解析缺少 name 字段

This commit is contained in:
2024-04-21 00:23:29 +08:00
parent faaf5c366a
commit aa9e102a81
3 changed files with 24 additions and 1 deletions

22
test/parser_test.go Normal file
View File

@ -0,0 +1,22 @@
package test
import (
"sub2clash/parser"
"testing"
"gopkg.in/yaml.v3"
)
func TestHy2Parser(t *testing.T) {
res, err := parser.ParseHysteria2("hysteria2://letmein@example.com/?insecure=1&obfs=salamander&obfs-password=gawrgura&pinSHA256=deadbeef&sni=real.example.com")
if err != nil {
t.Log(err.Error())
t.Fail()
}
bytes, err := yaml.Marshal(res)
if err != nil {
t.Log(err.Error())
t.Fail()
}
t.Log(string(bytes))
}