Webservice for getting geolocation and ASN information from IP addresses. This service can be easily run using docker. It has been implemented using Golang Gin Gonic.
The source of the database is https://iptoasn.com/. The service has a scheduler that downloads the database every week. However, you can easily integrate any database of your liking.
This service loads the database into memory and uses binary search to get desired data. You can connect the KeyValueStore
struct to any database of your liking if you have a bigger database of GeoIp Information.
$ curl 'http://localhost:9000/geo/?ip=103.84.159.230'
{
"ip": "103.84.159.230",
"country": "BD",
"asn_number": "133168",
"asn_description": "SUOSAT-AS-AP Shahjalal University of Science and Technology"
}
Prerequisite go
$ cd geolink-go
$ go mod download
$ go build -o main main.go
$ ./main
Prerequisite docker
, docker-compose
docker-compose up