geoip

package
v3.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoIP

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

GeoIP IP 地理位置解析

func NewGeoIP

func NewGeoIP(path string) (*GeoIP, error)

NewGeoIP 加载 .ipdb 文件,返回 GeoIP 实例

func (*GeoIP) Close

func (g *GeoIP) Close() error

Close 释放数据库资源

func (*GeoIP) Lookup

func (g *GeoIP) Lookup(ip string) GeoResult

Lookup 查询 IP 的地理位置,失败返回空结果

func (*GeoIP) Reload

func (g *GeoIP) Reload(path string) error

Reload 重新加载 IP 数据库文件

type GeoResult

type GeoResult struct {
	Country     string
	Region      string
	City        string
	CountryCode string
	ISP         string
}

GeoResult 地理位置查询结果

Jump to

Keyboard shortcuts

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