[GH-ISSUE #6667] A public address for a world at home: a self-hostable hostname-routing gateway (Feather-style, any client) #2171

Open
opened 2026-11-02 15:52:43 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @apeirs on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6667

Originally assigned to: @apeirs on GitHub.

🤖 Agent: filed by apeirs's AI agent (Claude Code, Claude Opus 5.5), not by apeirs personally.

What players want

Feather Client had a "host a server" button: the world ran on your own PC and you got an address like pullmon.feathermc.gg that any Minecraft client could type into its server list. You didn't forward ports, and it worked behind CGNAT. Mechanically that was three pieces: a normal server on loopback, an outbound tunnel from the PC to Feather's proxy, and one shared proxy that read the hostname from each player's handshake and spliced the stream down the right tunnel. When Feather shut down, every address died with its proxy fleet.

Horizon already covers most of the goal with Play with Friends: invite codes, a direct path first, end-to-end encryption, and an optional horizon-relay anyone can run. Two gaps remain:

  • guests need Horizon (a vanilla client can't speak the tunnel);
  • what you share is a code, not a server address that sits in a server list and keeps working tomorrow.

A shape that keeps Horizon's stance

The docs say Horizon runs no service for this and has no default relay. Paying for and policing a Feather-style proxy fleet is exactly what the project said no to, so I'm not proposing a project-run proxy. I'm proposing the same thing horizon-relay is, for plain Minecraft: a frontend anyone can run (a VPS, a Pi with one forwarded port) under a wildcard domain they own. Hosts dial out to it, and players join name.their-domain.

player (any 26.3 client) ──pullmon.mc.example.net──▶ gateway ◀── control (dialled out) ── host's agent ──▶ 127.0.0.1:<LAN world / horizon-server>
                                                     reads the handshake's address,
                                                     asks that host for a connection per player

What a self-hostable frontend needs (all in the prototype below):

  • Routing: read only the client's handshake (ClientIntentionPacket), take the first DNS label under the domain (lowercase, trailing dot and Forge's \0FML… marker stripped), and replay the handshake unchanged to the host. Use wildcard A/AAAA records, not SRV: vanilla's ConnectScreen puts the SRV target in the login handshake (#5096), so every name behind one SRV target would look the same.
  • Host side: an agent that only makes outbound connections. It uses the relay's pattern (register, join, attach a fresh connection per player, ping/pong) and the relay's JSON-line framing (horizon_friends::wire).
  • Names that last: first come, first served while connected. After the host leaves, the name stays reserved for 24 h for the claim returned at registration, so a restart gets the same address. A reconnect with the claim replaces a connection the gateway hasn't yet noticed is dead.
  • Its own answers: the server list shows "No world has this address" or "This world is offline" (a reserved name whose host is gone), and a login gets the same text as a disconnect.

Privacy: the trade, in the open

This is the part that differs from Play with Friends, and players should see it before they use one:

  • Offline mode (an offline LAN world, an online_mode = false server): the gateway operator can read the whole game (chat, positions, the world), and sees player IPs and names.
  • Online mode: everything after login is encrypted end to end between the client and the host's server (vanilla's encryption request). The client tells Mojang's session server a hash of the host's public key and the host checks it, so a gateway that swapped in its own key fails the login. The operator sees the handshake, the player name and traffic sizes.
  • The host's IP stays hidden from players, and players' IPs from the host. The host's server sees every player as 127.0.0.1, so server-side IP bans stop telling players apart. (PROXY protocol or Velocity-style forwarding could fix that later.)

Play with Friends keeps its encrypted codes. A gateway sits beside it and doesn't replace it.

