From 724fbfc985340ee7839506d7f0b9c56ce4e140f6 Mon Sep 17 00:00:00 2001 From: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:28:09 +0800 Subject: Fix: use default IP files on format maxmindGeoLite2ASNCSV & maxmindGeoLite2CountryCSV --- plugin/maxmind/maxmind_asn_csv_in.go | 7 +++---- plugin/maxmind/maxmind_country_csv_in.go | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'plugin/maxmind') diff --git a/plugin/maxmind/maxmind_asn_csv_in.go b/plugin/maxmind/maxmind_asn_csv_in.go index a0882683..39d1e76a 100644 --- a/plugin/maxmind/maxmind_asn_csv_in.go +++ b/plugin/maxmind/maxmind_asn_csv_in.go @@ -45,11 +45,10 @@ func newGeoLite2ASNCSV(action lib.Action, data json.RawMessage) (lib.InputConver } } - if tmp.IPv4File == "" { + // When both of IP files are not specified, + // it means user wants to use the default ones + if tmp.IPv4File == "" && tmp.IPv6File == "" { tmp.IPv4File = defaultASNIPv4File - } - - if tmp.IPv6File == "" { tmp.IPv6File = defaultASNIPv6File } diff --git a/plugin/maxmind/maxmind_country_csv_in.go b/plugin/maxmind/maxmind_country_csv_in.go index ca58964d..366220ab 100644 --- a/plugin/maxmind/maxmind_country_csv_in.go +++ b/plugin/maxmind/maxmind_country_csv_in.go @@ -51,11 +51,10 @@ func newGeoLite2CountryCSV(action lib.Action, data json.RawMessage) (lib.InputCo tmp.CountryCodeFile = defaultCCFile } - if tmp.IPv4File == "" { + // When both of IP files are not specified, + // it means user wants to use the default ones + if tmp.IPv4File == "" && tmp.IPv6File == "" { tmp.IPv4File = defaultCountryIPv4File - } - - if tmp.IPv6File == "" { tmp.IPv6File = defaultCountryIPv6File } -- cgit v1.3.1