[PR #5096] [MERGED] Fix Velocity forced-host routing after SRV redirects #6070

Closed
opened 2026-11-03 06:11:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5096
Author: @oskal675-design
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/srv-login-handshake


📝 Commits (1)

  • 90d02c5 Use the SRV target address in login handshakes

📊 Changes

5 files changed (+200 additions, -20 deletions)

View changed files

📝 crates/horizon-client/src/net.rs (+39 -9)
📝 crates/horizon-protocol/src/connection.rs (+14 -4)
📝 crates/horizon-protocol/src/resolver.rs (+50 -7)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerAddressOracle.java (+45 -0)
➕ tools/test_server_address_parity.py (+52 -0)

📄 Description

🤖 Opened by oskal675-design's AI agent (Codex, GPT-6.1), not by oskal675-design personally.

What and why

Fixes #4471. When a Minecraft address has an SRV redirect, Horizon connects to its target but sends the original hostname and port in the login handshake. Velocity consequently selects its default backend instead of the backend configured for the redirected hostname in forced-hosts.

Carry the resolved hostname and port alongside the TCP connection and use them for login, including transfers. Status pings continue to send the original address, as vanilla does. Friends' concrete tunnel endpoints continue to bypass SRV resolution.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players
  • extra: Horizon-only, off by default
  • tooling
  • docs

Vanilla reference

Read the pinned 26.3 bytecode of ConnectScreen$1.run (the connection thread started by ConnectScreen.connect), ServerNameResolver.resolveAddress, ServerAddressResolver.SYSTEM, and ServerStatusPinger.pingServer.

Login passes the resolved InetSocketAddress.getHostName() and getPort() to Connection.initiateServerboundPlayConnection; status uses ServerAddress.getHost() and getPort() instead. tools/test_server_address_parity.py compares direct, redirected and explicit-port addresses against the real vanilla resolver with deterministic address/redirect providers.

Other projects' code

none. Velocity 4.3.1 was run as a binary for the integration check; its source was not read or copied.

Self-check

pr_ready (tools/pr_ready.py --quick on omarchy, against origin/main at 13ce6bcc6, 2 min 58 s)

Check Result
Scope ✅ 5 files, +200 −20
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (20 s)
rustfmt ✅ (5 s)
clippy ✅ (14 s)
tests: horizon-client, horizon-protocol ✅ 1488 passed (2 min 13 s)
doc tests ✅ 0 passed (3 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 313 affected, to run in CI (--quick): block_removal, block_survival, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen, chest_pair, chorus_plant and 301 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Additional validation:

  • python3 tools/parity.py server_address online_mode: both pass; 3 address cases and 43 online-mode checks.
  • Real Horizon client, isolated DNS server and TCP listener: before the fix the login handshake contains play.horizon.test:25565; afterwards it contains the SRV target and its actual port.
  • Real Velocity 4.3.1 with a default backend and a forced-hosts backend: the original client selects the default backend; the patched client selects the forced backend.
  • Direct-hostname, read-timeout, cookie, transfer and reconfiguration network unit tests pass.

The self-check runs in an isolated network namespace. Outside it this machine accepts TCP connections to the TEST-NET address that a_dead_address_does_not_hold_up_the_next expects to be unreachable; that test fails on clean main as well. Isolation restores its intended network conditions.

🤖 Generated with Codex.


🔄 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/5096 **Author:** [@oskal675-design](https://github.com/oskal675-design) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/srv-login-handshake` --- ### 📝 Commits (1) - [`90d02c5`](https://github.com/horizon-rust/horizon/commit/90d02c5fff4aec915e65d7f9042a903ce0a065d3) Use the SRV target address in login handshakes ### 📊 Changes **5 files changed** (+200 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/net.rs` (+39 -9) 📝 `crates/horizon-protocol/src/connection.rs` (+14 -4) 📝 `crates/horizon-protocol/src/resolver.rs` (+50 -7) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerAddressOracle.java` (+45 -0) ➕ `tools/test_server_address_parity.py` (+52 -0) </details> ### 📄 Description > 🤖 Opened by oskal675-design's AI agent (Codex, GPT-6.1), not by oskal675-design personally. ## What and why Fixes #4471. When a Minecraft address has an SRV redirect, Horizon connects to its target but sends the original hostname and port in the login handshake. Velocity consequently selects its default backend instead of the backend configured for the redirected hostname in `forced-hosts`. Carry the resolved hostname and port alongside the TCP connection and use them for login, including transfers. Status pings continue to send the original address, as vanilla does. Friends' concrete tunnel endpoints continue to bypass SRV resolution. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players - [ ] extra: Horizon-only, off by default - [ ] tooling - [ ] docs ## Vanilla reference Read the pinned 26.3 bytecode of `ConnectScreen$1.run` (the connection thread started by `ConnectScreen.connect`), `ServerNameResolver.resolveAddress`, `ServerAddressResolver.SYSTEM`, and `ServerStatusPinger.pingServer`. Login passes the resolved `InetSocketAddress.getHostName()` and `getPort()` to `Connection.initiateServerboundPlayConnection`; status uses `ServerAddress.getHost()` and `getPort()` instead. `tools/test_server_address_parity.py` compares direct, redirected and explicit-port addresses against the real vanilla resolver with deterministic address/redirect providers. ## Other projects' code none. Velocity 4.3.1 was run as a binary for the integration check; its source was not read or copied. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on omarchy, against origin/main at 13ce6bcc6, 2 min 58 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +200 −20 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (20 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (14 s) | | tests: horizon-client, horizon-protocol | ✅ 1488 passed (2 min 13 s) | | doc tests | ✅ 0 passed (3 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 313 affected, to run in CI (--quick): block_removal, block_survival, bundle_weight, camera, canyon_carver, carving_geometry, carving_mask, cauldron, cave_carver, chat_screen, chest_pair, chorus_plant and 301 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Additional validation: - `python3 tools/parity.py server_address online_mode`: both pass; 3 address cases and 43 online-mode checks. - Real Horizon client, isolated DNS server and TCP listener: before the fix the login handshake contains `play.horizon.test:25565`; afterwards it contains the SRV target and its actual port. - Real Velocity 4.3.1 with a default backend and a `forced-hosts` backend: the original client selects the default backend; the patched client selects the forced backend. - Direct-hostname, read-timeout, cookie, transfer and reconfiguration network unit tests pass. The self-check runs in an isolated network namespace. Outside it this machine accepts TCP connections to the TEST-NET address that `a_dead_address_does_not_hold_up_the_next` expects to be unreachable; that test fails on clean main as well. Isolation restores its intended network conditions. 🤖 Generated with [Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:11:23 +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#6070
No description provided.