impl cidr as password:CIDR:http://target

This commit is contained in:
bel
2025-11-20 08:28:25 -07:00
parent 9791f80b28
commit 2ff12869cd
6 changed files with 88 additions and 2 deletions

View File

@@ -105,3 +105,32 @@ func TestCORS(t *testing.T) {
}
})
}
func TestAssertFrom(t *testing.T) {
cases := map[string]struct {
from string
remote string
err bool
}{
"empty": {},
"ipv6 localhost": {
from: "::1/128",
remote: "::1:12345",
},
"ipv4 localhost": {
from: "127.0.0.1/32",
remote: "127.0.0.1:12345",
},
}
for name, d := range cases {
c := d
t.Run(name, func(t *testing.T) {
err := assertFrom(c.from, c.remote)
got := err != nil
if got != c.err {
t.Errorf("expected err=%v but got %v", c.err, err)
}
})
}
}