fix(netxlite): consolidate IPv4/IPv6 checking code (#726)
Originally 966e7f7cdd
See https://github.com/ooni/probe/issues/2096
This commit is contained in:
parent
e126e73de7
commit
192dfd49b4
2 changed files with 20 additions and 12 deletions
|
|
@ -57,7 +57,9 @@ func TestQuirkSortIPAddrs(t *testing.T) {
|
|||
addrs := []string{
|
||||
"::1",
|
||||
"192.168.1.2",
|
||||
"x.org", // ensure we skip non IP addrs
|
||||
"2a00:1450:4002:404::2004",
|
||||
"example.com", // ensure we skip non IP addrs
|
||||
"142.250.184.36",
|
||||
"2604:8800:5000:82:466:38ff:fecb:d46e",
|
||||
"198.145.29.83",
|
||||
|
|
@ -83,4 +85,14 @@ func TestQuirkSortIPAddrs(t *testing.T) {
|
|||
t.Fatal("expected nil output")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("with non-IP addrs", func(t *testing.T) {
|
||||
addrs := []string{
|
||||
"example.com",
|
||||
"x.org",
|
||||
}
|
||||
if quirkSortIPAddrs(addrs) != nil {
|
||||
t.Fatal("expected nil output")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue