db

package
v0.1.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// FormatIPDB IPDB格式
	// Official: https://www.ipip.net/
	FormatIPDB = "ipdb"

	// FormatAWDB AWDB格式
	// Official: https://www.ipplus360.com/
	FormatAWDB = "awdb"

	// FormatMMDB MMDB格式
	// Official: https://www.maxmind.com/
	FormatMMDB = "mmdb"

	// FormatQQWry QQWry格式
	// Official: https://www.cz88.net/
	FormatQQWry = "qqwry"

	// FormatZXInc ZXInc格式
	// Official: https://ip.zxinc.org/
	FormatZXInc = "zxinc"

	// FormatIP2Region (v2)
	// Official: https://github.com/lionsoul2014/ip2region
	FormatIP2Region = "ip2region"
)
View Source
const (
	// FormatSep 格式分隔符
	FormatSep = ":"
)

Variables

View Source
var (
	// Formats 支持的数据格式
	Formats = map[string]func(string) (Database, error){}

	// Exts 支持的文件扩展名
	Exts = map[string]func(string) (Database, error){}

	// CommonNames 支持的常用文件名称
	CommonNames = map[string]func(string) (Database, error){}
)

Functions

This section is empty.

Types

type Database

type Database interface {

	// Meta 返回元数据
	Meta() model.Meta

	// Find 查询 IP 对应的网段和结果
	Find(ip net.IP) (*ipx.Range, map[string]string, error)

	// Close 关闭数据库实例
	Close() error
}

Database IP 数据库

func NewDatabase

func NewDatabase(format, file string) (Database, error)

NewDatabase 初始化 IP 数据库

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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