Skip to main content

Check whether an IP address belongs to a cloud provider

Project description

RadixTarget

Python Version License Black Tests Codecov

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


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.15.tar.gz (98.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

radixtarget-1.0.0.15-py3-none-any.whl (98.7 kB view details)

Uploaded Python 3

File details

Details for the file radixtarget-1.0.0.15.tar.gz.

File metadata

  • Download URL: radixtarget-1.0.0.15.tar.gz
  • Upload date:
  • Size: 98.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.19

File hashes

Hashes for radixtarget-1.0.0.15.tar.gz
Algorithm Hash digest
SHA256 c8294ebbb76e6d2826deaa8fe18d568308eddfd25f20644e166c492d2626a70c
MD5 ac4f46b20ff9cfe150bb3c7c60853802
BLAKE2b-256 85abf1b7939f4e745793e65315bb2c3b2f0434cf6544aaa60fb34e849a302011

See more details on using hashes here.

File details

Details for the file radixtarget-1.0.0.15-py3-none-any.whl.

File metadata

  • Download URL: radixtarget-1.0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 98.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.19

File hashes

Hashes for radixtarget-1.0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 4e3f0620bfbc0ef2ff3d71270dd281c0e8428906d260f737f82b573a7b636dd8
MD5 e154a489e78a4ee0808f50735423144f
BLAKE2b-256 1a2fd2607525763c2c60374252fd0b87b52300db4e7ef2ef6c0e1088f8c70583

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page