diff options
| author | copilot-swe-agent[bot] <[email protected]> | 2026-03-09 06:35:47 +0000 |
|---|---|---|
| committer | copilot-swe-agent[bot] <[email protected]> | 2026-03-09 06:35:47 +0000 |
| commit | 2600825c50d7e7f2b4427674f1aefca270bcca27 (patch) | |
| tree | 18f216c6af28fd3975a0665d75ccf7b5c0078cb6 /plugin/maxmind/common_in.go | |
| parent | 5a14eb90f575b983aa407341af91aa7654e65f12 (diff) | |
Refactor: all plugin subdirectories use option patterncopilot/modify-plugin-files-subdirectories
Apply the same functional options pattern from plugin/singbox to:
- plugin/mihomo (mrs_in.go, mrs_out.go)
- plugin/plaintext (text_in.go, common_in.go, common_out.go, text_out.go, clash_in.go, clash_out.go, json_in.go, surge_in.go, surge_out.go)
- plugin/maxmind (all input/output files)
- plugin/v2ray (dat_in.go, dat_out.go)
- plugin/special (cutter.go, lookup.go, private.go, stdin.go, stdout.go)
- lookup.go and merge.go updated to use new constructors
Co-authored-by: Loyalsoldier <[email protected]>
Diffstat (limited to 'plugin/maxmind/common_in.go')
| -rw-r--r-- | plugin/maxmind/common_in.go | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/plugin/maxmind/common_in.go b/plugin/maxmind/common_in.go index 3d97388c..fd34a735 100644 --- a/plugin/maxmind/common_in.go +++ b/plugin/maxmind/common_in.go @@ -3,7 +3,6 @@ package maxmind import ( "encoding/json" "path/filepath" - "strings" "github.com/Loyalsoldier/geoip/lib" ) @@ -14,7 +13,7 @@ var ( defaultIPInfoCountryMMDBFile = filepath.Join("./", "ipinfo", "country.mmdb") ) -func newGeoLite2CountryMMDBIn(iType string, iDesc string, action lib.Action, data json.RawMessage) (lib.InputConverter, error) { +func NewGeoLite2CountryMMDBInFromBytes(iType string, iDesc string, action lib.Action, data json.RawMessage) (lib.InputConverter, error) { var tmp struct { URI string `json:"uri"` Want []string `json:"wantedList"` @@ -40,20 +39,10 @@ func newGeoLite2CountryMMDBIn(iType string, iDesc string, action lib.Action, dat } } - // Filter want list - wantList := make(map[string]bool) - for _, want := range tmp.Want { - if want = strings.ToUpper(strings.TrimSpace(want)); want != "" { - wantList[want] = true - } - } - - return &GeoLite2CountryMMDBIn{ - Type: iType, - Action: action, - Description: iDesc, - URI: tmp.URI, - Want: wantList, - OnlyIPType: tmp.OnlyIPType, - }, nil + return NewGeoLite2CountryMMDBIn( + iType, iDesc, action, + WithURI(tmp.URI), + WithInputWantedList(tmp.Want), + WithInputOnlyIPType(tmp.OnlyIPType), + ), nil } |
