Skip to main content

Library for finding best route in the routing table

Implementation of trie-tree best route finding algorithm.

It is actually a bindings wrapper for the Rust library.

Usage

See .pyi stub file (also included in the package) for detailed information.

The information from the stub file should be visible in your IDE hints as well as shown by "Go to Definition" IDE action.

Example

from ipaddress import IPv4Address

from best_route_finder import IPv4RoutingTableTree

table = IPv4RoutingTableTree()
table.insert(int(IPv4Address('192.168.1.0')), 24, 'ens192')
table.insert_by_string('10.0.0.0/8', 'ens10')

assert 'ens192' == table.search_by_string('192.168.1.123')
assert 'ens10' == table.search(int(IPv4Address('10.1.1.43')))

Creating form the list

The IPv4RoutingTableTree also provides an option to create a routing table by passing a list of entries.

class IPv4RoutingTableTree:
    (...)
    def from_mapping(entries: list[__RoutingTableEntry]) -> 'IPv4RoutingTableTree': ...

The entries have to implement interface compatible with:

@dataclass
class __RoutingTableEntry:
    """
    Interface for a class representing single routing table entry

    User shall provide own implementation of this interface
    """
    subnet: IPv4Network  #: a subnet part of an entry
    interface: str  #: next-hop interface name associated with the subnet

In low-level terms they have to be objects that will have proper attributes set, so the following code will not raise an error:

assert isinstance(entry.subnet.network_address._ip, int)
assert isinstance(entry.subnet.prefixlen, int)
assert isinstance(entry.interface, str)

Metadata

Release files for best-route-finder 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for best-route-finder 0.1.0
File Size Uploaded Provenance
best_route_finder-0.1.0.tar.gz 14.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for best-route-finder 0.1.0
File Interpreter ABI Platform
best_route_finder-0.1.0-cp39-none-win_amd64.whl CPython 3.9 none Windows x86-64 Details

Total release size: 143.1 kB

Release files / best_route_finder-0.1.0.tar.gz

Download URL best_route_finder-0.1.0.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d7da5ba44106069c8eece03ebb92c42dabdad77bdfbeb0f607278e800b821122
BLAKE2b-256 checksum
How to use checksums
9cfe1413cdc0ac2414e7f4eff6d7c26a3e3242b8d6bc3d31476160d457418121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.11.5

Release files / best_route_finder-0.1.0-cp39-none-win_amd64.whl

Download URL best_route_finder-0.1.0-cp39-none-win_amd64.whl
Size 128.6 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
3f7c64f1a69f64aaba137dd0f81466a36124ff73258c905e678195f4adda8569
BLAKE2b-256 checksum
How to use checksums
6245867f6b36295f3888c025688f7acf8b787ccb288da81ec00943181b66c7b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.11.5

Security for best-route-finder 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page