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. Written in pure python and capable of roughly 100,000 lookups per second regardless of the size of the database.
Used by:
Installation (PyPi)
pip install radixtarget
Example Usage
from radixtarget import RadixTarget
rt = RadixTarget()
# IPv4
rt.insert("192.168.1.0/24")
rt.search("192.168.1.10") # ipaddress.ip_network("192.168.1.0/24")
rt.search("192.168.2.10") # None
# ipv6
rt.insert("dead::/64")
rt.search("dead::beef") # ipaddress.ip_network("dead::/64")
rt.search("dead:cafe::beef") # None
# DNS
rt.insert("net")
rt.insert("www.example.com")
rt.insert("test.www.example.com")
rt.search("net") # "net"
rt.search("evilcorp.net") # "net"
rt.search("www.example.com") # "www.example.com"
rt.search("asdf.test.www.example.com") # "test.www.example.com"
rt.search("example.com") # None
# Custom data nodes
rt.insert("evilcorp.co.uk", "custom_data")
rt.search("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-1.0.0.14.tar.gz
(98.6 kB
view hashes)
Built Distribution
Close
Hashes for radixtarget-1.0.0.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f5d66e64f45dddf9088b7ff9e34dd27bf6b4074a7012227ba693a568f8e4184 |
|
MD5 | 6a2331b1abbe4f850460517dd4a69698 |
|
BLAKE2b-256 | ffb951d45af3008f0ea01b0729491dfdde2d69951b2aa039df07dbcf5564490e |