geoip

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LangEnglish = "en"
	LangChinese = "zh-CN"
)

Supported language codes

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	City      string  `json:"city"`
	CityEN    string  `json:"city_en"`   // English name for localization
	Subdiv    string  `json:"subdiv"`    // Province/State
	SubdivEN  string  `json:"subdiv_en"` // English subdivision
	Country   string  `json:"country"`
	CountryEN string  `json:"country_en"` // English country
	ISOCode   string  `json:"iso_code"`
	ISP       string  `json:"isp"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Precision string  `json:"precision"` // "city", "subdivision", "country", "none"
}

type Provider

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

func NewProvider

func NewProvider(cityDBPath, ispDBPath string) (*Provider, error)

func (*Provider) Close

func (p *Provider) Close()

func (*Provider) Lookup

func (p *Provider) Lookup(ipStr string) (*Location, error)

Lookup returns location data with both Chinese and English names The primary fields (City, Subdiv, Country) use Chinese if available, else English The *EN fields always contain English names for API consumers to choose

Jump to

Keyboard shortcuts

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