| Crates.io | iptoasn-webservice |
| lib.rs | iptoasn-webservice |
| version | 0.2.7 |
| created_at | 2017-04-27 20:45:08.743419+00 |
| updated_at | 2025-10-15 11:36:03.967537+00 |
| description | API server for iptoasn.com |
| homepage | https://iptoasn.com |
| repository | https://github.com/jedisct1/iptoasn-webservice |
| max_upload_size | |
| id | 12254 |
| size | 84,587 |
A high-performance HTTP API server that maps IP addresses to Autonomous System (AS) information including ASN, country code, and organization description.
This is the source code of the (previously) public API from iptoasn.com.
cargo build --release
# Default configuration (listen on 127.0.0.1:53661, refresh every 60 minutes)
./target/release/iptoasn-webservice
# Custom configuration
./target/release/iptoasn-webservice \
--listen 0.0.0.0:8080 \
--dburl https://iptoasn.com/data/ip2asn-combined.tsv.gz \
--refresh 120
--listen (-l): Address and port to bind to (default: 127.0.0.1:53661)--dburl (-u): Database URL to download from (default: https://iptoasn.com/data/ip2asn-combined.tsv.gz)--refresh (-r): Database refresh interval in minutes, 0 to disable (default: 60)/v1/as/ip/<ip address>
/v1/as/ip
curl -H'Accept: application/json' http://localhost:53661/v1/as/ip/8.8.8.8
{
"announced": true,
"as_country_code": "US",
"as_description": "GOOGLE - Google LLC",
"as_number": 15169,
"first_ip": "8.8.8.0",
"ip": "8.8.8.8",
"last_ip": "8.8.8.255"
}
curl http://localhost:53661/v1/as/ip/8.8.8.8
Returns a formatted HTML page with the IP information.
For IP addresses not found in BGP announcements:
{
"announced": false,
"ip": "127.0.0.1"
}
The service downloads and processes the IP-to-ASN mapping database from iptoasn.com, which provides comprehensive BGP routing table data updated regularly. The database is automatically cached locally and the service includes fallback mechanisms to continue operating even when the remote database is unavailable.