geolite

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 6 Imported by: 0

README

GEOIP2(GeoLite2)

GeoLite2数据库是免费的IP地理位置数据库,它可以通过IP地址识别其所在的城市和国家。与MaxMind的GeoIP2数据库相比,准确性较差。

GeoLite2-*.mmdb文件是一个二进制数据库文件,包含了MaxMind GeoLite2所需的全部数据。

GeoLite2的数据库分为:国家(Country),城市(City)和ASN三个数据库。每周两次更新。

数据库下载地址

  1. https://github.com/P3TERX/GeoLite.mmdb/releases
  2. https://dev.maxmind.com/geoip/geolite2-free-geolocation-data

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client 地理位置解析结构体

func NewClient

func NewClient() (*Client, error)

NewClient .

func (*Client) Close

func (g *Client) Close() error

Close 关闭客户端

func (*Client) Query

func (g *Client) Query(rawIP string) (ret geoip.Result, err error)

Query 通过IP获取地区

func (*Client) SetLanguage

func (g *Client) SetLanguage(code string)

SetLanguage 设置输出的语言,默认为:zh-CN

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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