PUQ Mautic Skip to main content

WireGuard

Order now | Download | FAQ

WireGuard info

Request Structure: https://<puqvpnvp>/api/v1/wireguard/info

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=ae748cb82d024edffdc4cdc14251c1ef5a3bbe6fba7a670f465638b517eef49ca1c19e1e4c025aab" \
-X GET https://dev.softkeel.com/api/v1/wireguard/info

Response example:

{
   "error" : "",
   "msg" : {
      "wireguard" : "1.0.20210223-1",
      "wireguard-dkms" : "1.0.20210219-1",
      "wireguard-tools" : "1.0.20210223-1"
   },
   "status" : "success"
}

Errors:

-Not authorized

WireGuards servers list

Request Structure: https://<puqvpnvp>/api/v1/wireguard

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=ae748cb82d024edffdc4cdc14251c1ef5a3bbe6fba7a670f465638b517eef49ca1c19e1e4c025aab" \
-X GET https://dev.softkeel.com/api/v1/wireguard

Response example:

{
   "error" : "",
   "msg" : {
               "Default_87" : {
            "address" : "10.0.86.1/24",
            "b_download" : "11",
            "b_upload" : "22",
            "dns_1" : "8.8.8.8",
            "dns_2" : "1.1.1.1",
            "external_ip" : "77.87.125.200",
            "ikev2" : false,
            "interface_name" : "wg87",
            "internal_traffic" : false,
            "keep_alive" : 0,
            "listen_port" : "51907",
            "name" : "Default_87",
            "private_key" : "mPzPaGF2nltQEJ+FAptKJLKG+oG3lYQKrvrn1GOZrXU=",
            "public_key" : "u2ACzhkKxlZfI52gcAsZuNdryum5ZgCeNY9ezqEI9kU="
         },
         "Default_97" : {
            "address" : "10.0.96.1/24",
            "b_download" : "1",
            "b_upload" : "1",
            "dns_1" : "8.8.8.8",
            "dns_2" : "1.1.1.1",
            "external_ip" : "77.87.125.200",
            "ikev2" : true,
            "interface_name" : "wg97",
            "internal_traffic" : false,
            "keep_alive" : 1,
            "listen_port" : "51917",
            "name" : "Default_97",
            "private_key" : "4IbFB7rnE6QYdOhd2dssVrNrbhhIb/MV/VyJgB/QkWk=",
            "public_key" : "9aLp9bEq+CI+yYM/lMBKEuwIG0NW1fO3IcBjFioI7XQ="
         }
   },
   "status" : "success"
}

Errors:

-Not authorized

WireGuard server ADD

Request Structure: https://<puqvpnvp>/api/v1/wireguard

Cookie: access_hash=<access_hash>

Method: POST

POST data: 

Options not required:

"name" = "NAME"
"private_key" = "private_key"
"public_key" = "public_key"
"interface_name" = "wgX"
"listen_port" = "51820-65535"
"mtu" = "0-9100"
"keep_alive" = "0-2147483647"
"allowed_ips" = "CIDR format,CIDR format,CIDR format,...."
"endpoint" = "IP|domain"

"address" = "CIDR format"
"internal_traffic" = "1|0"
"external_ip" = "CIDR format"
"dns_1" = "CIDR format"
"dns_2" = "CIDR format"

"ipv6" = "1|0"
"address_ipv6" = "CIDR format"
"dns_1_ipv6" = "CIDR format"
"dns_2_ipv6" = "CIDR format"

"b_download" = "0-10000"
"b_upload" = "0-10000"

"ikev2"= "1|0"

If any parameter is not specified during creation, the system will create, if possible, with a unique parameter.

Example:

curl \
-b "access_hash=ae748cb82d024edffdc4cdc14251c1ef5a3bbe6fba7a670f465638b517eef49ca1c19e1e4c025aab" \
-d "address=10.0.26.1/24&\
b_download=0&\
b_upload=0&\
dns_1=10.0.26.1&\
dns_2=77.87.125.200&\
external_ip=77.87.125.200&\
interface_name=wg28&\
internal_traffic=1&\
listen_port=51848&\
name=Default_28&\
keep_alive=25&\
ikev2=1&\
mtu=1320&\
allowed_ips=0.0.0.0/1,0.0.0.129/1&\
private_key=2DJdzjmOtT1IfAg25V3PuuTM1biFCcvOk7wI5D4SIUk=&\
public_key=qO2nrUkvxcWJ6xuMbZB1DMiCZ9OLUl918bQS8PnkDTE=" \
-X POST https://dev.softkeel.com/api/v1/wireguard

