DB 적재 초기구조

This commit is contained in:
Lectom C Han
2025-12-09 13:51:25 +09:00
parent fa1a7a057e
commit ecaca02400
11 changed files with 498 additions and 73 deletions

View File

@@ -12,7 +12,10 @@ func TestLookupValidIP(t *testing.T) {
t.Skipf("mmdb not available at %s: %v", dbPath, err)
}
resolver, err := NewResolver(dbPath)
resolver, err := NewResolver(Config{
Backend: BackendMMDB,
MMDBPath: dbPath,
})
if err != nil {
t.Fatalf("failed to open db: %v", err)
}
@@ -26,10 +29,6 @@ func TestLookupValidIP(t *testing.T) {
if loc.IP != "1.1.1.1" {
t.Errorf("unexpected IP: %s", loc.IP)
}
// Ensure coordinates are populated for sanity.
if loc.Latitude == 0 && loc.Longitude == 0 {
t.Errorf("expected non-zero coordinates, got lat=%f lon=%f", loc.Latitude, loc.Longitude)
}
}
func TestLookupInvalidIP(t *testing.T) {
@@ -38,7 +37,10 @@ func TestLookupInvalidIP(t *testing.T) {
t.Skipf("mmdb not available at %s: %v", dbPath, err)
}
resolver, err := NewResolver(dbPath)
resolver, err := NewResolver(Config{
Backend: BackendMMDB,
MMDBPath: dbPath,
})
if err != nil {
t.Fatalf("failed to open db: %v", err)
}