geoip

package
v0.0.0-...-ce25bc5 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

borrowed from https://github.com/d4l3k/go-sct/blob/master/geoip/geoip.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAPI

func RegisterAPI(r chi.Router)

RegisterAPI add a GET route to request GeoIP

Types

type GeoIP

type GeoIP struct {
	// The right side is the name of the JSON variable
	IP          string  `json:"ip"`
	CountryCode string  `json:"country_code"`
	CountryName string  `json:"country_name"`
	RegionCode  string  `json:"region_code"`
	RegionName  string  `json:"region_name"`
	City        string  `json:"city"`
	Zipcode     string  `json:"zipcode"`
	Latitude    float64 `json:"latitude"`
	Longitude   float64 `json:"longitude"`
	MetroCode   int     `json:"metro_code"`
	AreaCode    int     `json:"area_code"`
}

GeoIP payload.

func LookupIP

func LookupIP(address string) (*GeoIP, error)

LookupIP looks up the geolocation information for the specified address ("" for current host).

Jump to

Keyboard shortcuts

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