modulepackage
0.0.0-20240613125556-5ea4490bf4be
Repository: https://github.com/beave/maxmind-api-proxy.git
Documentation: pkg.go.dev
# README
maxmind-api-proxy
The "maxmind-api-proxy" is a small Golang program that acts as a "proxy" between a "client" and the Maxmind GeoIP API (https://www.maxmind.com/en/solutions/ip-geolocation-databases-api-services).
As requests are made to the "proxy", results are stored (cached) to a Redis database. The database will automatically "expire" entire "cached" entires after a specified amount of time (default: 24 hours).
The idea is to query Maxmind less, thus saving you money on queries.
Configuring the "maxmind-api-proxy"
In the "etc" directory is the "config.json" file. This holds the settings that are used by the proxy.
{ "api_key": "YOUR_PROXY_SERVICE_API_KEY", "http_listen": ":8443", "http_cert": "/etc/letsencrypt/live/YOURSITE/fullchain.pem", "http_key": "/etc/letsencrypt/live/YOURSITE/privkey.pem", "http_mode": "release", "maxmind_username":"MAXMIND_USERNAME", "maxmind_password":"MAXMIND_PASSWORD", "maxmind_url":"https://geoip.maxmind.com/geoip/v2.1/city/", "redis_host": "127.0.0.1", "redis_port": 6379, "redis_password":"YOUR_REDIS_PASSWORD", "redis_database": "0", "redis_cache_time": 24 }
Building "maxmind-api-proxy" and executing the proxy
$ go mod init maxmind-api-proxy $ go mod tidy $ go build $ ./maxmind-api-proxy etc/config.json # Running the proxy
Example query to the proxy
curl -H 'API_KEY: YOUR_PROXY_SERVICE_API_KEY' https://your.site:8444/8.8.8.8
The proxy will return either a cached or non-cached version of JSON from Maxmind.
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author