Relays
A relay is the server a player’s Minecraft client actually connects to. It reads the address the player typed, finds an entry instance of that network, opens a stream to its connector and copies bytes in both directions. It is a small Rust program that Minekube runs, and that you can run yourself.
What it does
Section titled “What it does”- Reads one packet. It reads the handshake, the first packet a client sends, for the address the player typed. Everything after that, it copies without reading.
- Finds the network and an entry instance. It asks the registry for the network’s entry instances and caches the answers. Entry and routing explains how it picks one.
- Opens a stream to the instance’s key. Instances keep a connection to a relay, so the relay reaches them behind NAT.
- Is the home relay of instances. The relay also runs the relay service of iroh, the networking library underneath. Connectors keep their connection there, and connectors without outbound UDP reach it over HTTPS.
- Answers when nobody can. When no entry instance takes players, it shows the network as offline in the server list and turns joins away with a message.
Why relays understand nothing
Section titled “Why relays understand nothing”A relay that only passes bytes is small, fast and safe to share.
- Every network shares a few relay addresses. A network needs no public IP and no open port.
- Players’ traffic stays theirs. In online mode, the client and the server encrypt their connection end to end, so a relay cannot read or change it. It sees addresses, host names, times and amounts.
- It runs no customer code. A network’s rules run in the network’s own servers.
- It keeps working without the Minekube API. It serves joins from its cached answers while the API is unreachable.
Near the server, not near the player
Section titled “Near the server, not near the player”The route from a player to a server is fixed by where the server is. A relay close to the server lies almost on that route, so each connector measures the relays it knows and takes the nearest as its home. Low latency comes from that choice, not from anycast. Performance has the measured numbers.
What a relay is not
Section titled “What a relay is not”- Not a proxy like Velocity. It does not log players in, hold their session or move them between servers.
- Not where rules run. It never decides who may join; the network’s code does.
- Not today’s Connect edge. Today’s Connect plugin connects to the Connect edge for
<endpoint>.play.minekube.net; the relay serves networks in the Minekube plugin.
Built and planned
Section titled “Built and planned”The relay is built and runs on staging, where the Minekube hub runs. Relays in several regions, for production at g.minekube.net, come next. Planned: anycast as a paid tier for failover, and a waiting room that holds players while no entry instance is ready.
Related
Section titled “Related”- Connector, relay and API: the relay in depth.
- Self-host the Minekube API and relay: run your own relay.
Was this helpful?
Thanks for the feedback.