Check whether an IP address belongs to a cloud provider
Project description
RadixTarget
RadixTarget is a performant radix implementation designed for quick lookups of IP addresses/networks and DNS hostnames.
RadixTarget is:
- Written in pure python
- Capable of ~100,000 lookups per second regardless of database size
- 100% test coverage
- Used by:
- BBOT
- cloudcheck Written in pure python and capable of roughly 100,000 lookups per second regardless of database size, it's perfect for production .
Installation (PyPi)
pip install radixtarget
Example Usage
from radixtarget import RadixTarget
rt = RadixTarget()
# IPv4
rt.add("192.168.1.0/24")
rt.get("192.168.1.10") # IPv4Network("192.168.1.0/24")
rt.get("192.168.2.10") # None
# IPv6
rt.add("dead::/64")
rt.get("dead::beef") # IPv6Network("dead::/64")
rt.get("dead:cafe::beef") # None
# DNS
rt.add("net")
rt.add("www.example.com")
rt.add("test.www.example.com")
rt.get("net") # "net"
rt.get("evilcorp.net") # "net"
rt.get("www.example.com") # "www.example.com"
rt.get("asdf.test.www.example.com") # "test.www.example.com"
rt.get("example.com") # None
# Custom data nodes
rt.add("evilcorp.co.uk", "custom_data")
rt.get("www.evilcorp.co.uk") # "custom_data"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
radixtarget-2.0.0.36.tar.gz
(103.7 kB
view details)
Built Distribution
File details
Details for the file radixtarget-2.0.0.36.tar.gz
.
File metadata
- Download URL: radixtarget-2.0.0.36.tar.gz
- Upload date:
- Size: 103.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34ce1d8da466495bf7b3400ab195b336ba16a4395dafb51e07235fc273c698cf |
|
MD5 | f8bf995ae8bc3b672be58f9d6d923c01 |
|
BLAKE2b-256 | 086e8c24711d25802ba9215e7a2cbff0e53cb56e3bd8ce474df41e4d07927bb0 |
File details
Details for the file radixtarget-2.0.0.36-py3-none-any.whl
.
File metadata
- Download URL: radixtarget-2.0.0.36-py3-none-any.whl
- Upload date:
- Size: 104.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e9377e12c576dec0d5edaba327d168820b29e23ca7f76991c27e520e753c3a9 |
|
MD5 | a000f0a9611d2dee13f6fa3c9eeb13d1 |
|
BLAKE2b-256 | 51e57ee084355f61d9f1857ba2e955e3f48958509cd12030c25664c27bb642e9 |