wireguard-conf

Crates.iowireguard-conf
lib.rswireguard-conf
version0.3.0
created_at2025-02-15 08:29:16.92929+00
updated_at2025-05-20 15:07:45.293698+00
descriptionConstruct Wireguard's interface and peer configs
homepagehttps://github.com/idkncc/wireguard-conf
repositoryhttps://github.com/idkncc/wireguard-conf
max_upload_size
id1556610
size48,692
Dmitry (Mon4ik)

documentation

README

Wireguard Conf

Easy to use library for creating wireguard configs.

Installation

Install wireguard-conf and ipnet (for parsing ip networks)

cargo add wireguard-conf ipnet

Usage

More usage examples in tests and on docs.rs

use wireguard_conf::prelude::*;
use wireguard_conf::as_ipnet;

use ipnet::Ipv4Net;

// create peer:
let peer = PeerBuilder::new()
    .add_allowed_ip(as_ipnet!("10.0.0.2/24"))
    .build();

// create interface with that peer:
let interface = InterfaceBuilder::new()
    .address(as_ipnet!("10.0.0.1/24"))
    .add_peer(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).unwrap());

Features

  • amneziawg: adds support for generating/using AmneziaWG obfuscation values.

How2Contribute

  1. Fork it, clone it
  2. Add changes
  3. Format and lint code:
    cargo fmt
    cargo clippy
    
  4. Commit changes (use Conventional commits)
    git commit -m "feat: did something"
    
  5. Create PR
  6. PROFIT
Commit count: 22

cargo fmt