mirror of
https://github.com/coredns/coredns.git
synced 2025-12-02 00:24:08 -05:00
plugin/geoip: Add ASN schema support (#7730)
Adds the ability to query ASN .mmdb databases, in addition to the existing City db functionality. Signed-off-by: Eric Case <eric.case@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
var (
|
||||
fixturesDir = "./testdata"
|
||||
cityDBPath = filepath.Join(fixturesDir, "GeoLite2-City.mmdb")
|
||||
asnDBPath = filepath.Join(fixturesDir, "GeoLite2-ASN.mmdb")
|
||||
unknownDBPath = filepath.Join(fixturesDir, "GeoLite2-UnknownDbType.mmdb")
|
||||
)
|
||||
|
||||
@@ -50,9 +51,12 @@ func TestGeoIPParse(t *testing.T) {
|
||||
expectedErr string
|
||||
expectedDBType int
|
||||
}{
|
||||
// Valid
|
||||
// Valid - City database
|
||||
{false, fmt.Sprintf("%s %s\n", pluginName, cityDBPath), "", city},
|
||||
{false, fmt.Sprintf("%s %s { edns-subnet }", pluginName, cityDBPath), "", city},
|
||||
// Valid - ASN database
|
||||
{false, fmt.Sprintf("%s %s\n", pluginName, asnDBPath), "", asn},
|
||||
{false, fmt.Sprintf("%s %s { edns-subnet }", pluginName, asnDBPath), "", asn},
|
||||
|
||||
// Invalid
|
||||
{true, pluginName, "Wrong argument count", 0},
|
||||
|
||||
Reference in New Issue
Block a user