flutter_wireguard library

flutter_wireguard public API.

All operations are top-level functions; there is no facade object to instantiate. Status events are exposed as a single broadcast Stream that any number of listeners can attach to.

Classes

BackendInfo
TunnelStatus
A snapshot of a tunnel's runtime status.
WireGuardKeyPair
A WireGuard keypair: 32-byte X25519 private/public keys, base64 encoded.

Enums

BackendKind
Identifies which underlying engine is in use.
TunnelState
Tunnel runtime state. Mirrors com.wireguard.android.backend.Tunnel.State.

Functions

backend() Future<BackendInfo>
Identifies the active backend (e.g. kernel vs userspace).
generateKeyPair() Future<WireGuardKeyPair>
Generate a fresh X25519 keypair suitable for a WireGuard interface or peer.
generatePresharedKey() String
Generate a fresh 32-byte preshared key (matches wg genpsk).
publicKeyFromPrivate(String privateKeyBase64) Future<String>
Derive a public key from an existing base64-encoded WireGuard private key.
start(String name, String config) Future<void>
Bring tunnel name up using the supplied wg-quick / wg-config string.
status(String name) Future<TunnelStatus>
Snapshot of name's current state and traffic counters.
statusStream() Stream<TunnelStatus>
Live status updates pushed by the platform side.
stop(String name) Future<void>
Bring tunnel name down. No-op if it is already down or unknown.
tunnelNames() Future<List<String>>
Names of every tunnel known to the backend in this process lifetime.