ip_api_local

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FastCacheCache = fastcache.New(32000000)

Functions

func AddLocation

func AddLocation(query string, location ip_api.Location, expirationDuration time.Duration) (bool, error)

AddLocation - adds a query + location to cache map along with an expiration time query - IP/DNS value location - ip_api location expirationDuration - duration in which the query will expire (go stale)

func GetLocation

func GetLocation(query string, fields string) (*ip_api.Location, bool, error)

GetLocation - function for getting the location of a query from cache query - IP/DNS entry fields - string of comma separated values returns ip_api Location error

func ReadCache

func ReadCache(writeLocation *string)

ReadCache - reads the cache file from disk and loads it into the Cache map writeLocation - string containing the file path.

func WriteCache

func WriteCache(writeLocation *string)

WriteCache - writes the cache to a file on disk to be read on app restarts writeLocation - string containing the write path

Types

type Record

type Record struct {
	ExpirationTime time.Time       `json:"expirationTime"`
	Location       ip_api.Location `json:"location"`
}

Jump to

Keyboard shortcuts

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