Skip to main content

A pure Python implementation of WireGuard

Project description

Python WireGuard

Tests PyPI Downloads

A pure python implementation of the WireGuard protocol.

Table of contents

Motivation

Existing Python libraries for WireGuard rely on the system daemon, which limits flexibility, requires root access, and causes global network changes. A user-mode implementation avoids these issues, making setup easier and safer for isolated use cases. It also enables custom packet injection (IPv4/IPv6) without raw sockets, making it useful for things like anonymous SYN scans (given proper spoofing), dynamic IP hopping for scraping, or building VPN-like tools without system-wide impact. And finally, because why not? It's a fun project to learn about the WireGuard protocol and networking in general.

Performance

One major drawback of this implementation is its speed. While rewriting it in a faster language like C++ with Python bindings could solve this, it would also add significant complexity. For now, the focus is on optimizing the existing Python code as much as possible.

Usage

For usage examples please refer to the examples directory. The examples demonstrate how to use the library to create WireGuard peers, encode packets, send packets, and manage inbound packets.

A documentation will be added in the future, but for now, the examples should provide enough information to get started.

Testing and troubleshooting

If you encounter any issues while using the library run the test suite to check if any tests are failing. The tests can be run by using python run_tests.py in the root directory of the project. If anything fails or doesn't work properly please feel free to open an issue on the repository with the details of the issue and the output of the tests.

References

The following references were used while building this project:

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

wireguard_protocol-0.0.7.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

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

wireguard_protocol-0.0.7-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file wireguard_protocol-0.0.7.tar.gz.

File metadata

  • Download URL: wireguard_protocol-0.0.7.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for wireguard_protocol-0.0.7.tar.gz
Algorithm Hash digest
SHA256 c0edcdb63aa0b805c9bf5b7ae573fdc267d0d23e7be9f1a495d8322203ba8254
MD5 2697b888639ea8fba448f80550d751d1
BLAKE2b-256 337266728ee538aed850aeb66d0399e1229376af475ebcbf01ff64115bc62661

See more details on using hashes here.

File details

Details for the file wireguard_protocol-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for wireguard_protocol-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c8464e17d9e34c5dee1890a84f61e328f8481fe563b07932468ee104ff796157
MD5 91a92223c980fb75dc58ec0dee2e66e5
BLAKE2b-256 9746199a432810cd6c701578dac9fa97528fecafdb377132e0eb20875a138f3a

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