asn-search-api

command module
v0.0.0-...-a4cfb6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 14 Imported by: 0

README

ASN Search API

A Golang API over MaxMind ASN database

CircleCI

  • 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 with HOST and PORT environment variable)
  • Building database requires MaxMind ASN CSV

Getting Started

docker run -p 8000:8000 abh1sek/asn-search-api

Use

curl -s http://localhost:8000/domain/example.com
curl -s http://localhost:8000/org/example+technologies

OrgName should be URL Encoded

Build

Ensure go tool chain is setup correctly

make

Generate ASN Database

  1. Download MaxMind ASN Database in CSV Format
  2. 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 

Deploy

Google Cloud Run
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

TODO

  • Extract ASN DB ops from main.go and create its own package
  • Test cases

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL