[PR #1578] [MERGED] Resolve Minecraft DNS SRV redirects for server ping and login #3606

Closed
opened 2026-11-03 04:10:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1578
Author: @RVZO6
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @ludovic111

Base: main ← Head: fix/minecraft-srv-resolution


📝 Commits (2)

  • 83657f3 fix: resolve Minecraft DNS SRV redirects for ping and login
  • ff91907 SRV redirects: ask the name servers directly instead of hickory + tokio

📊 Changes

7 files changed (+553 additions, -5 deletions)

View changed files

📝 Cargo.lock (+43 -2)
📝 crates/horizon-client/src/net.rs (+8 -3)
📝 crates/horizon-protocol/Cargo.toml (+4 -0)
📝 crates/horizon-protocol/src/connection.rs (+13 -0)
📝 crates/horizon-protocol/src/lib.rs (+1 -0)
➕ crates/horizon-protocol/src/resolver.rs (+145 -0)
➕ crates/horizon-protocol/src/resolver/dns.rs (+339 -0)

📄 Description

What and why

Fix server status checks and connections for Minecraft hostnames that use DNS SRV redirects. For example, hypixel.net and minemen.club resolve to website endpoints through ordinary A/AAAA lookup; their _minecraft._tcp SRV records select the game endpoints. Horizon previously connected directly to the website addresses.

  • Add a Minecraft-specific Connection::connect_server path shared by status pings and login.
  • Resolve SRV at the default port (25565), including when that port is explicit; keep non-default ports, IP literals and localhost direct.
  • Use the system DNS configuration through Hickory, with a bounded query timeout. Missing records, query failures or resolver setup failures leave the original address in use.
  • Use the first SRV result and resolve its target directly, without recursive redirects or falling back when an advertised target cannot resolve.
  • Keep the original hostname and port in the status/login handshake for virtual-host routing. The redirect changes only the TCP destination.
  • Leave concrete friends-relay endpoints and generic Connection::connect callers unchanged.
  • Add six offline resolver/connection tests. Update Cargo.lock for Hickory and its dependencies.

Vanilla reference

Inspected the locally installed vanilla 26.3 bytecode with javap -p -c:

  • ServerRedirectHandler.createDnsSrvRedirectHandler / lookupRedirect: query SRV at port 25565, take the first record, and ignore lookup errors.
  • ServerNameResolver.resolveAddress: resolve the redirect target when one is supplied; do not fall back to the original destination if that target cannot resolve.

The unit tests cover redirect host/port selection, an original hostname without addresses, absent/failed lookup fallback, direct IP and non-default-port handling, fully qualified names, an unknown redirect target, and a loopback connection.

Self-check

  • Protocol unit tests: 78 passed, including six new resolver tests.
  • Protocol Clippy (--lib --tests --locked -- -D warnings): passed.
  • Client unit/binary/integration tests: 1,184 passed.
  • Workspace self-check tests: 1,939 passed; doc tests: 1 passed.
  • Manual live test through the patched Connection::connect_server: both hypixel.net and minemen.club returned Minecraft status responses using the original hostname in the handshake. No Microsoft account, session token or real player data was used. This verifies DNS/TCP/status, not a complete authenticated game join.

The full self-check is not fully green: Rust 1.98 Clippy reports an existing clippy::boxed_local warning in the unchanged crates/horizon-client/src/streaming.rs:644 (receive_decorated). This PR does not change or suppress it. Vanilla parity harnesses were not run locally.

pr_ready (tools/pr_ready.py --quick on [redacted], against origin/main at 7fca3c2f9, 1 min 43 s)

Check Result
Scope ✅ 6 files, +467 −8
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (4 s)
clippy ❌ failed (35 s)
tests: workspace ✅ 1939 passed (1 min 0 s)
doc tests ✅ 1 passed (3 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Screenshots

No layout change. This fixes network destination resolution; offline tests and live status checks are listed above.

🤖 Generated with OpenAI 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/1578 **Author:** [@RVZO6](https://github.com/RVZO6) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/minecraft-srv-resolution` --- ### 📝 Commits (2) - [`83657f3`](https://github.com/horizon-rust/horizon/commit/83657f3bbf60fdbe2a059b16139ab798ea442e78) fix: resolve Minecraft DNS SRV redirects for ping and login - [`ff91907`](https://github.com/horizon-rust/horizon/commit/ff919070575473b46f47e0ec206bcdde585b4b1a) SRV redirects: ask the name servers directly instead of hickory + tokio ### 📊 Changes **7 files changed** (+553 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+43 -2) 📝 `crates/horizon-client/src/net.rs` (+8 -3) 📝 `crates/horizon-protocol/Cargo.toml` (+4 -0) 📝 `crates/horizon-protocol/src/connection.rs` (+13 -0) 📝 `crates/horizon-protocol/src/lib.rs` (+1 -0) ➕ `crates/horizon-protocol/src/resolver.rs` (+145 -0) ➕ `crates/horizon-protocol/src/resolver/dns.rs` (+339 -0) </details> ### 📄 Description ## What and why Fix server status checks and connections for Minecraft hostnames that use DNS SRV redirects. For example, `hypixel.net` and `minemen.club` resolve to website endpoints through ordinary A/AAAA lookup; their `_minecraft._tcp` SRV records select the game endpoints. Horizon previously connected directly to the website addresses. - Add a Minecraft-specific `Connection::connect_server` path shared by status pings and login. - Resolve SRV at the default port (25565), including when that port is explicit; keep non-default ports, IP literals and localhost direct. - Use the system DNS configuration through Hickory, with a bounded query timeout. Missing records, query failures or resolver setup failures leave the original address in use. - Use the first SRV result and resolve its target directly, without recursive redirects or falling back when an advertised target cannot resolve. - Keep the original hostname and port in the status/login handshake for virtual-host routing. The redirect changes only the TCP destination. - Leave concrete friends-relay endpoints and generic `Connection::connect` callers unchanged. - Add six offline resolver/connection tests. Update Cargo.lock for Hickory and its dependencies. ## Vanilla reference Inspected the locally installed vanilla 26.3 bytecode with `javap -p -c`: - `ServerRedirectHandler.createDnsSrvRedirectHandler` / `lookupRedirect`: query SRV at port 25565, take the first record, and ignore lookup errors. - `ServerNameResolver.resolveAddress`: resolve the redirect target when one is supplied; do not fall back to the original destination if that target cannot resolve. The unit tests cover redirect host/port selection, an original hostname without addresses, absent/failed lookup fallback, direct IP and non-default-port handling, fully qualified names, an unknown redirect target, and a loopback connection. ## Self-check - Protocol unit tests: **78 passed**, including six new resolver tests. - Protocol Clippy (`--lib --tests --locked -- -D warnings`): **passed**. - Client unit/binary/integration tests: **1,184 passed**. - Workspace self-check tests: **1,939 passed**; doc tests: **1 passed**. - Manual live test through the patched `Connection::connect_server`: both `hypixel.net` and `minemen.club` returned Minecraft status responses using the original hostname in the handshake. No Microsoft account, session token or real player data was used. This verifies DNS/TCP/status, not a complete authenticated game join. The full self-check is not fully green: Rust 1.98 Clippy reports an existing `clippy::boxed_local` warning in the unchanged `crates/horizon-client/src/streaming.rs:644` (`receive_decorated`). This PR does not change or suppress it. Vanilla parity harnesses were not run locally. **pr_ready** (`tools/pr_ready.py --quick` on [redacted], against origin/main at 7fca3c2f9, 1 min 43 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +467 −8 | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (4 s) | | clippy | ❌ failed (35 s) | | tests: workspace | ✅ 1939 passed (1 min 0 s) | | doc tests | ✅ 1 passed (3 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ## Screenshots No layout change. This fixes network destination resolution; offline tests and live status checks are listed above. 🤖 Generated with [OpenAI 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 04:10:46 +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#3606
No description provided.