summaryrefslogtreecommitdiff
path: root/internal/netutil/validate_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-07-07 16:17:39 +0200
committerLibravatar GitHub <noreply@github.com>2023-07-07 16:17:39 +0200
commit2a99df0588e168660d3b528209d8f51689ca92b7 (patch)
treea5835c3a0adf81ad4f07938919699fbc0de4a69b /internal/netutil/validate_test.go
parent[bugfix] Reorder web view logic, other small fixes (#1954) (diff)
downloadgotosocial-2a99df0588e168660d3b528209d8f51689ca92b7.tar.xz
[feature] enable + document explicit IP dialer allowing/denying (#1950)v0.10.0-rc1
* [feature] enable + document explicit IP dialer allowing/denying * lord have mercy * allee jonge * shortcut check ipv6 prefixes * comment * separate httpclient_test, export Sanitizer
Diffstat (limited to 'internal/netutil/validate_test.go')
-rw-r--r--internal/netutil/validate_test.go54
1 files changed, 0 insertions, 54 deletions
diff --git a/internal/netutil/validate_test.go b/internal/netutil/validate_test.go
deleted file mode 100644
index 37def4ce6..000000000
--- a/internal/netutil/validate_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package netutil
-
-import (
- "net/netip"
- "testing"
-)
-
-func TestValidateIP(t *testing.T) {
- tests := []struct {
- name string
- ip netip.Addr
- }{
- // IPv4 tests
- {
- name: "IPv4 this host on this network",
- ip: netip.MustParseAddr("0.0.0.0"),
- },
- {
- name: "IPv4 dummy address",
- ip: netip.MustParseAddr("192.0.0.8"),
- },
- {
- name: "IPv4 Port Control Protocol Anycast",
- ip: netip.MustParseAddr("192.0.0.9"),
- },
- {
- name: "IPv4 Traversal Using Relays around NAT Anycast",
- ip: netip.MustParseAddr("192.0.0.10"),
- },
- {
- name: "IPv4 NAT64/DNS64 Discovery 1",
- ip: netip.MustParseAddr("192.0.0.17"),
- },
- {
- name: "IPv4 NAT64/DNS64 Discovery 2",
- ip: netip.MustParseAddr("192.0.0.171"),
- },
- // IPv6 tests
- {
- name: "IPv4-mapped address",
- ip: netip.MustParseAddr("::ffff:169.254.169.254"),
- },
- }
-
- for _, tc := range tests {
- tc := tc
- t.Run(tc.name, func(t *testing.T) {
- t.Parallel()
- if valid := ValidateIP(tc.ip); valid != false {
- t.Fatalf("Expected IP %s to be: %t, got: %t", tc.ip, false, valid)
- }
- })
- }
-}