Easy to use library for creating wireguard configs.
Install wireguard-conf
cargo add wireguard-confThe best way to understand library: Quickstart!
More usage examples you can find in tests/tutorial.rs, tests folder and documentation examples on docs.rs.
use wireguard_conf::prelude::*;
use wireguard_conf::as_ipnet;
let peer = Peer::builder()
.allowed_ips([as_ipnet!("10.0.0.2/24")])
.build();
let interface = Interface::builder()
.address([as_ipnet!("10.0.0.1/24")])
.peers([peer.clone()])
.build();
// to export configs, use `println!()`, `writeln!()`, `.to_string()`, etc.
println!("Server's config:");
println!("{}\n", interface);
println!("Client's config:");
println!("{}", peer.to_interface(&interface, ToInterfaceOptions::new()).unwrap());amneziawg: adds support for generating/using AmneziaWG obfuscation values.serde: adds implementions of [serde::Serialize] and [serde::Deserialize] for all structs.
-
Fork & clone
-
Install Rust, Cargo and just.
Or start nix shell:
direnv allowor justnix develop -
Make changes
-
Format and lint code:
just fmt just lint # or fix automatically: just lint-fix -
Commit changes (use Conventional commits)
git commit -m "feat: did something" -
Send
patchesPR