Skip to main content

Crate townos_tunnel

Crate townos_tunnel 

Source
Expand description

Brings a Town OS overlay up using the WireGuard the host already has.

The client does not implement WireGuard. It enrolls a peer, writes the wg-quick config the box hands back, and hands the work to something that can do it: town-os-tunneld on Linux, wg-quick on macOS, and the WireGuard tunnel service on Windows.

Two consequences are worth stating plainly. Bringing an interface up needs root, and on Linux that privilege was granted once, to the helper, when it was installed — so nothing here ever raises an authorization prompt, and nothing here ever waits on one. macOS and Windows still ask, because neither has a helper yet. And when there is nothing on the machine to drive, TunnelManager::backend answers None, and the honest move is to export the config for the user to import, which TunnelManager::config_path supports.

Re-exports§

pub use config::WgConfig;
pub use config::interface_name;
pub use keys::Keypair;

Modules§

config
Parsing and rendering the wg-quick config the box hands out.
helper
The client half of the helper protocol. Linux-only, because the helper is. Talking to the privileged helper.
keys
WireGuard keypairs, generated here rather than on the box.
netlink
Talking to the kernel directly. Linux only for now; the other platforms reach their WireGuard through different interfaces and get their own modules rather than a lowest common denominator here. Asking the kernel about an interface, over netlink, without a subprocess.
proto
What the client and the privileged helper say to each other.

Structs§

Availability
Whether a backend can be used, and if not, what to tell the user.
Tunnel
One overlay, ready to bring up.
TunnelManager
Owns the config files and picks a backend.

Enums§

BackendKind
Which system WireGuard a backend drives.
Error

Traits§

Backend
What a backend can do with an interface.

Type Aliases§

Result