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:8000by default (Customize withHOSTandPORTenvironment variable) - Building database requires MaxMind ASN CSV
docker run -p 8000:8000 abh1sek/asn-search-apicurl -s http://localhost:8000/domain/example.com
curl -s http://localhost:8000/org/example+technologies
OrgNameshould be URL Encoded
Ensure go tool chain is setup correctly
make- Download MaxMind ASN Database in CSV Format
- Use
asn-search-apitool 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.goand create its own package - Test cases