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:
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.44.tar.gz
(103.7 kB
view details)
Built Distribution
File details
Details for the file radixtarget-2.0.0.44.tar.gz
.
File metadata
- Download URL: radixtarget-2.0.0.44.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 | 16240053d0e566d3766665d7a2914403d0d4b5fa77b4c1482271e1c08482785b |
|
MD5 | f986450e817c0b5aa088b57233917864 |
|
BLAKE2b-256 | de61d988dc09a8b5adcfc90ad5495a17bd671a257fd475cacb47cda632a9010d |
File details
Details for the file radixtarget-2.0.0.44-py3-none-any.whl
.
File metadata
- Download URL: radixtarget-2.0.0.44-py3-none-any.whl
- Upload date:
- Size: 104.3 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 | e4dd28ffe4af91bf082aab00a7fec3766dc053b10f82a1ebc4d95af6e5003510 |
|
MD5 | cb047aa92d3f8d0fa558a2da7b8b99e6 |
|
BLAKE2b-256 | d6e447573c25d02749465ae45b676fab9bacd90e567a115c91bbf7505c7d9653 |