geoip

package
v0.0.0-...-9beddec Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// GeoIP Database下载地址
	DownloadPath = "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz"
	// 数据库文件名
	DatabaseName = "GeoLite2-City.mmdb"
)

Variables

This section is empty.

Functions

func GetCountryCity

func GetCountryCity(ip string, lang string) (string, string, error)

GetCountryCity 返回ip的国家/地区和城市名称 lang为语言名称,e.g. "zh-CN", "en"

func GetCountryISOCode

func GetCountryISOCode(ip string) (string, error)

GetCountryISOCode 获取国家代码

func GetGeoIPSavePath

func GetGeoIPSavePath() (string, error)

GetGeoIPSavePath 返回完整的数据库路径,默认在$HOME/.local/share/data/schannel-qt5/GeoIP下

func IsGeoIPOutdated

func IsGeoIPOutdated(expires time.Duration) bool

IsGeoIPOutdated 判断数据库文件是否过期 文件不存在时也会返回true

Types

This section is empty.

Jump to

Keyboard shortcuts

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