summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoyalsoldier <[email protected]>2024-11-03 16:41:43 +0800
committerLoyalsoldier <[email protected]>2024-11-03 16:41:43 +0800
commit8b3ce7d7b60f8cfdf8b53b6ddbf36a57b80907f3 (patch)
treea0fd28832d7a8c73af43d0eb70052eecf31a3790
parentcff6c086d060c803091a487b61a1be7cc65ee258 (diff)
Feat: lookup command supports dbipCountryMMDB & ipinfoCountryMMDB
-rw-r--r--lookup.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/lookup.go b/lookup.go
index 47ef55ed..442229c7 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,