Derkades / os3-wg-p2p

Proof-of-concepts scripts for making standard WireGuard connections peer to peer using UDP hole punching or a relay server
1 stars 0 forks source link

Peer to peer WireGuard

Example of a VPN client and server that allows creating a peer to peer mesh network using WireGuard, without modifications to WireGuard itself. Uses UDP hole punching or a relay server. Fully supports IPv4 and IPv6 inside the tunnel, for peer to peer connections, for the relay server and the management server.

Requirements

Install wireguard-tools and a recent version of Python 3. No Python dependencies are required.

Additional requirements to use NetworkManager python3-gi (Debian) or python3-gobject (Fedora)

Server

Create the configuration file server_config.json:

{
    "server_port": 3000,
    "log_level": "INFO"
}

log_level can be change to DEBUG for increased log output. The server runs a TCP and UDP server, ensure incoming traffic is allowed for both protocols.

Run: python3 server.py

Client

Create the configuration file client_config.json:

{
    "uuid": "b20b3973-6dcd-43be-a097-e80126ae6532",
    "address4": "10.200.0.1",
    "address6": "fdf0:a1e8:32b1:200::1",
    "server_host": "localhost",
    "server_port": 3000,
    "log_level": "INFO",
    "network_manager": false
}

Run sudo python3 client.py