Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCacheNotConfigured = fmt.Errorf("cache no configured")
ErrCacheNotConfigured is the error raised when the cache was not set up correctly
View Source
var ErrInvalidIPAddress = fmt.Errorf("invalid IP address provided")
ErrInvalidIPAddress is the error raised when an invalid IP address is provided
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.3.0
type Config struct { RedisOptions *redis.Options IPAddress string Token string Radius float64 CacheTTL time.Duration AllowPrivateIPAddresses bool }
Config holds the user configuration to setup a new geofence
type Geofence ¶
type Geofence struct { Config Latitude float64 Longitude float64 // contains filtered or unexported fields }
Geofence holds a ipbase.com client, redis client, in-memory cache and user supplied config
func New ¶
New creates a new geofence for the IP address specified. Use "" as the ip address to geofence the machine your application is running on Token comes from https://ipbase.com/
type IPBaseError ¶ added in v0.6.0
type IPBaseError struct {
Message string `json:"message"`
}
IPBaseError is the json response when there is an error from ipbase.com
func (*IPBaseError) Error ¶ added in v0.6.0
func (e *IPBaseError) Error() string
Click to show internal directories.
Click to hide internal directories.