Skip to main content

WireGuard Connection

wireguard/state

The current WireGuard state.

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/wireguard/state
{ "state": 3, "connection_start": 15346, "connection_end": 0 }
NameDescription
state
int

State of the connection to the WireGuard peer

  • 0 - Not configured
  • 1 - Waiting for time synchronization
  • 2 - Not connected
  • 3 - Connected
connection_start
int (ms)

Time in milliseconds when the last connection was established.

connection_end
int (ms)

Time in milliseconds when the last connection was disconnected.




wireguard/config

The WireGuard configuration.

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/wireguard/config
{
"enable": false,
"internal_ip": "",
"internal_subnet": "",
// Not returned
"private_key": null,
"remote_host": "",
"remote_port": 51820,
// Not returned
"remote_public_key": null,
"allowed_ip": "",
"allowed_subnet": ""
}

Write

curl http://$HOST/wireguard/config -d '{
"enable": true,
"make_default_interface": true,
"internal_ip": "123.145.167.189",
"internal_subnet": "255.255.255.0",
"internal_gateway": "123.145.167.1",
"remote_host": "1.2.3.4",
"remote_port": 51820,
"local_port": 51820,
"private_key": "7aufw3iiQRVs9HyN8sGPeAHtVKVMVgV+bdRrql5S6ac=",
"remote_public_key": "VKKqmbJ97OTKbqCBszfUaa/H1Tzy7IO9f+TWhwH7m9o=",
"preshared_key": "tZtZ59nx5uIQma7phYTA4b8P28ogSzKHFC40izC6y4c=",
"allowed_ip": "0.0.0.0",
"allowed_subnet": "0.0.0.0"
}'
NameDescription
enable
bool

Indicates whether a WireGuard connection to the configured peer should be established.

  • true - If WireGuard is enabled.
  • false - If WireGuard is disabled.
make_default_interface
bool

Indicates whether all non-local network traffic should be routed through WireGuard.

  • true - If WireGuard is the default interface: All non-local network traffic is routed through WireGuard.
  • false - If WireGuard is not the default interface: Only network traffic in the WireGuard subnet is routed through WireGuard.
internal_ip
string

IP address of the device in the WireGuard network

internal_subnet
string

Subnet mask of the WireGuard network

internal_gateway
string

Gateway of the WireGuard network

remote_host
string

Public address or hostname of the peer to which a WireGuard connection should be established

remote_port
int

Port of the peer to which a WireGuard connection should be established

local_port
int

Port from which the WireGuard connection is established

private_key
string

Private key of the device (44 Base64 characters or empty)

remote_public_key
string

Public key of the peer to which a WireGuard connection should be established (44 Base64 characters or empty)

preshared_key
string

Preshared key (PSK) of the connection between device and peer (44 Base64 characters or empty)

allowed_ip
string

Allowed source IP of packets received over the WireGuard connection. 0.0.0.0 to process all received packets

allowed_subnet
string

Allowed subnet mask of packets received over the WireGuard connection. 0.0.0.0 to process all received packets