ipRegionKit

package
v3.0.35 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotSetupError = errorKit.Newf("haven’t been set up correctly")

Functions

func GetRegion

func GetRegion(ip string) (string, error)

GetRegion

PS: (1) 需要先加载 ip2region.xdb (2) 此函数可以安全用于并发 (3) IP地址查询 - 在线工具(可以查看本机的外网ip): https://tool.lu/ip/

@return 第1个返回值的格式: 国家|区域|省份|城市|ISP

e.g. ("1.1.1.1") => ("澳大利亚|0|0|0|0", nil) ("1.2.3.4") => ("美国|0|华盛顿|0|谷歌", nil) ("10.0.9.141") => ("0|0|0|内网IP|内网IP", nil) ("218.90.174.146") => ("中国|0|江苏省|无锡市|电信", nil)

func MustSetUp

func MustSetUp(xdbPath string)

func SetUp

func SetUp(xdbPath string) (err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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