ipdb

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFile = errors.New("ipdb: invalid database file")
	ErrClosed      = errors.New("ipdb: reader is closed")
	ErrNotFound    = errors.New("ipdb: record not found")
	ErrInvalidIP   = errors.New("ipdb: invalid IP address")
	ErrNoLanguage  = errors.New("ipdb: unsupported language")
)

Functions

This section is empty.

Types

type Meta

type Meta struct {
	Build     int64          `json:"build"`
	IPVersion uint16         `json:"ip_version"`
	Languages map[string]int `json:"languages"`
	NodeCount int            `json:"node_count"`
	TotalSize int            `json:"total_size"`
	Fields    []string       `json:"fields"`
}

Meta IPDB 元数据

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader IPDB 读取器

func Open

func Open(path string) (*Reader, error)

Open 打开 IPDB 文件

func (*Reader) Close

func (r *Reader) Close() error

Close 释放资源

func (*Reader) Fields

func (r *Reader) Fields() []string

Fields 返回字段名列表

func (*Reader) Find

func (r *Reader) Find(ip, language string) ([]string, error)

Find 查询 IP 的记录

func (*Reader) Reload

func (r *Reader) Reload(path string) error

Reload 加载新文件替换当前数据

Jump to

Keyboard shortcuts

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