feat: production-ready domain control dashboard
Container-Image veröffentlichen / container (push) Has been cancelled
Container-Image veröffentlichen / container (push) Has been cancelled
This commit is contained in:
1 parent
9c60eaf3fe
commit
df7516e7ab
45 files changed
+7932
-1
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package ipresolve
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/netip"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPublicAddress(t *testing.T) {
|
||||
t.Parallel()
|
||||
for _, raw := range []string{"1.1.1.1", "2001:4860:4860::8888"} {
|
||||
address := netip.MustParseAddr(raw)
|
||||
if !publicAddress(address) {
|
||||
t.Fatalf("expected %s to be public", raw)
|
||||
}
|
||||
}
|
||||
for _, raw := range []string{"127.0.0.1", "192.168.1.1", "169.254.1.1", "::1", "fe80::1"} {
|
||||
address := netip.MustParseAddr(raw)
|
||||
if publicAddress(address) {
|
||||
t.Fatalf("expected %s to be rejected", raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisabledIPv6IsNotResolvedOrReportedAsError(t *testing.T) {
|
||||
t.Parallel()
|
||||
result := New().ResolveWithIPv6(context.Background(), nil, nil, false)
|
||||
if result.IPv4Err == nil {
|
||||
t.Fatal("missing IPv4 endpoints should still be reported")
|
||||
}
|
||||
if result.IPv6 != "" || result.IPv6Err != nil {
|
||||
t.Fatalf("disabled IPv6 must be skipped cleanly: %#v", result)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user