mirror of
https://github.com/fosrl/gerbil.git
synced 2026-05-08 20:07:49 -05:00
[PR #77] feat: websocket relay #197
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/gerbil/pull/77
Author: @nicholasliverett
Created: 4/11/2026
Status: 🔄 Open
Base:
dev← Head:feature-websocket-relay📝 Commits (5)
6f73a0dAdd TCP relay server and main integration30e7b45Add var for b limit3662ba9Enhance metrics tracking in SNIProxy connection handling1f72ae2Add TCP relay server and main integration24a5ac6resolved conflict📊 Changes
4 files changed (+880 additions, -0 deletions)
View changed files
📝
main.go(+13 -0)📝
proxy/proxy.go(+1 -0)➕
relay/tcp_relay.go(+433 -0)➕
relay/wss_relay.go(+433 -0)📄 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.
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
Pangolin: fosrl/pangolin#2831
Olm: fosrl/olm#112
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.