Crate wireguard_conf

Crate wireguard_conf 

Source
Expand description

Easy to use Wireguard config generator.

§Features

§Example

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());

Re-exports§

pub use ipnet;

Modules§

prelude
Re-exports of common structs.

Macros§

as_ipaddr
Get expression as std::net::IpAddr
as_ipnet
Get expression as ipnet::IpNet

Structs§

AmneziaSettingsamneziawg
AmneziaWG obfuscation values.
Interface
Struct, that represents complete configuration (contains both [Interface] and [Peer] sections).
InterfaceBuilder
Builder for Interface.
Peer
Struct, that represents [Peer] section in configuration.
PeerBuilder
Builder for Peer.
PresharedKey
Preshared key.
PrivateKey
Private key
PublicKey
Public key.
ToInterfaceOptions
Options for Peer::to_interface().

Enums§

Table
Controls the routing table to which routes are added.
WireguardError
wireguard-conf error.

Type Aliases§

WireguardResult
Result alias.