From 8b3ce7d7b60f8cfdf8b53b6ddbf36a57b80907f3 Mon Sep 17 00:00:00 2001 From: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:41:43 +0800 Subject: [PATCH] Feat: lookup command supports dbipCountryMMDB & ipinfoCountryMMDB --- lookup.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lookup.go b/lookup.go index 47ef55edde5..442229c7a44 100644 --- a/lookup.go +++ b/lookup.go @@ -21,6 +21,8 @@ import ( var supportedInputFormats = map[string]bool{ strings.ToLower("clashRuleSet"): true, strings.ToLower("clashRuleSetClassical"): true, + strings.ToLower("dbipCountryMMDB"): true, + strings.ToLower("ipinfoCountryMMDB"): true, strings.ToLower("maxmindMMDB"): true, strings.ToLower("mihomoMRS"): true, strings.ToLower("singboxSRS"): true, @@ -32,7 +34,7 @@ var supportedInputFormats = map[string]bool{ func init() { rootCmd.AddCommand(lookupCmd) - lookupCmd.Flags().StringP("format", "f", "", "(Required) The input format. Available formats: text, v2rayGeoIPDat, maxmindMMDB, mihomoMRS, singboxSRS, clashRuleSet, clashRuleSetClassical, surgeRuleSet") + lookupCmd.Flags().StringP("format", "f", "", "(Required) The input format. Available formats: text, v2rayGeoIPDat, maxmindMMDB, dbipCountryMMDB, ipinfoCountryMMDB, mihomoMRS, singboxSRS, clashRuleSet, clashRuleSetClassical, surgeRuleSet") lookupCmd.Flags().StringP("uri", "u", "", "URI of the input file, support both local file path and remote HTTP(S) URL. (Cannot be used with \"dir\" flag)") lookupCmd.Flags().StringP("dir", "d", "", "Path to the input directory. The filename without extension will be as the name of the list. (Cannot be used with \"uri\" flag)") lookupCmd.Flags().StringSliceP("searchlist", "l", []string{}, "The lists to search from, separated by comma") @@ -168,6 +170,22 @@ func getInputForLookup(format, name, uri, dir string) lib.InputConverter { URI: uri, } + case strings.ToLower(maxmind.TypeDBIPCountryMMDBIn): + input = &maxmind.MMDBIn{ + Type: maxmind.TypeDBIPCountryMMDBIn, + Action: lib.ActionAdd, + Description: maxmind.DescDBIPCountryMMDBIn, + URI: uri, + } + + case strings.ToLower(maxmind.TypeIPInfoCountryMMDBIn): + input = &maxmind.MMDBIn{ + Type: maxmind.TypeIPInfoCountryMMDBIn, + Action: lib.ActionAdd, + Description: maxmind.DescIPInfoCountryMMDBIn, + URI: uri, + } + case strings.ToLower(mihomo.TypeMRSIn): input = &mihomo.MRSIn{ Type: mihomo.TypeMRSIn,