24 lines
494 B
Go
24 lines
494 B
Go
package hysteria2
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeShareLink(t *testing.T) {
|
|
got, remark, err := NormalizeShareLink("hy2://secret@example.com:443/?sni=example.com&insecure=1#EU")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if remark != "EU" {
|
|
t.Fatalf("remark=%q", remark)
|
|
}
|
|
if !Detect(got) {
|
|
t.Fatalf("not detected: %s", got)
|
|
}
|
|
host, port, err := HostPort(got)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if host != "example.com" || port != "443" {
|
|
t.Fatalf("host=%q port=%q", host, port)
|
|
}
|
|
}
|