impl cidr as password:CIDR:http://target
This commit is contained in:
@@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user