service

package
v0.0.0-...-f6e9d91 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2017 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadMaxmindDB

func LoadMaxmindDB(path string)

LoadMaxmindDB loads a MaxMind DB into memory for use by the /lookup endpoint.

func UnloadMaxmindDB

func UnloadMaxmindDB()

UnloadMaxmindDB unloads the MaxMind DB from memory. This is just for testing.

Types

type Location

type Location struct {
	Lat float64 `json:"lat"`
	Lon float64 `json:"lon"`
}

type LookupResponse

type LookupResponse struct {
	CountryCode   string   `json:"country_code"`
	Country       string   `json:"country"`
	RegionCode    *string  `json:"region_code"`
	City          string   `json:"city"`
	ContinentCode string   `json:"continent_code"`
	Continent     string   `json:"continent"`
	Location      Location `json:"location"`
}

Response is a struct that holds the data for the JSON HTTP response body.

func LookupIP

func LookupIP(ip string) (*LookupResponse, error)

LookupIP looks up the specified IP in the loaded Maxmind DB

type MultiLookupResponse

type MultiLookupResponse map[string]interface{}

func MultiLookupIP

func MultiLookupIP(ips []string) (*MultiLookupResponse, error)

Jump to

Keyboard shortcuts

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