diff options
Diffstat (limited to 'plugin/maxmind')
| -rw-r--r-- | plugin/maxmind/maxmind_asn_csv_in.go | 8 | ||||
| -rw-r--r-- | plugin/maxmind/maxmind_country_csv_in.go | 8 | ||||
| -rw-r--r-- | plugin/maxmind/maxmind_country_mmdb_in.go | 8 | ||||
| -rw-r--r-- | plugin/maxmind/maxmind_country_mmdb_out.go | 11 |
4 files changed, 4 insertions, 31 deletions
diff --git a/plugin/maxmind/maxmind_asn_csv_in.go b/plugin/maxmind/maxmind_asn_csv_in.go index 5b42be59..d924e3f9 100644 --- a/plugin/maxmind/maxmind_asn_csv_in.go +++ b/plugin/maxmind/maxmind_asn_csv_in.go @@ -137,13 +137,7 @@ func (g *GeoLite2ASNCSVIn) Input(container lib.Container) (lib.Container, error) return nil, fmt.Errorf("❌ [type %s | action %s] no entry is generated", g.Type, g.Action) } - var ignoreIPType lib.IgnoreIPOption - switch g.OnlyIPType { - case lib.IPv4: - ignoreIPType = lib.IgnoreIPv6 - case lib.IPv6: - ignoreIPType = lib.IgnoreIPv4 - } + ignoreIPType := lib.GetIgnoreIPType(g.OnlyIPType) for _, entry := range entries { switch g.Action { diff --git a/plugin/maxmind/maxmind_country_csv_in.go b/plugin/maxmind/maxmind_country_csv_in.go index da70c281..93d38c37 100644 --- a/plugin/maxmind/maxmind_country_csv_in.go +++ b/plugin/maxmind/maxmind_country_csv_in.go @@ -125,13 +125,7 @@ func (g *GeoLite2CountryCSVIn) Input(container lib.Container) (lib.Container, er return nil, fmt.Errorf("❌ [type %s | action %s] no entry is generated", g.Type, g.Action) } - var ignoreIPType lib.IgnoreIPOption - switch g.OnlyIPType { - case lib.IPv4: - ignoreIPType = lib.IgnoreIPv6 - case lib.IPv6: - ignoreIPType = lib.IgnoreIPv4 - } + ignoreIPType := lib.GetIgnoreIPType(g.OnlyIPType) for _, entry := range entries { switch g.Action { diff --git a/plugin/maxmind/maxmind_country_mmdb_in.go b/plugin/maxmind/maxmind_country_mmdb_in.go index be867b9b..1f6d5386 100644 --- a/plugin/maxmind/maxmind_country_mmdb_in.go +++ b/plugin/maxmind/maxmind_country_mmdb_in.go @@ -69,13 +69,7 @@ func (g *GeoLite2CountryMMDBIn) Input(container lib.Container) (lib.Container, e return nil, fmt.Errorf("❌ [type %s | action %s] no entry is generated", g.Type, g.Action) } - var ignoreIPType lib.IgnoreIPOption - switch g.OnlyIPType { - case lib.IPv4: - ignoreIPType = lib.IgnoreIPv6 - case lib.IPv6: - ignoreIPType = lib.IgnoreIPv4 - } + ignoreIPType := lib.GetIgnoreIPType(g.OnlyIPType) for _, entry := range entries { switch g.Action { diff --git a/plugin/maxmind/maxmind_country_mmdb_out.go b/plugin/maxmind/maxmind_country_mmdb_out.go index 4cf4cef6..fc72e83c 100644 --- a/plugin/maxmind/maxmind_country_mmdb_out.go +++ b/plugin/maxmind/maxmind_country_mmdb_out.go @@ -176,16 +176,7 @@ func (g *GeoLite2CountryMMDBOut) filterAndSortList(container lib.Container) []st } func (g *GeoLite2CountryMMDBOut) marshalData(writer *mmdbwriter.Tree, entry *lib.Entry, extraInfo map[string]any) error { - var entryCidr []string - var err error - switch g.OnlyIPType { - case lib.IPv4: - entryCidr, err = entry.MarshalText(lib.IgnoreIPv6) - case lib.IPv6: - entryCidr, err = entry.MarshalText(lib.IgnoreIPv4) - default: - entryCidr, err = entry.MarshalText() - } + entryCidr, err := entry.MarshalText(lib.GetIgnoreIPType(g.OnlyIPType)) if err != nil { return err } |
