Skip to content

Commit

Permalink
Feat: lookup command supports dbipCountryMMDB & ipinfoCountryMMDB
Browse files Browse the repository at this point in the history
  • Loading branch information
Loyalsoldier committed Nov 3, 2024
1 parent cff6c08 commit 8b3ce7d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8b3ce7d

Please sign in to comment.