Skip to main content
TUN/TAP package for Linux and Windows
================================

``pytuntap`` is a Python module for you create TUN/TAP device very easily.
It canbe work both on Linux and Windows

License: MIT (see LICENSE)

Installation and Dependencies
-----------------------------

Install ``pytuntap`` with ``pip install python-pytuntap``

As ``pytuntap`` is python wrapper for tuntap driver on Linux , and openvpn driver on
Windows. If you use it on windows, you should install openvpn's tap driver first.
please refer to openvpn ,how to install it .

Documentation
-------------

NOTE: On most distributions you will need to be root to create TUN/TAP devices.

To create a TUN device::

from tuntap import TunTap

tun = TunTap(nic_type="Tun",nic_name="tun0")

To create a TAP device::

聽 from tuntap import TunTap

tap = TunTap(nic_type="Tap",nic_name="tap0")

To config device:

tap.config(ip="192.168.1.10",mask="255.255.255.0",gateway="192.168.1.254")

You can get some parameters of the device directly::

print(tun.name,tun.ip,tun.mask)

If the device is a TAP you can also get/set its MAC address::

print(tap.mac)

To read/write to the device, use the methods ``read(size)`` and
``write(buf)``::

buf = tun.read(size)
tun.write(buf)

To close the device::

tun.close()

you can also use ``TunTapDevice`` objects with all functions that expect a
``tun.handle`` method (e.g ``select()``)

Metadata

Release files for python-pytuntap 1.0.5

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

Source distribution (sdist)

Source distribution for python-pytuntap 1.0.5
File Size Uploaded Provenance
python-pytuntap-1.0.5.tar.gz 6.6 kB Without provenance Details

Release files / python-pytuntap-1.0.5.tar.gz

Download URL python-pytuntap-1.0.5.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cfb7ea426bb07169192d598e3b1581523aa1982a69bfb3dc29cfff64a3ec86ff
BLAKE2b-256 checksum
How to use checksums
3bceaa916a946cba833fb486143acc5515719c8729af46cea939639d9cc8bf76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for python-pytuntap 1.0.5

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.

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