mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-26 13:07:14 +00:00
fix(links): bracket ipv6 hosts in share links and qr codes (#5310)
* fix(sub): bracket ipv6 hosts in share links * fix(frontend): bracket ipv6 hosts in share links
This commit is contained in:
@@ -426,6 +426,25 @@ func TestCloneStringMap_Empty(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestJoinHostPort(t *testing.T) {
|
||||
cases := []struct {
|
||||
host string
|
||||
port int
|
||||
want string
|
||||
}{
|
||||
{"example.com", 443, "example.com:443"},
|
||||
{"1.2.3.4", 443, "1.2.3.4:443"},
|
||||
{"2001:db8::1", 443, "[2001:db8::1]:443"},
|
||||
{"[2001:db8::1]", 443, "[2001:db8::1]:443"},
|
||||
{"2001:db8::1", 8080, "[2001:db8::1]:8080"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := joinHostPort(c.host, c.port); got != c.want {
|
||||
t.Fatalf("joinHostPort(%q, %d) = %q, want %q", c.host, c.port, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetHostFromXFH_HostOnly(t *testing.T) {
|
||||
got, err := getHostFromXFH("example.com")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user