geolocation

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	GBISO2 = "GB"
	UKISO2 = "UK"
)

Variables

This section is empty.

Functions

func Close

func Close()

func InitGeoLocation

func InitGeoLocation(cfg IP2LocationConfig) (err error)

func IsIPV4

func IsIPV4(ip string) bool

Types

type IP2LocationConfig

type IP2LocationConfig struct {
	IPV4DBBINFile string
	IPV6DBBINFile string
}

type Location

type Location struct {
	ContinentCode string  `json:",omitempty"`
	ContinentName string  `json:",omitempty"`
	CountryName   string  `json:",omitempty"`
	CountryISO2   string  `json:",omitempty"`
	CountryISO3   string  `json:",omitempty"`
	RegionName    string  `json:",omitempty"`
	RegionCode    string  `json:",omitempty"`
	City          string  `json:",omitempty"`
	ZipCode       string  `json:",omitempty"`
	Latitude      float64 `json:",omitempty"`
	Longitude     float64 `json:",omitempty"`
}

func GeoLocation

func GeoLocation(ip string) (*Location, error)

Jump to

Keyboard shortcuts

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