♻️ Refactor parsers

This commit is contained in:
2024-04-23 14:39:16 +08:00
parent 48dece2a51
commit ebc91d8aad
15 changed files with 549 additions and 371 deletions

View File

@ -1,22 +1,22 @@
package test
import (
"sub2clash/parser"
"strings"
"testing"
"gopkg.in/yaml.v3"
)
func TestHy2Parser(t *testing.T) {
res, err := parser.ParseTrojan("trojan://Abse64hhjewrs@test.com:8443?type=ws&path=%2Fx&host=test.com&security=tls&fp=&alpn=http%2F1.1&sni=test.com#test")
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))
func TestParser(t *testing.T) {
// res, err := parser.ParseTrojan("trojan://Abse64hhjewrs@test.com:8443?type=ws&path=%2Fx&host=test.com&security=tls&fp=&alpn=http%2F1.1&sni=test.com#test")
// 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))
t.Log(strings.SplitN("123456", "/?", 2))
}