pojntfx / weron

Overlay networks based on WebRTC.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nodes do not reconnect automatically after connection to signaling server is lost

sagar-chandarana opened this issue · comments

After disconnecting from wifi and connecting again on my laptop, it just goes into an endless loop of Stream Closed, despite having sent and received a kick after reconnection.

The only thing that actually helps to reconnect is to restart the weron vpn ip process

command

# node 1 (nixOS laptop)
weron -v 6 vpn ip --community 'somecomm' --password 'strongpass' --key 'longkey' --ips 10.10.1.1/24 --static --dev weron0

# node 2 (nixOS homelab)
weron -v 6 vpn ip --community 'somecomm' --password 'strongpass' --key 'longkey' --ips 10.10.1.2/24 --static --dev weron0

logs from node1 (laptop)

# fresh connection on starting weron
{"level":"info","id":"[\"10.10.1.2/24\"]","time":"2023-09-25T16:00:47-03:00","message":"Connected to peer"}

# disconnecting wifi
{"level":"debug","error":"Stream closed","channelID":"weron/ip/primary","peerID":"[\"10.10.1.2/24\"]","time":"2023-09-25T15:53:23-03:00","message":"Could not write to peer, continuing"}
... # repeats same message

# reconnecting wifi
{"level":"debug","label":"weron/ip/id","peer":"451a9302-6c3d-4197-ad61-f215c6c8c937","time":"2023-09-25T15:53:23-03:00","message":"Connected to channel"}
{"level":"debug","channelID":"weron/ip/id","peerID":"[\"10.10.1.2/24\"]","candidates":1,"timestamp":1695667830493778484,"time":"2023-09-25T15:53:23-03:00","message":"Sending greeting"}
{"level":"debug","label":"weron/ip/primary","peer":"451a9302-6c3d-4197-ad61-f215c6c8c937","time":"2023-09-25T15:53:23-03:00","message":"Connected to channel"}
{"level":"debug","channelID":"weron/ip/id","peerID":"[\"10.10.1.2/24\"]","time":"2023-09-25T15:53:23-03:00","message":"Received greeting"}
{"level":"debug","channelID":"weron/ip/id","peerID":"[\"10.10.1.2/24\"]","id":"","time":"2023-09-25T15:53:23-03:00","message":"Sending kick"}
{"level":"debug","channelID":"weron/ip/id","peerID":"[\"10.10.1.2/24\"]","id":"[\"10.10.1.2/24\"]","time":"2023-09-25T15:53:23-03:00","message":"Received kick"}

{"level":"debug","error":"Stream closed","channelID":"weron/ip/primary","peerID":"[\"10.10.1.2/24\"]","time":"2023-09-25T15:53:23-03:00","message":"Could not write to peer, continuing"}
... # repeats

Thank you for your amazing work btw! I find it quite fascinating that I can just setup a VPN between a few nodes in seconds without having to setup an account a website (zerotier, tailscale) or setting up discovery server (nebula, n2n).

This is definitely a bug, probably in the negotiation protocol. I'll take a look at this in the future, there is still a bit of yak shaving to do in the meantime (mostly in https://github.com/pojntfx/panrpc)