cleanup: move bogon checking code in netxlite (#562)
I develop this diff while working on https://github.com/ooni/probe/issues/1803#issuecomment-957323297. While there, make sure we don't have duplicate bogon code and always use the code inside netxlite.
This commit is contained in:
parent
ffdafaf351
commit
f91de2ecd6
5 changed files with 23 additions and 63 deletions
|
|
@ -9,21 +9,6 @@ import (
|
|||
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
||||
)
|
||||
|
||||
func TestResolverIsBogon(t *testing.T) {
|
||||
if resolver.IsBogon("antani") != true {
|
||||
t.Fatal("unexpected result")
|
||||
}
|
||||
if resolver.IsBogon("127.0.0.1") != true {
|
||||
t.Fatal("unexpected result")
|
||||
}
|
||||
if resolver.IsBogon("1.1.1.1") != false {
|
||||
t.Fatal("unexpected result")
|
||||
}
|
||||
if resolver.IsBogon("10.0.1.1") != true {
|
||||
t.Fatal("unexpected result")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBogonAwareResolverWithBogon(t *testing.T) {
|
||||
r := resolver.BogonResolver{
|
||||
Resolver: resolver.NewFakeResolverWithResult([]string{"127.0.0.1"}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue