Skip to content
WireGuard + Netlink + Python
Python
Branch: master
Clone or download
Latest commit b3de871 Aug 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
wgnlpy
.gitignore
LICENSE
MANIFEST.in
README.md
example.py
setup.py

README.md

wgnlpy

Python netlink connector to WireGuard

A simple control interface for WireGuard via Netlink, written in Python.

from wgnlpy import WireGuard

interface = "wg0"
peer = b'...'

wg = WireGuard()

wg.set_peer(interface, peer,
	endpoint="203.0.113.0:51820",
	allowedips=["2001:db8::/32"],
	)
assert peer in wg.get_interface(interface).peers

wg.remove_peers(interface, peer)
assert peer not in wg.get_interface(interface).peers

Requires pyroute2.

Also useful: the sockaddr_in and sockaddr_in6 utility classes for sockaddr manipulation.

License: MIT

You can’t perform that action at this time.