ips

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdSet   = "set"
	CmdUnset = "unset"
	CmdReset = "reset"
)
View Source
const (
	ConfigName = "ips"
	ConfigType = "json"
	EnvIPSDir  = "IPS_DIR"
)
View Source
const (
	UsageLogLevel = "Set the desired verbosity level for logging."

	UsageLang         = "Language for output data. (default \"zh-CN\")"
	UsageFields       = "Fields to include in the output, separated by commas. (default \"country,province,city,isp\")"
	UsageUseDBFields  = "Use field names as they appear in the database. Default is common field names."
	UsageRewriteFiles = "Paths to files containing data rewrite rules, separated by commas."
	UsageDPFields     = "Fields to extract from the database. Defaults to all available fields."

	UsageQueryFile        = "Path to the combined IPv4/IPv6 database file."
	UsageQueryFormat      = "The format of the IPv4/IPv6 database file."
	UsageQueryIPv4File    = "Path to the IPv4 database file."
	UsageQueryIPv4Format  = "The format of the IPv4 database file."
	UsageQueryIPv6File    = "Path to the IPv6 database file."
	UsageQueryIPv6Format  = "The format of the IPv6 database file."
	UsageDPInputFile      = "Path to the input IP database file (required)."
	UsageDPInputFormat    = "The format of the input IP database file."
	UsageDumpOutputFile   = "Destination path for the dumped data. Defaults to standard output if not specified."
	UsagePackOutputFile   = "Path to the output IP database file (required)."
	UsagePackOutputFormat = "The format for the output IP database file."
	UsageReaderOption     = "Additional options for the database reader, if applicable."
	UsageWriterOption     = "Additional options for the database writer, if applicable."
	UsageHybridMode       = "Sets mode for multi-IP source handling; 'comparison' to compare, 'aggregation' to merge data."

	UsageTextFormat    = "Specify the desired format for text output. (default \"%origin [%values]\")"
	UsageTextValuesSep = "Specify the separator for values in text output. (default \" \")"
	UsageJson          = "Output the results in JSON format."
	UsageJsonIndent    = "Output the results in indent JSON format."
	UsageAlfred        = "Output the results in Alfred format."
)

Variables

View Source
var MagicMap = map[string]string{
	"ipv4":      "ipv4_file",
	"ipv6":      "ipv6_file",
	"ipip":      "city.free.ipdb",
	"qqwry":     "qqwry.dat",
	"zxinc":     "zxipv6wry.db",
	"maxmind":   "GeoLite2-City.mmdb",
	"ip2region": "ip2region.xdb",
	"dbip":      "dbip-city-lite.mmdb",
	"dbip-asn":  "dbip-asn-lite.mmdb",
}
View Source
var (
	Version = "(devel)"
)

Functions

func Config added in v0.1.4

func Config(cmd *cobra.Command, args []string)

func Download

func Download(cmd *cobra.Command, args []string)

func Dump added in v0.2.0

func Dump(cmd *cobra.Command, args []string)

func Execute

func Execute()

Execute is the entry point for the CLI tool. It executes the root command.

func GetConfig added in v0.2.0

func GetConfig() *ips.Config

GetConfig initializes and returns the configuration for the IP service.

func GetFlagConfig added in v0.2.0

func GetFlagConfig() *ips.Config

GetFlagConfig initializes and returns the configuration for the IP service. It loads the configuration from a file or environment variables, then overrides specific fields based on the global variables, which might be set from command-line arguments.

func MyIP added in v0.2.6

func MyIP(cmd *cobra.Command, args []string)

func Pack

func Pack(cmd *cobra.Command, args []string)

func PreRunInit added in v0.2.0

func PreRunInit(cmd *cobra.Command, args []string)

PreRunInit is called before the main Run function. It sets up logging and initializes the IP manager.

func Root

func Root(cmd *cobra.Command, args []string)

Root is the main logic for the IP query command. It also supports pipeline queries.

func ScanLines added in v0.3.0

func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error)

ScanLines scan lines but keep the suffix \r and \n

func Server added in v0.2.5

func Server(cmd *cobra.Command, args []string)

func SetConfig added in v0.2.0

func SetConfig(key string, value []string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL