geoip

package
v0.0.0-...-8eda056 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryCountry

func QueryCountry(ip uint32) string

func QueryCountryByIP

func QueryCountryByIP(ip net.IP) string

func QueryCountryByString

func QueryCountryByString(v string) string

func UpdateDB

func UpdateDB()

Types

type GeoLite2Country

type GeoLite2Country struct {
	Continent struct {
		Code      string `json:"code" yaml:"code" mapstructure:"code"`
		GeonameID int64  `json:"geoname_id" yaml:"geoname_id" mapstructure:"geoname_id"`
		Names     struct {
			De    string `json:"de" yaml:"de" mapstructure:"de"`
			En    string `json:"en" yaml:"en" mapstructure:"en"`
			Es    string `json:"es" yaml:"es" mapstructure:"es"`
			Fr    string `json:"fr" yaml:"fr" mapstructure:"fr"`
			Ja    string `json:"ja" yaml:"ja" mapstructure:"ja"`
			Pt_BR string `json:"pt-BR" yaml:"pt-BR" mapstructure:"pt-BR"`
			Ru    string `json:"ru" yaml:"ru" mapstructure:"ru"`
			Zh_CN string `json:"zh-CN" yaml:"zh-CN" mapstructure:"zh-CN"`
		} `json:"names" yaml:"names" mapstructure:"names"`
	} `json:"continent" yaml:"continent" mapstructure:"continent"`
	Country struct {
		GeonameID int64  `json:"geoname_id" yaml:"geoname_id" mapstructure:"geoname_id"`
		IsoCode   string `json:"iso_code" yaml:"iso_code" mapstructure:"iso_code"`
		Names     struct {
			De    string `json:"de" yaml:"de" mapstructure:"de"`
			En    string `json:"en" yaml:"en" mapstructure:"en"`
			Es    string `json:"es" yaml:"es" mapstructure:"es"`
			Fr    string `json:"fr" yaml:"fr" mapstructure:"fr"`
			Ja    string `json:"ja" yaml:"ja" mapstructure:"ja"`
			Pt_BR string `json:"pt-BR" yaml:"pt-BR" mapstructure:"pt-BR"`
			Ru    string `json:"ru" yaml:"ru" mapstructure:"ru"`
			Zh_CN string `json:"zh-CN" yaml:"zh-CN" mapstructure:"zh-CN"`
		} `json:"names" yaml:"names" mapstructure:"names"`
	} `json:"country" yaml:"country" mapstructure:"country"`
	RegisteredCountry struct {
		GeonameID         int64  `json:"geoname_id" yaml:"geoname_id" mapstructure:"geoname_id"`
		IsInEuropeanUnion bool   `json:"is_in_european_union" yaml:"is_in_european_union" mapstructure:"is_in_european_union"`
		IsoCode           string `json:"iso_code" yaml:"iso_code" mapstructure:"iso_code"`
		Names             struct {
			De    string `json:"de" yaml:"de" mapstructure:"de"`
			En    string `json:"en" yaml:"en" mapstructure:"en"`
			Es    string `json:"es" yaml:"es" mapstructure:"es"`
			Fr    string `json:"fr" yaml:"fr" mapstructure:"fr"`
			Ja    string `json:"ja" yaml:"ja" mapstructure:"ja"`
			Pt_BR string `json:"pt-BR" yaml:"pt-BR" mapstructure:"pt-BR"`
			Ru    string `json:"ru" yaml:"ru" mapstructure:"ru"`
			Zh_CN string `json:"zh-CN" yaml:"zh-CN" mapstructure:"zh-CN"`
		} `json:"names" yaml:"names" mapstructure:"names"`
	} `json:"registered_country" yaml:"registered_country" mapstructure:"registered_country"`
	RepresentedCountry struct {
		GeonameID int64  `json:"geoname_id" yaml:"geoname_id" mapstructure:"geoname_id"`
		IsoCode   string `json:"iso_code" yaml:"iso_code" mapstructure:"iso_code"`
		Names     struct {
			De    string `json:"de" yaml:"de" mapstructure:"de"`
			En    string `json:"en" yaml:"en" mapstructure:"en"`
			Es    string `json:"es" yaml:"es" mapstructure:"es"`
			Fr    string `json:"fr" yaml:"fr" mapstructure:"fr"`
			Ja    string `json:"ja" yaml:"ja" mapstructure:"ja"`
			Pt_BR string `json:"pt-BR" yaml:"pt-BR" mapstructure:"pt-BR"`
			Ru    string `json:"ru" yaml:"ru" mapstructure:"ru"`
			Zh_CN string `json:"zh-CN" yaml:"zh-CN" mapstructure:"zh-CN"`
		} `json:"names" yaml:"names" mapstructure:"names"`
		Type string `json:"type" yaml:"type" mapstructure:"type"`
	} `json:"represented_country" yaml:"represented_country" mapstructure:"represented_country"`
}

func QueryConuntryByIPDetails

func QueryConuntryByIPDetails(ip net.IP) GeoLite2Country

Jump to

Keyboard shortcuts

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