Response example:

{
   "error" : "",
   "msg" : {
      "address" : "10.0.26.1/24",
      "b_download" : "0",
      "b_upload" : "0",
      "dns_1" : "10.0.26.1",
      "dns_2" : "77.87.125.200",
      "external_ip" : "77.87.125.200",
      "ikev2" : true,
      "interface_name" : "wg28",
      "internal_traffic" : true,
      "keep_alive" : 25,
      "listen_port" : "51848",
      "name" : "Default_28",
      "private_key" : "2DJdzjmOtT1IfAg25V3PuuTM1biFCcvOk7wI5D4SIUk=",
      "public_key" : "qO2nrUkvxcWJ6xuMbZB1DMiCZ9OLUl918bQS8PnkDTE="
   },
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found
-The name is already in use
-Wrong network interface name (wgXXX)
-Wrong name (only letters, numbers and '_', '-')
-Keys are invalid
-Interface already in use
-Port already in use
-Wrong external IP format
-Wrong Port format
-IP address or subnet already in use
-Wrong DNS1 IP format
-Wrong DNS2 IP format

WireGuard server EDIT

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<name>

Cookie: access_hash=<access_hash>

Method: PUT

PUT data: 

Options not required:

"mtu" = "0-9100"
"keep_alive" = "0-2147483647"
"allowed_ips" = "CIDR format,CIDR format,CIDR format,...."
"endpoint" = "IP|domain"

"address" = "CIDR format"
"internal_traffic" = "1|0"
"external_ip" = "CIDR format"
"dns_1" = "CIDR format"
"dns_2" = "CIDR format"

"ipv6" = "1|0"
"address_ipv6" = "CIDR format"
"dns_1_ipv6" = "CIDR format"
"dns_2_ipv6" = "CIDR format"

"b_download" = "0-10000"
"b_upload" = "0-10000"

"ikev2"= "1|0"

Example:

curl \
-b "access_hash=ae748cb82d024edffdc4cdc14251c1ef5a3bbe6fba7a670f465638b517eef49ca1c19e1e4c025aab" \
-d "internal_traffic=false&\
listen_port=51333&\
keep_alive=50&\
mtu=1320&\
allowed_ips=0.0.0.0/1,0.0.0.129/1&\
ikev2=0" \
-X PUT https://dev.softkeel.com/api/v1/wireguard/Default_128

Response example:

{
   "error" : "",
   "msg" : {
      "address" : "10.0.127.1/24",
      "b_download" : "6",
      "b_upload" : "7",
      "dns_1" : "8.8.8.8",
      "dns_2" : "1.1.1.1",
      "external_ip" : "77.87.125.200",
      "ikev2" : false,
      "interface_name" : "wg128",
      "internal_traffic" : false,
      "keep_alive" : 50,
      "listen_port" : "51333",
      "name" : "Default_128",
      "private_key" : "cAnS3fQbdvHUS+9eV05Uf+cP+gn8i4LpzXsdE7mUZ2E=",
      "public_key" : "RVNBbsEIjEkgsyXzmd5vMBIcOzzcTSC/fPscdDwzlQo="
   },
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found
-Keys are invalid
-Interface already in use
-Port already in use
-Wrong external IP format
-Wrong Port format
-IP address or subnet already in use
-Wrong DNS1 IP format
-Wrong DNS2 IP format

WireGuard server DELETE

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<name>

Cookie: access_hash=<access_hash>

Method: DELETE

Example:

curl \
-b "access_hash=eda121857897bcf0e4cdf5a3eaf957f35ccb62d39d5bc0bfbfb6d31644eee3cd7f8365e71ad94a60" \
-X DELETE https://dev.softkeel.com/api/v1/wireguard/Default_90

Response example:

{
   "error" : "",
   "msg" : "success",
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found
-Cannot be deleted. There are active peers.

WireGuard server DETAIl

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=ae748cb82d024edffdc4cdc14251c1ef5a3bbe6fba7a670f465638b517eef49ca1c19e1e4c025aab" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_95

Response example:

{
   "error" : "",
   "msg" : {
      "address" : "10.0.127.1/24",
      "b_download" : "6",
      "b_upload" : "7",
      "dns_1" : "8.8.8.8",
      "dns_2" : "1.1.1.1",
      "external_ip" : "77.87.125.200",
      "ikev2" : false,
      "interface_name" : "wg128",
      "internal_traffic" : false,
      "keep_alive" : 50,
      "listen_port" : "51333",
      "name" : "Default_128",
      "private_key" : "cAnS3fQbdvHUS+9eV05Uf+cP+gn8i4LpzXsdE7mUZ2E=",
      "public_key" : "RVNBbsEIjEkgsyXzmd5vMBIcOzzcTSC/fPscdDwzlQo="
   },
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found

WireGuard server PEERS

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>/peers

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=eda121857897bcf0e4cdf5a3eaf957f35ccb62d39d5bc0bfbfb6d31644eee3cd7f8365e71ad94a60" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_125/peers

Response example:

{
   "error" : "",
   "msg" : {
      "peer_126" : {
         "allowed_IPs" : "10.0.124.2",
         "b_download" : "8",
         "b_upload" : "6",
         "mangle" : "232",
         "name" : "peer_126",
         "password" : "K@6#2XR9$3",
         "private_key" : "AG9dc2NLVVBGT3bxg7YT0QJHTplWHcHJmzAPUOOx22g=",
         "public_key" : "PasJjAGnzTxV4meACiGtx3QvJ6jzvPugs4nBdzKUcSU=",
         "status" : "enable",
         "username" : "user_127",
         "wg_name" : "Default_125"
      },
      "peer_132" : {
         "allowed_IPs" : "10.0.124.3",
         "b_download" : "8",
         "b_upload" : "6",
         "mangle" : "238",
         "name" : "peer_132",
         "password" : "6K2W3@W4$7",
         "private_key" : "QJhk78F9ZyLmudqTlJAr4eVCSSmMgVblNEzWFyALbW4=",
         "public_key" : "6jyITtbPNZNzRXexxIEnVBrN7hriRep3nlKhLeyqSFk=",
         "status" : "enable",
         "username" : "user_133",
         "wg_name" : "Default_125"
      }
   },
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found

WireGuard server port forward

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>/port_forward

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=ee34183e198f9ba40a97a475579f8561bfcbe8c6f08337362b2f9e3cf1092e2d75f18179a80a14d8" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_125/port_forward

Response example:

{
   "error" : "",
   "msg" : {
      "123_tcp" : {
         "dst_port" : 123,
         "protocol" : "tcp",
         "to_peer" : "peer_126",
         "to_port" : 444
      },
      "123_udp" : {
         "dst_port" : 123,
         "protocol" : "udp",
         "to_peer" : "peer_132",
         "to_port" : 2223
      },
      "2222_tcp" : {
         "dst_port" : 2222,
         "protocol" : "tcp",
         "to_peer" : "peer_126",
         "to_port" : 22
      },
      "53_udp" : {
         "dst_port" : 53,
         "protocol" : "udp",
         "to_peer" : "peer_126",
         "to_port" : 53
      }
   },
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found

WireGuard port worward ADD

Request Structure: https://<puqvpnvp>/api/v1/port_forward

Cookie: access_hash=<access_hash>

Method: POST

POST data: 

Required:

"dst_port" = 1-65535
"protocol" ="tcp|udp"
"to_peer" = "name_of_peer"
"to_port" = 1-65535

Example:

curl \
-b "access_hash=ee34183e198f9ba40a97a475579f8561bfcbe8c6f08337362b2f9e3cf1092e2d75f18179a80a14d8" \
-d "dst_port=23&\
protocol=udp&\
to_peer=peer_126&\
to_port=325" \
-X POST https://dev.softkeel.com/api/v1/wireguard/Default_125/port_forwarding

Response example:

{
   "error" : "",
   "msg" : {
      "dst_port" : 23,
      "protocol" : "udp",
      "to_peer" : "peer_126",
      "to_port" : 325
   },
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found
-Protocol must be tcp or udp
-DST port must be within 1-65535
-DST port and protocol are already enabled
-ListenPort processing error
-DstPort cannot be ListenPort
-To port must be within 1-65535
-Entered incorrect peer

WireGuard port worward DELETE

Request Structure: https://<puqvpnvp>/api/v1/port_forward/<dst_port>/<protocol>

Cookie: access_hash=<access_hash>

Method: DELETE

Example:

curl \
-b "access_hash=ee34183e198f9ba40a97a475579f8561bfcbe8c6f08337362b2f9e3cf1092e2d75f18179a80a14d8" \
-X DELETE https://dev.softkeel.com/api/v1/wireguard/Default_125/port_forwarding/23/udp

Response example:

{
   "error" : "",
   "msg" : "success",
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found
-There is no such port forwarding
-Incorrect protocol parameter (tcp|udp)
-Incorrect dst_port parameter

WireGuard server Firewall Nat Rules

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>/firewall_nat_rules

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=eda121857897bcf0e4cdf5a3eaf957f35ccb62d39d5bc0bfbfb6d31644eee3cd7f8365e71ad94a60" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_125/firewall_nat_rules

Response example:

{
   "error" : "",
   "msg" : "10.0.124.0/24 -> 0.0.0.0/0 SNAT to:77.87.125.200 Pkt:0 Bytes:0\n",
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found

WireGuard server Firewall Filter Rules

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>/firewall_filter_rules

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=eda121857897bcf0e4cdf5a3eaf957f35ccb62d39d5bc0bfbfb6d31644eee3cd7f8365e71ad94a60" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_125/firewall_filter_rules

Response example:

{
   "error" : "",
   "msg" : "10.0.124.0/24 -> 10.0.124.0/24 ACCEPT  Pkt:0 Bytes:0\n",
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found

WireGuard server Traffic Control

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>/traffic_control

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=eda121857897bcf0e4cdf5a3eaf957f35ccb62d39d5bc0bfbfb6d31644eee3cd7f8365e71ad94a60" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_125/traffic_control

Response example:

{
   "error" : "",
   "msg" : "qdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 0 direct_qlen 1000\n Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) \n backlog 0b 0p requeues 0\n",
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found

WireGuard server Dump

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>/dump

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=eda121857897bcf0e4cdf5a3eaf957f35ccb62d39d5bc0bfbfb6d31644eee3cd7f8365e71ad94a60" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_125/dump

Response example:

{
   "error" : "",
   "msg" : {
      "port" : "51945",
      "public_key" : "Ok2/cmy13UkcrXZOCsiXwj82uRhsX1ev+6BF8Z+8alc="
   },
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found

WireGuard Get Available IPs

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>/available_ips

Method: GET

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=eda121857897bcf0e4cdf5a3eaf957f35ccb62d39d5bc0bfbfb6d31644eee3cd7f8365e71ad94a60" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_125/available_ips

Response example:

{
   "error" : "",
   "msg" : [
      "10.0.124.4",
      "10.0.124.5",
      "10.0.124.6",
      "10.0.124.7",
      "10.0.124.8",
      "10.0.124.9",
      "10.0.124.10",
      "10.0.124.254"
   ],
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found

WireGuard Set bandwidth fo all peers

Request Structure: https://<puqvpnvp>/api/v1/wireguard/<NAME>/set_bandwidth

Method: PUT

Cookie: access_hash=<access_hash>

Example:

curl \
-b "access_hash=eda121857897bcf0e4cdf5a3eaf957f35ccb62d39d5bc0bfbfb6d31644eee3cd7f8365e71ad94a60" \
-X GET https://dev.softkeel.com/api/v1/wireguard/Default_125/set_bandwidth

Response example:

{
   "error" : "",
   "msg" : "",
   "status" : "success"
}

Errors:

-Not authorized
-Wireguard server not found