Manage Wireguard configuration files
Project description
wg_conf
Python library to read, edit, and save Wireguard configuration files
Installation
Install using pip:
python3 -m pip install wg-conf
Methods
Load a configuration file:
import wg_conf
wc = wg_conf.WireguardConfig('/etc/wireguard/wg0.conf')
Write a configuration file to disk:
wc.write_file()
Edit the interface
Add an attribute to the interface
wc.add_interface_attr('AttributeKey', 'AttributeValue')
add_interface_attr will not overwrite an existing attribute. If you are sure you want to overwrite an existing attribute, use set_interface_attr with the same parameters. Otherwise, an Exception will be thrown if you try to overwrite an existing attribute
Remove an attribute from the interface
wc.del_interface_attr('AttributeKey')
If no matching attribute is found, no change will be made
Edit a peer
Add an attribute to a peer
wc.add_peer_attr('PeerPublicKey', 'AttributeKey', 'AttributeValue')
add_peer_attr will not overwrite an existing attribute. If you are sure you want to overwrite an existing attribute, use set_peer_attr with the same parameters. Otherwise, an Exception will be thrown if you try to overwrite an existing attribute
Remove an attribute from a peer
wc.del_interface_attr('PeerPublicKey', 'AttributeKey')
If no matching peer or attribute is found, no change will be made
Create or remove a peer
Create a peer given a public key:
wc.create_peer('PeerPublicKey')
You can now use add_peer_attr to configure the peer as you wish
Delete a peer given a public key:
wc.del_peer('PeerPublicKey')
Build pypi package
Build a binary and source distribution for pypi
python3 setup.py sdist bdist_wheel
Push to pypi
python3 -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wg_conf-1.0.0.tar.gz.
File metadata
- Download URL: wg_conf-1.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4befee7a1f7820b8883fd675b98cd725fe9bb0f4d0d410696975467b9038e3c4
|
|
| MD5 |
efe5e72ef8c6829c25a634571b134fb5
|
|
| BLAKE2b-256 |
96535f858df8a84e26985167b07ed7e2d81908b319294398d86eb9bf6fd8f8bd
|
File details
Details for the file wg_conf-1.0.0-py3-none-any.whl.
File metadata
- Download URL: wg_conf-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f85291d55f5f80c997b004ecf424b1063fcb358c698ac4121c9eb7c6f3f61d39
|
|
| MD5 |
d5a08997ce6828fedd1f113227a7b66d
|
|
| BLAKE2b-256 |
02aa74300a5202a40ec1a8a8d2fcfe864b5ce49312bcd2fbb918b83861781fdf
|