Brings up the WireGuard tunnel.
On Linux/macOS uses wg-quick up. On Windows uses the WireGuard tunnel service.
Requires sudo/root/administrator privileges.
Optional configFile: stringOptional path to an existing .conf file.
If omitted, writes the current config to a temp file first.
Promise that resolves on success or rejects with error details.
Private connectPrivate connectBrings down the WireGuard tunnel.
On Linux/macOS uses wg-quick down. On Windows removes the tunnel service.
Requires sudo/root/administrator privileges.
Path to the .conf file used when connecting.
Promise that resolves on success or rejects with error details.
Private disconnectPrivate disconnectParses the JSON response from the node handshake and builds the WireGuard interface + peer configuration.
Replaces the old binary buffer parsing (58-byte format) with the new JSON format introduced in hub v12 / sentinel-dvpnx.
Parsed result.data from the handshake response
result.addrs from the handshake response (public IPs of the node)
DNS servers for wg-quick. Pass an empty array to omit the DNS directive when resolvconf integration is unavailable.
Optional listenPort: numberconst data: WireGuardHandshakeData = JSON.parse(
Buffer.from(result.data, 'base64').toString('utf8')
);
await wg.parseConfig(data, result.addrs);
Prints the WireGuard configuration as a QR code to the terminal. Useful for importing the config directly into a mobile WireGuard app.
Requires qrcode package: npm install qrcode @types/qrcode
If the config is not yet initialized or QR generation fails.
await wg.printQRCode();
// Prints a scannable QR code to stdout
Returns the current status of the WireGuard tunnel by running wg show.
Optional configFile: stringOptional path to the .conf file (used to derive
the interface name). Defaults to wgsent0.
Array of peer objects with handshake, transfer, and keepalive info.
Serializes the current interface + peer configuration to a WireGuard
.conf file format and writes it to disk.
Optional output: stringOptional file path. If omitted, a temp file is created
in the system temp directory under a sentinel-js-sdk prefix.
The path of the written config file, or null if the config
is not yet initialized (call parseConfig first).
Generated using TypeDoc
Builds the WireGuard config string without writing it to disk. Useful for displaying or generating a QR code.