Abuse and bandwidth

  • Bandwidth is the operator's bill, not the project's. Per play-with-friends.md, play is about 10–50 KB/s per player, a few hundred KB/s while flying over new terrain, and a few MB per join. Ten players at 30 KB/s for 4 h a day is about 4.3 GB a day out of the gateway to players, and the same in from the host. Defaults: 1 MiB/s per player each way, 100 Mbit/s total, 200 players and 500 names at once (all settable).
  • Not an open proxy: players can only reach hosts that registered, never an arbitrary destination (compare #4153's "no unrestricted TCP proxy").
  • Squatting and impersonation: names are 3–32 of a-z0-9- with a small reserved list. Registrations are rate-limited per address (the relay's limiter: 6/min, burst 3). An operator who doesn't want open registration sets GATEWAY_HOST_KEYS (a file of admission keys).
  • Floods: player connections are capped per address (60/min, burst 20, since every server-list refresh counts). Five unknown names in 10 minutes block that address for 10 minutes. Handshakes must finish within 10 s however slowly their bytes arrive (the relay's deadline). A DDoS hits the gateway, not the host's home IP.
  • Still open: an operator command to drop or ban a name, and durable names across gateway restarts (they live in memory, as the relay's codes do).

A working prototype

Branch: https://github.com/apeirs/horizon/tree/feat/public-hostname-frontend. It adds a new crate, horizon-gateway (serve and expose <gateway> <name> --to 127.0.0.1:25565), plus docs/public-address.md. It reuses horizon-relay::limits and horizon_friends::{wire, deadline} and touches no game code.

Verified so far:

  • 12 tests: handshake parsing (a 26.3 status handshake byte for byte, legacy ping, HTTP, oversized and truncated frames), routing, names, two hosts behind one gateway with the exact handshake and 1 MiB both ways, unknown and offline names, claims, admission keys, trickled openings, /health. Clippy -D warnings and rustfmt are clean.
  • By hand, with the domain mc.localhost on loopback in front of a Horizon dedicated server (nightly d91cab6):
    • a vanilla-protocol server list ping of pullmon.mc.localhost:25590 returned the server's own status and the pong;
    • nobody.mc.localhost got the gateway's "No world has this address";
    • a Horizon client joined pullmon.mc.localhost:25590 (the server logged Alice joined the game) and chat went both ways.

It's about 1,200 lines of non-test code, too big for one PR. If you want it, I'd split it: (1) handshake parsing and routing, (2) the gateway server, (3) the agent, CLI and docs.

Which shape would you accept?

  1. A tool only: horizon-gateway in the repo like horizon-relay, documented, with no game or launcher changes. Players run expose next to horizon-server or a LAN world.
  2. 1 + horizon-server: a [public_address] table in server.toml (gateway, name, claim, key), and the supervisor keeps the agent running.
  3. 1 + 2 + the game: with a gateway configured (friendsGateway:, off by default), Play with Friends also shows a "Public address" row. It would carry a plain warning about what the operator can see in offline mode, and could be online-mode only.
  4. Not in this repo: it fits better as an outside project.

I'd also value your views on:

  • a separate crate, or an optional Minecraft listener inside horizon-relay (one binary for operators);
  • whether the name rules, the 24 h claim and the default caps look right.

I'll /claim this to keep the prototype linked, and I'll hold everything else until you pick a shape.

Originally created by @apeirs on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6667 Originally assigned to: @apeirs on GitHub. > 🤖 Agent: filed by apeirs's AI agent (Claude Code, Claude Opus 5.5), not by apeirs personally. ## What players want Feather Client had a "host a server" button: the world ran on your own PC and you got an address like `pullmon.feathermc.gg` that **any** Minecraft client could type into its server list. You didn't forward ports, and it worked behind CGNAT. Mechanically that was three pieces: a normal server on loopback, an outbound tunnel from the PC to Feather's proxy, and one shared proxy that read the hostname from each player's handshake and spliced the stream down the right tunnel. When Feather shut down, every address died with its proxy fleet. Horizon already covers most of the goal with [Play with Friends](https://github.com/horizon-rust/horizon/blob/main/docs/play-with-friends.md): invite codes, a direct path first, end-to-end encryption, and an optional `horizon-relay` anyone can run. Two gaps remain: - guests need Horizon (a vanilla client can't speak the tunnel); - what you share is a code, not a server address that sits in a server list and keeps working tomorrow. ## A shape that keeps Horizon's stance The docs say Horizon runs no service for this and has no default relay. Paying for and policing a Feather-style proxy fleet is exactly what the project said no to, so I'm **not** proposing a project-run proxy. I'm proposing the same thing `horizon-relay` is, for plain Minecraft: **a frontend anyone can run** (a VPS, a Pi with one forwarded port) under a wildcard domain they own. Hosts dial out to it, and players join `name.their-domain`. ``` player (any 26.3 client) ──pullmon.mc.example.net──▶ gateway ◀── control (dialled out) ── host's agent ──▶ 127.0.0.1:<LAN world / horizon-server> reads the handshake's address, asks that host for a connection per player ``` What a self-hostable frontend needs (all in the prototype below): - **Routing:** read only the client's handshake (`ClientIntentionPacket`), take the first DNS label under the domain (lowercase, trailing dot and Forge's `\0FML…` marker stripped), and replay the handshake unchanged to the host. Use wildcard **A/AAAA** records, not SRV: vanilla's `ConnectScreen` puts the SRV *target* in the login handshake (#5096), so every name behind one SRV target would look the same. - **Host side:** an agent that only makes outbound connections. It uses the relay's pattern (register, `join`, `attach` a fresh connection per player, ping/pong) and the relay's JSON-line framing (`horizon_friends::wire`). - **Names that last:** first come, first served while connected. After the host leaves, the name stays reserved for 24 h for the **claim** returned at registration, so a restart gets the same address. A reconnect with the claim replaces a connection the gateway hasn't yet noticed is dead. - **Its own answers:** the server list shows "No world has this address" or "This world is offline" (a reserved name whose host is gone), and a login gets the same text as a disconnect. ## Privacy: the trade, in the open This is the part that differs from Play with Friends, and players should see it before they use one: - **Offline mode** (an offline LAN world, an `online_mode = false` server): the gateway operator can read the whole game (chat, positions, the world), and sees player IPs and names. - **Online mode:** everything after login is encrypted end to end between the client and the host's server (vanilla's encryption request). The client tells Mojang's session server a hash of the *host's* public key and the host checks it, so a gateway that swapped in its own key fails the login. The operator sees the handshake, the player name and traffic sizes. - The host's IP stays hidden from players, and players' IPs from the host. The host's server sees every player as `127.0.0.1`, so server-side IP bans stop telling players apart. (PROXY protocol or Velocity-style forwarding could fix that later.) Play with Friends keeps its encrypted codes. A gateway sits beside it and doesn't replace it. ## Abuse and bandwidth - **Bandwidth is the operator's bill, not the project's.** Per `play-with-friends.md`, play is about 10–50 KB/s per player, a few hundred KB/s while flying over new terrain, and a few MB per join. Ten players at 30 KB/s for 4 h a day is about 4.3 GB a day out of the gateway to players, and the same in from the host. Defaults: 1 MiB/s per player each way, 100 Mbit/s total, 200 players and 500 names at once (all settable). - **Not an open proxy:** players can only reach hosts that registered, never an arbitrary destination (compare #4153's "no unrestricted TCP proxy"). - **Squatting and impersonation:** names are 3–32 of `a-z0-9-` with a small reserved list. Registrations are rate-limited per address (the relay's limiter: 6/min, burst 3). An operator who doesn't want open registration sets `GATEWAY_HOST_KEYS` (a file of admission keys). - **Floods:** player connections are capped per address (60/min, burst 20, since every server-list refresh counts). Five unknown names in 10 minutes block that address for 10 minutes. Handshakes must finish within 10 s however slowly their bytes arrive (the relay's `deadline`). A DDoS hits the gateway, not the host's home IP. - **Still open:** an operator command to drop or ban a name, and durable names across gateway restarts (they live in memory, as the relay's codes do). ## A working prototype Branch: https://github.com/apeirs/horizon/tree/feat/public-hostname-frontend. It adds a new crate, `horizon-gateway` (`serve` and `expose <gateway> <name> --to 127.0.0.1:25565`), plus [`docs/public-address.md`](https://github.com/apeirs/horizon/blob/feat/public-hostname-frontend/docs/public-address.md). It reuses `horizon-relay::limits` and `horizon_friends::{wire, deadline}` and touches no game code. Verified so far: - 12 tests: handshake parsing (a 26.3 status handshake byte for byte, legacy ping, HTTP, oversized and truncated frames), routing, names, two hosts behind one gateway with the exact handshake and 1 MiB both ways, unknown and offline names, claims, admission keys, trickled openings, `/health`. Clippy `-D warnings` and rustfmt are clean. - By hand, with the domain `mc.localhost` on loopback in front of a Horizon dedicated server (nightly d91cab6): - a vanilla-protocol server list ping of `pullmon.mc.localhost:25590` returned the server's own status and the pong; - `nobody.mc.localhost` got the gateway's "No world has this address"; - a **Horizon client** joined `pullmon.mc.localhost:25590` (the server logged `Alice joined the game`) and chat went both ways. It's about 1,200 lines of non-test code, too big for one PR. If you want it, I'd split it: (1) handshake parsing and routing, (2) the gateway server, (3) the agent, CLI and docs. ## Which shape would you accept? 1. **A tool only:** `horizon-gateway` in the repo like `horizon-relay`, documented, with no game or launcher changes. Players run `expose` next to `horizon-server` or a LAN world. 2. **1 + `horizon-server`:** a `[public_address]` table in `server.toml` (gateway, name, claim, key), and the supervisor keeps the agent running. 3. **1 + 2 + the game:** with a gateway configured (`friendsGateway:`, off by default), Play with Friends also shows a "Public address" row. It would carry a plain warning about what the operator can see in offline mode, and could be online-mode only. 4. **Not in this repo:** it fits better as an outside project. I'd also value your views on: - a separate crate, or an optional Minecraft listener inside `horizon-relay` (one binary for operators); - whether the name rules, the 24 h claim and the default caps look right. I'll `/claim` this to keep the prototype linked, and I'll hold everything else until you pick a shape.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2026):

🤖 Claims: refused, comment by apeirss AI agent Claude Code Claude Opus 5.5 not isn't understood here. Use /claim or /unclaim (the trusted reviewers: /unclaim @login). (asked by @apeirs)

<!-- gh-comment-id:6566637195 --> @github-actions[bot] commented on GitHub (Nov 2, 2026): 🤖 Claims: refused, `comment by apeirss AI agent Claude Code Claude Opus 5.5 not` isn't understood here. Use `/claim` or `/unclaim` (the trusted reviewers: `/unclaim @login`). (asked by @apeirs)
Author
Owner

@apeirs commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6566644267 --> @apeirs commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2171
No description provided.