This repository contains a simple quick 'n dirty mock server of the https://ip-api.com/ and https://ipbase.com/ IP geolocation API.
It is mostly used for the development and testing of geolocation-go.
geolocationmock-go
is configurable with flags:
Usage of ./geolocationmock-go:
-e2e
Enable 'e2e' mode: set fixed responses instead of random
-failure int
Failure response rate
-latency duration
Response request latency
-provider string
Provier name. Available: 'ipapi', 'ipbase' (default "ipapi")
-
-provider
(defaultipapi
). Start a mock server of the given IP geolocation API. Available values areipapi
andipbase
. -
-latency
(default0s
). Inject given latency into the server response. Examples:150ms
,2s
,1m
, ... -
-failure
(default0
). Inject given failure rate into the server response. Examples:10
for 10%,50
for 50%. -
-e2e
(defaultfalse
). If true, enable "e2e" mode where there is a fixed response for the routes/ip/1.1.1.1
,/ip/2.2.2.2
and/ip/3.3.3.3
instead of a random one for theipbase
provider.