A VPN based on libp2p and wireguard-proctol.
Use libp2p to discover and manage network-connections, setup a secure channel utilizing wireguard-proctol, provide traffic on local TUN device.
As i'm still progressing to get more familiar with libp2p's network-stack, the project ONLY provides P2P-connectivity through libp2p currently.
cargo build
Generate a private key and store it in file YOUR_PRIVATE_KEY_FILE:
vpnr generate-key YOUR_PRIVATE_KEY_FILE
This will generate a file YOUR_PRIVATE_KEY_FILE containing your private-key. Keep your private-key safe!
To start the service in listening-only mode, please run
vpnr start --keyfile YOUR_PRIVATE_KEY_FILE
The VPN will be ready to accept incoming connections from other nodes, but it will NOT announce itself on the network nor will it open any connections.
In order to participate in a P2P-network connections to other participants must be made.
You can bind this service to a specific network-device and port.
--listen-addr SOME-IP-ADDRESS
--listen-port SOME-PORT-NUMBER
todo()
Default value: empty
Spec: (https://github.com/libp2p/specs/blob/master/relay/circuit-v1.md)
When relaying a connection between two different ndoes on the network, the traffic between these nodes passes through your connections to them.
If you want to enable this feature use
--enable-relay=true
Default value: false
Spec: (https://github.com/libp2p/specs/blob/master/relay/DCUtR.md)
--enable-dcutr=true
Default value: false
Spec: (https://github.com/libp2p/specs/blob/master/autonat/autonat-v1.md)
--enable-autonat=true
Default value: false
Spec: (https://github.com/libp2p/specs/blob/master/discovery/mdns.md)
Broadcast service-announcements via mDNS on local network
--enable-mdns=true
Default value: false
Manage port-mapping on router automatically.
--enable-upnp=true
I have not seen my router deleting old forwarding-entries. In such a situation it can be a good idea to combine this option with a statically assigned IP-address and port.
--listen-addr SOME-IP-ADDRESS
--listen-port SOME-PORT-NUMBER
Default value: false
Spec: (https://github.com/libp2p/specs/tree/master/kad-dht)
The fingerprint of your identity-key will be made available on DHT. Should be fine, but i'm sure some would like to be aware.
Enable distributed-hash-table
--enable-dht=true
Default value: false
Good news first: it is possible to operate the service in a containerized environment :).
podman build -t chipfunk/vpnr:latest .
podman run --mount type=bind,src=$(pwd),target=/vpnr,z chipfunk/vpnr:latest generate-key /vpnr/YOUR_PRIVATE_KEY_FILE
To successfully expose the VPN-service to a network, the service has to have a specific port-number assigned before starting the container.
export VPN_LISTEN_PORT=59123
podman run \
-p $VPN_LISTEN_PORT:$VPN_LISTEN_PORT/tcp \
-p $VPN_LISTEN_PORT:$VPN_LISTEN_PORT/udp \
--mount type=bind,src=$(pwd),target=/vpnr,z chipfunk/vpnr:latest \
start \
--keyfile=/vpnr/YOUR_PRIVATE_KEY_FILE \
--listen-port $VPN_LISTEN_PORT