geo

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IpAPITagKey = "ipapi"
)

Variables

This section is empty.

Functions

func SetHTTPClientTimeout

func SetHTTPClientTimeout(clientTimeout time.Duration)

Types

type FreeGeoIPApp

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

func NewFreeGeoIPApp

func NewFreeGeoIPApp(ip string) *FreeGeoIPApp

func (*FreeGeoIPApp) Get

func (f *FreeGeoIPApp) Get() (Geo, error)

type Geo

type Geo struct {
	IP          string  `json:"ip" ipapi:"query"`
	CountryCode string  `json:"country_code" ipapi:"countryCode"`
	CountryName string  `json:"country_name" ipapi:"country"`
	RegionCode  string  `json:"region_code" ipapi:"region"`
	RegionName  string  `json:"region_name" ipapi:"regionName"`
	City        string  `json:"city" ipapi:"city"`
	ZipCode     string  `json:"zip_code" ipapi:"zip"`
	Timezone    string  `json:"time_zone" ipapi:"timezone"`
	Latitude    float64 `json:"latitude" ipapi:"lat"`
	Longitude   float64 `json:"longitude" ipapi:"lon"`
	MetroCode   int     `json:"metro_code" ipapi:"metro"`
}

func GetBrowserLocation

func GetBrowserLocation(g GeoLocation) Geo

type GeoLocation

type GeoLocation interface {
	Get() (Geo, error)
}

type IPAPI

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

func NewIPAPI

func NewIPAPI(ip string) *IPAPI

func (*IPAPI) Get

func (i *IPAPI) Get() (Geo, error)

Jump to

Keyboard shortcuts

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