mirror of
https://github.com/fosrl/olm.git
synced 2026-05-06 02:37:55 -05:00
[PR #112] feat: websocket relay #111
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/olm/pull/112
Author: @nicholasliverett
Created: 4/11/2026
Status: 🔄 Open
Base:
dev← Head:feature-websocket-relay📝 Commits (10+)
9b870b6Add WebSocket relay bind and relay handling9e08286Add TCP fallback timers and websocket relay switchf487680Working jit with chain idscc18a9eHandle canceling sends for relayd5ce777Make chainId in relay message bckwd compatbaf01c3Alias jit handler9927402Handle no chainId casef4adafdAdd WebSocket relay bind and relay handlingcc6ad2dAdd TCP fallback timers and websocket relay switch8ae1d09Add WebSocket relay configuration and handling📊 Changes
12 files changed (+830 additions, -57 deletions)
View changed files
📝
config.go(+16 -0)📝
main.go(+1 -0)📝
olm/connect.go(+33 -3)📝
olm/olm.go(+71 -12)📝
olm/peer.go(+90 -3)➕
olm/relay_switch.go(+208 -0)📝
olm/types.go(+1 -0)➕
olm/ws_relay_bind.go(+261 -0)📝
peers/manager.go(+93 -17)📝
peers/monitor/monitor.go(+9 -3)📝
peers/types.go(+1 -0)📝
websocket/client.go(+46 -19)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
What does this PR do?
You can read about the discussion related to this topic here: Transport flexiblity
As discussed, in more restrictive networks UDP connections may be completely blocked and clients are unable to connect to resources. To get around this we use a commonly allowed protocol: HTTPS, or more specifically websockets.
Description
OLM will try its normal direct UDP/hole punch and UDP relay. If OLM receives a relayEndpointWss (sent with relay info) it starts an 8s timer. Once that timer is up it switches from the shared UDP bind to a websocket bind. Traffic then flows OLM-(wss)->Pangolin-(tcp relay port)->Gerbil->Newt. Now since we are using a websocket the RTT is more than just raw wireguard, and it might be something to look into.
Also added a
--websocket-relayflag to use the websocket relay without the timer or trying UDP. So it forces the websocket relay at first connect.Note: the only thing changed is olm's connection to the gerbil relay, to newt nothing changes.
How to test?
Setup Pangolin, Gerbil, and Olm from companion PRs mentioned below and regular newt. Have to spin up pangolin, gerbil, newt, and olm to test this. Ideally checking, regular connections, restricted networks, and the force relay flag
Companion PRs
Gerbil: fosrl/gerbil#77
Pangolin: fosrl/pangolin#2831
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.