Settings

Theme

Show HN: Relaynet – open-source relay that gives browser tabs a real network

github.com

1 points by jonathanberi · 1 comment

Reader

1 thread
jonathanberiOP

Browsers can't open a TCP socket. That keeps biting anything that brings its own network stack into a tab: emulated VMs, WebAssembly builds of an OS, user-space TCP/IP like smoltcp or lwIP. I kept writing one-off relays for these, so I built a proper one and have now open-sourced it.

How it works: the page sends raw Ethernet frames over a WebSocket. The relay gives it a DHCP lease and DNS, and NATs IPv4 TCP and UDP out to the internet. Sessions from the same account share a private network, so two VMs in two tabs can reach each other. A small client library (npm: relaynet) handles reconnects and heartbeats.

Things people have done with it: a Linux VM in a tab running apt and git, a browser SSH client reaching port 22 directly, a WebUSB device shared with a Linux machine over USB/IP.

Self-hosting is the main point of this release:

    git clone https://github.com/beriberikix/relaynet
    cd relaynet && docker compose up
That runs the relay and the site with accounts, API tokens and an operator panel. It needs no third-party services. Add a domain for automatic HTTPS, and any OpenID Connect provider if you want SSO. Prebuilt images are on GHCR with build provenance.

- License: Apache-2.0. The relay engine is MIT, a fork of rootlessRelay that adds accounts, orgs, quotas and metering.

- Abuse controls: outbound port 25, private ranges and the usual UDP amplification ports are blocked by default. Every self-hosted relay's egress comes from your own IP, so you own the abuse reports.

- Limits: IPv4 only, and throughput is modest. On a small shared-CPU VM, CPU is the bottleneck (about 1.4 MiB/s in total under load). Profiling the user-space TCP path is next.

There's also a hosted instance at https://relaynet.network with a free tier, if you just want to try a client against it. A Zephyr RTOS build in an x86 emulator is a quick no-account demo: https://beriberikix.github.io/zephyr-v86/

Most interested in hearing from anyone building browser-based VMs, shells, debuggers or emulators, and what breaks.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection