[PR #4976] [MERGED] horizon-server: Velocity modern forwarding behind a proxy (#4963) #5984

Closed
opened 2026-11-03 05:16:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4976
Author: @Detimes
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: feature-4963-velocity-forwarding


📝 Commits (1)

  • 5b25371 horizon-server: Velocity modern forwarding behind a proxy (#4963)

📊 Changes

7 files changed (+599 additions, -16 deletions)

View changed files

📝 crates/horizon-client/src/game/dedicated.rs (+33 -0)
📝 crates/horizon-client/src/lan/conn.rs (+90 -16)
➕ crates/horizon-client/src/lan/forwarding.rs (+231 -0)
📝 crates/horizon-client/src/lan/mod.rs (+5 -0)
📝 docs/hosting.md (+16 -0)
➕ docs/velocity-forwarding.md (+48 -0)
➕ tools/velocity_forwarding_probe.py (+176 -0)

📄 Description

🤖 Opened by Detimes's AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally.

What and why

Fixes #4963. A dedicated server can now sit behind a Velocity proxy that does the Microsoft login (modern player information forwarding).

  • A file forwarding.secret in the server folder turns it on, like the proxy's own file. No file: nothing changes.
  • On an offline server (online-mode=false) the login asks the proxy on velocity:player_info, checks the HMAC-SHA256 signature with the secret, and joins the player with the forwarded UUID, name, properties and address.
  • A login that doesn't answer (a client connecting directly), is signed with another secret, forwards another version, has a bad address or trailing bytes, is refused ("This server is behind a proxy: join through the proxy."); the reason goes to the log as a warning.
  • With the file and online-mode=true the file is ignored with a warning; an empty or unreadable file stops the start (an empty secret could be signed by anyone).
  • Docs: a section in docs/hosting.md, and docs/velocity-forwarding.md with the exchange.

Only original code. Velocity's docs cover the configuration only, not the wire format. I worked the format out by recording a real Velocity 4.3.1 (offline, modern forwarding) with a stand-in backend, tools/velocity_forwarding_probe.py, and wrote docs/velocity-forwarding.md from the recordings; the signature checks on every one. I did not read Velocity's, Paper's or any other project's source. One thing to know, as said in #4963: a web search made while planning returned pages of such source plus a summary of their general shape (a signature followed by the player's data); I did not open those pages. Tell me if you want it done differently.

Not observed: non-empty properties (an offline proxy forwards none). Their encoding follows login::Property and is covered by a unit test built from that layout only; a proxy that forwards a skin would settle it.

Kind

  • extra: Horizon-only, off by default

Vanilla reference

Horizon-only: vanilla has no forwarding, so there is no vanilla class to follow and no parity harness. It touches serve_login (LAN/dedicated login in crates/horizon-client/src/lan/conn.rs) only on an offline server with forwarding.secret.

Self-check

Checked end to end with the built horizon-client --dedicated on real prepared 26.3 files, behind a real Velocity 4.3.1:

  • through the proxy: the login completes and the server logs the forwarded UUID;
  • the probe as a stand-in proxy with the right secret: the player joins as the forwarded name and UUID (Forged (1111…)), not the name it logged in with;
  • with another secret: refused, reason in the log; a plain client connecting directly: refused with the message above.

Scope: 551 lines of code, about 130 of them tests, plus docs and the probe tool. It is one feature, so I left it whole; I can split it (the forwarding.rs module with its docs, then the wiring) if you prefer.

pr_ready (tools/pr_ready.py --quick --base upstream/main, against upstream/main at 4de90a13d, 6 min 28 s)

Check Result
Scope ⚠️ 7 files, +599 −16; 551 lines of code
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed
rustfmt ✅
clippy ✅
tests: horizon-client ❌ 921 passed, 1 failed: motion::tests::a_swimming_passenger_sits_up_even_when_standing_does_not_fit
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

The failing test is not from this change: it fails the same way on a clean upstream/main (4de90a13d) with my prepared 26.3 files (!w.can_fit_pose(Pose::Standing) at motion.rs:3940), and the 5 new lan::forwarding tests pass. I could not tell whether it depends on my local data.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4976 **Author:** [@Detimes](https://github.com/Detimes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feature-4963-velocity-forwarding` --- ### 📝 Commits (1) - [`5b25371`](https://github.com/horizon-rust/horizon/commit/5b253719128cc48ad2905ad5d1288d530db02ac1) horizon-server: Velocity modern forwarding behind a proxy (#4963) ### 📊 Changes **7 files changed** (+599 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/dedicated.rs` (+33 -0) 📝 `crates/horizon-client/src/lan/conn.rs` (+90 -16) ➕ `crates/horizon-client/src/lan/forwarding.rs` (+231 -0) 📝 `crates/horizon-client/src/lan/mod.rs` (+5 -0) 📝 `docs/hosting.md` (+16 -0) ➕ `docs/velocity-forwarding.md` (+48 -0) ➕ `tools/velocity_forwarding_probe.py` (+176 -0) </details> ### 📄 Description > 🤖 Opened by Detimes's AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally. ## What and why Fixes #4963. A dedicated server can now sit behind a Velocity proxy that does the Microsoft login (modern player information forwarding). - A file `forwarding.secret` in the server folder turns it on, like the proxy's own file. No file: nothing changes. - On an offline server (`online-mode=false`) the login asks the proxy on `velocity:player_info`, checks the HMAC-SHA256 signature with the secret, and joins the player with the forwarded UUID, name, properties and address. - A login that doesn't answer (a client connecting directly), is signed with another secret, forwards another version, has a bad address or trailing bytes, is refused ("This server is behind a proxy: join through the proxy."); the reason goes to the log as a warning. - With the file and `online-mode=true` the file is ignored with a warning; an empty or unreadable file stops the start (an empty secret could be signed by anyone). - Docs: a section in `docs/hosting.md`, and `docs/velocity-forwarding.md` with the exchange. **Only original code.** Velocity's docs cover the configuration only, not the wire format. I worked the format out by recording a real Velocity 4.3.1 (offline, modern forwarding) with a stand-in backend, `tools/velocity_forwarding_probe.py`, and wrote `docs/velocity-forwarding.md` from the recordings; the signature checks on every one. I did not read Velocity's, Paper's or any other project's source. One thing to know, as said in #4963: a web search made while planning returned pages of such source plus a summary of their general shape (a signature followed by the player's data); I did not open those pages. Tell me if you want it done differently. **Not observed:** non-empty `properties` (an offline proxy forwards none). Their encoding follows `login::Property` and is covered by a unit test built from that layout only; a proxy that forwards a skin would settle it. ## Kind - [x] extra: Horizon-only, off by default ## Vanilla reference Horizon-only: vanilla has no forwarding, so there is no vanilla class to follow and no parity harness. It touches `serve_login` (`LAN`/dedicated login in `crates/horizon-client/src/lan/conn.rs`) only on an offline server with `forwarding.secret`. ## Self-check Checked end to end with the built `horizon-client --dedicated` on real prepared 26.3 files, behind a real Velocity 4.3.1: - through the proxy: the login completes and the server logs the forwarded UUID; - the probe as a stand-in proxy with the right secret: the player joins as the forwarded name and UUID (`Forged (1111…)`), not the name it logged in with; - with another secret: refused, reason in the log; a plain client connecting directly: refused with the message above. Scope: 551 lines of code, about 130 of them tests, plus docs and the probe tool. It is one feature, so I left it whole; I can split it (the `forwarding.rs` module with its docs, then the wiring) if you prefer. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main`, against upstream/main at 4de90a13d, 6 min 28 s) | Check | Result | | --- | --- | | Scope | ⚠️ 7 files, +599 −16; 551 lines of code | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ❌ 921 passed, 1 failed: `motion::tests::a_swimming_passenger_sits_up_even_when_standing_does_not_fit` | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | The failing test is not from this change: it fails the same way on a clean `upstream/main` (4de90a13d) with my prepared 26.3 files (`!w.can_fit_pose(Pose::Standing)` at `motion.rs:3940`), and the 5 new `lan::forwarding` tests pass. I could not tell whether it depends on my local data. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:24 +07:00
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#5984
No description provided.