Parsing and writing WireGuard configuration files (comment preserving)
WireGuard config files are ini-style. Since all "Peer" sections have the same name, these files cannot be parsed and modified by most libraries handling configuration files. Most existing libraries are not able to preserve or even add comments when modifying a config file. "wgconfig" was created to work with WireGuard configuration files and to preserve comments.
- Read and parse WireGuard configuration files and make the data available as Python dictionaries.
- Create new WireGuard configuration files.
- Add peers to WireGuard configuration files and delete peers from WireGuard configuration files.
- Save and clone WireGuard configuration files.
- Comments are preserved when reading and writing WireGuard configuration files.
- Leading comments may be added when creating sections or attributes.
- Such comments may be deleted when removing sections or attributes.
- No other libraries are needed, i.e. no dependencies.
Requires .NET 9.0.
Install using .NET CLI:
dotnet add package WgConfig --version 1.0.0