geo

package
v0.0.0-...-a97d171 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidIP = errors.New("invalid ip")
)

Functions

func GetFirstIP

func GetFirstIP(ip string) string

Types

type Record

type Record struct {
	City struct {
		Names map[string]string `maxminddb:"names"`
	} `maxminddb:"city"`
	Continent struct {
		Code  string            `maxminddb:"code"`
		Names map[string]string `maxminddb:"names"`
	} `maxminddb:"continent"`
	Country struct {
		ISOCode           string            `maxminddb:"iso_code"`
		Names             map[string]string `maxminddb:"names"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union"`
	} `maxminddb:"country"`
}

More fields available @ https://github.com/oschwald/geoip2-golang/blob/master/reader.go#L85 Only using what we need is faster

func GetLocation

func GetLocation(ipIn string) (record *Record, err error)

Jump to

Keyboard shortcuts

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