A Rust-based command-line tool to check if IP addresses belong to various CDN (Content Delivery Network) providers.
Features
- Checks IP addresses against multiple CDN provider IP ranges
- Automatically downloads and caches provider IP lists
- Updates provider data monthly
- Supports both individual IP addresses and CIDR ranges
- Fast lookup using efficient IP range matching
cargo build --release- Configuration: Creates
~/.config/cdn-lookup/directory if it doesn't exist - Provider List: Downloads
providers.conffrom the repository if not present locally - Data Updates: Checks for updates monthly using HTTP HEAD requests
- IP Range Processing: Downloads and processes IP lists from providers, extracting CIDR ranges and individual IPs
- Lookup: Efficiently matches input IP addresses against cached CIDR ranges
- Output: Reports which CDN providers (if any) contain the queried IP addresses
The providers.conf file contains CDN provider definitions in the format:
provider_name|url|last_response_timestamp|last_checked_timestamp
Example:
fastly|https://api.fastly.com/public-ip-list|0|0
cloudflare|https://raw.githubusercontent.com/lord-alfred/ipranges/refs/heads/main/cloudflare/ipv4.txt|0|0
The tool supports checking against many CDN providers including:
- Fastly
- Cloudflare
- Amazon CloudFront
- Microsoft
- DigitalOcean
- Oracle
- And many more...
Check multiple IP addresses:
$ cdn-lookup 8.8.8.8 1.1.1.1 104.16.123.96Check IP addresses from a list (space or newline separated):
echo "8.8.8.8 1.1.1.1" | xargs cdn-lookup$ cdn-lookup 8.8.8.8 104.16.123.96 192.168.1.1
8.8.8.8: Found in google
104.16.123.96: Found in cloudflare
192.168.1.1: -