Skip to main content

Tundra-NAT64 external address translation library for Python

Project description

tundra-xaxlib-python

tundra-xaxlib-python, or Tundra-NAT64 external address translation library for Python, enables one to easily parse and constructs wireformat messages used by Tundra-NAT64 external address translation protocol (specification) in Python programs. Although this library will probably be most commonly used to implement servers, it is also able to construct request messages and parse response messages, which are actions that only the client, i.e. Tundra-NAT64, needs to perform.

NOTE: Some links in this README may not work if the file is not viewed through GitHub.

Installation

This library targets Python 3.9 and above. It might work in older Python 3 versions, but nothing is guaranteed.

tundra-xaxlib-python may be installed from PyPI using pip:

python3 -m pip install --upgrade tundra-xaxlib-python

Usage

Classes and variables try to reflect the protocol specification as closely as possible in terms of both names and functionality, so I would recommend to start there.

This library's central (data)classes are RequestMessage, SuccessfulResponseMessage and ErroneousResponseMessage. Each of them can be instantiated the usual way, or by using the from_wireformat() classmethod for parsing wireformat. The instances then have the to_wireformat() method for constructing wireformat. The RequestMessage class has additional methods for constructing response message objects which use existing data from the request: generate_successful_response() and generate_erroneous_response(). Methods which have it documented in their docstrings raise InvalidMessageDataExc (or a subclass thereof) in case an error occurs. If you, for some reason, needed to detect the appropriate message class from wireformat or instantiate it straightaway, the WireformatParsingHelpers class is there to help with that.

Examples

  • 001_nat64.py – An example external address translation server which works almost exactly the same as Tundra-NAT64's built-in nat64 addressing mode, i.e. it is able to, without the help of a NAT66, statelessly translate packets from one source IPv6 to one source IPv4 and do the inverse process for packets going the other way.

Licensing

This project is licensed under the 3-clause BSD license – see the LICENSE file.

Programmed by Vít Labuda.

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

tundra-xaxlib-python-1.0.2.tar.gz (10.7 kB view hashes)

Uploaded Source

Supported by

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