fixes
This commit is contained in:
1 parent
f30adf05af
commit
8824af8699
29 files changed
+1201
-115
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package geoip
|
||||
|
||||
import (
|
||||
"net/netip"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLookupWithoutDB(t *testing.T) {
|
||||
var l *Lookup
|
||||
if r := l.Lookup(netip.MustParseAddr("8.8.8.8")); r.Configured || r.Country != "" {
|
||||
t.Fatalf("unexpected result %+v", r)
|
||||
}
|
||||
if r := l.Lookup(netip.MustParseAddr("10.1.2.3")); r.Scope != "private" {
|
||||
t.Fatalf("want private scope, got %+v", r)
|
||||
}
|
||||
if r := l.Lookup(netip.MustParseAddr("::ffff:127.0.0.1")); r.Scope != "loopback" || r.IP != "127.0.0.1" {
|
||||
t.Fatalf("want unmapped loopback, got %+v", r)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenEmpty(t *testing.T) {
|
||||
if l, err := Open("", ""); l != nil || err != nil {
|
||||
t.Fatalf("want nil,nil got %v,%v", l, err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user