Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidIPAddress = errors.New("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 *cache.RedisOptions
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 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.