A Golang API over MaxMind ASN database
- The API server requires a pre-built database in
data/asn.db
- The API server listens on
0.0.0.0:8000
by default (Customize withHOST
andPORT
environment variable) - Building database requires MaxMind ASN CSV
docker run -p 8000:8000 abh1sek/asn-search-api
curl -s http://localhost:8000/domain/example.com
curl -s http://localhost:8000/org/example+technologies
OrgName
should be URL Encoded
Ensure go tool chain is setup correctly
make
- Download MaxMind ASN Database in CSV Format
- Use
asn-search-api
tool to create indexed database
./asn-search-api -mode mkdb \
-db data/asn.db \
-type ipv4 \
-file GeoLite2-ASN-CSV_20190101/GeoLite2-ASN-Blocks-IPv4.csv
./asn-search-api -mode mkdb \
-db data/asn.db \
-type ipv6 \
-file GeoLite2-ASN-CSV_20190101/GeoLite2-ASN-Blocks-IPv6.csv
gcloud run deploy \
asn-search-api \
--platform=managed \
--image=gcr.io/<projectName>/asn-search-api:latest \
--memory=512Mi \
--timeout=30s \
--labels=app=asn-search-api \
--allow-unauthenticated \
--region=us-central1
- Extract ASN DB ops from
main.go
and create its own package - Test cases