Skip to content

allocatedribble/wiretun

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

104 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WireTun

github crates.io docs.rs build status dependency status

This library provides a cross-platform, asynchronous (with Tokio) WireGuard implementation.

WARNING: This library is still in early development and is not ready for production use.

[dependencies]
wiretun = { version = "*" }

Example

use wiretun::{Cidr, Device, DeviceConfig, PeerConfig};
#[cfg(unix)]
use wiretun::uapi;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
   let cfg = DeviceConfig::default()
       .listen_port(40001);
   let name = if cfg!(target_os = "macos") { "utun88" } else { "wiretun0" };
   let device = Device::native(name, cfg).await?;
   #[cfg(unix)]
   uapi::bind_and_handle(device.control()).await?;
   Ok(())
}

More examples can be found in the examples directory.

Windows

  • Device::native uses Wintun on Windows, so the Wintun driver and wintun.dll must be available at runtime.
  • The optional uapi feature currently binds a Unix domain socket and is therefore unsupported on Windows.

Minimum supported Rust version (MSRV)

1.66.1

License

This project is licensed under the Apache 2.0 license.

About

WireGuard implementation in Rust to work with envoy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 96.3%
  • Shell 2.4%
  • Just 1.3%