diff options
| author | Loyalsoldier <[email protected]> | 2024-11-03 16:41:43 +0800 |
|---|---|---|
| committer | Loyalsoldier <[email protected]> | 2024-11-03 16:41:43 +0800 |
| commit | 8b3ce7d7b60f8cfdf8b53b6ddbf36a57b80907f3 (patch) | |
| tree | a0fd28832d7a8c73af43d0eb70052eecf31a3790 | |
| parent | cff6c086d060c803091a487b61a1be7cc65ee258 (diff) | |
Feat: lookup command supports dbipCountryMMDB & ipinfoCountryMMDB
| -rw-r--r-- | lookup.go | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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, |
