[PR #3201] [CLOSED] Add experimental network packet API for client mods #4844

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3201
Author: @damnurmum
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: feat/network-mod-protocol-translation


📝 Commits (5)

  • d1cdb17 Add experimental network packet API for client mods
  • 75a6252 Merge main into network mod API
  • 7863471 Propagate outbound packet translation failures
  • de1bcb8 Keep reconfiguration acknowledgement atomic with phase flag
  • f8eaf70 Merge branch 'main' into feat/network-mod-protocol-translation

📊 Changes

17 files changed (+871 additions, -76 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client/src/game.rs (+5 -1)
📝 crates/horizon-client/src/game/remote.rs (+31 -3)
📝 crates/horizon-client/src/net.rs (+263 -30)
📝 crates/horizon-mod-sdk/src/lib.rs (+45 -0)
📝 crates/horizon-mod-sdk/wit/horizon.wit (+22 -0)
📝 crates/horizon-mods/Cargo.toml (+2 -1)
📝 crates/horizon-mods/src/manifest.rs (+12 -2)
📝 crates/horizon-mods/src/runtime.rs (+215 -27)
📝 crates/horizon-mods/tests/guest/src/lib.rs (+17 -1)
📝 crates/horizon-mods/tests/sandbox.rs (+46 -1)
📝 crates/horizon-protocol/Cargo.toml (+3 -1)
📝 crates/horizon-protocol/src/connection.rs (+149 -6)
📝 crates/horizon-protocol/src/crypto.rs (+11 -1)
📝 crates/horizon-protocol/src/resolver/dns.rs (+1 -1)
📝 docs/api/mods-reference.md (+37 -1)
📝 docs/mods.md (+11 -0)

📄 Description

🤖 Opened by contributor damnurmum's AI agent (OpenAI Codex), not by the contributor personally.

What and why

Add an experimental network capability for client .hmod mods. A mod can inspect, drop, replace, or expand complete packet bodies after decryption and decompression and before Horizon's packet codec. The host supplies packet phase and direction, creates separate Wasm state for each remote connection, and limits packet size, output count, memory, and instruction fuel. A translation failure closes the connection with a diagnostic.

The client accepts --target-version VERSION and passes the choice to network mods. Translated connections and status pings use the same packet hook. Connections without a network mod keep the existing direct path.

This PR contains the general API and a test guest. It does not include the Java Edition 26.2 bridge mod, its mapping tables, a built-in translator, or the per-server version selector. The bridge work is preserved separately in damnurmum:feat/version-bridge-26-2 for a follow-up PR. Additional Java versions can be added to that mod in stages without adding version-specific code to the client API.

If this API is accepted, the follow-up will propose an experimental Rust .hmod version bridge aimed at ViaFabricPlus-like cross-version joining. The current bridge handles 26.2; support for older versions is being added and tested one version at a time. This PR does not claim parity with ViaFabricPlus.

Verification

  • cargo check -p horizon-client --features mods -p horizon-mods --features runtime,pack: passed.
  • cargo test -p horizon-mods --features runtime,pack --test sandbox network_hook_selects_versions_and_keeps_connection_state: passed; exercises the actual Wasm hook and independent connection state.
  • No game server was contacted for this API-only change.

Self-check

pr_ready (tools/pr_ready.py --base origin/main --quick on MacBook-Air-Pavel, against origin/main at b6c936f82, 7 min 29 s)

Check Result
Scope ⚠️ 17 files, +745 −50; 681 lines of code: over 500, split if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ✅ 398 passed (27 s)
rustfmt ✅ (4 s)
clippy ✅ (51 s)
tests: workspace ✅ 2335 passed (3 min 6 s)
doc tests ✅ 2 passed (23 s)
content root tests ✅ 5 passed (23 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (52 s)
launcher tests ✅ 205 passed (1 min 22 s)
Parity ➖ 348 affected, to run in CI (--quick)
Label player-facing: feature if players get something new, no label for a fix

🤖 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/3201 **Author:** [@damnurmum](https://github.com/damnurmum) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/network-mod-protocol-translation` --- ### 📝 Commits (5) - [`d1cdb17`](https://github.com/horizon-rust/horizon/commit/d1cdb17105fb28b644b818e230833e04df2c17bb) Add experimental network packet API for client mods - [`75a6252`](https://github.com/horizon-rust/horizon/commit/75a62524239e9ea5f9c2f267af47656cb32ba766) Merge main into network mod API - [`7863471`](https://github.com/horizon-rust/horizon/commit/786347159239a7b2f303985509f36b327bd0af63) Propagate outbound packet translation failures - [`de1bcb8`](https://github.com/horizon-rust/horizon/commit/de1bcb8b2472ac0a3304de37f54fd9ef2fb36e10) Keep reconfiguration acknowledgement atomic with phase flag - [`f8eaf70`](https://github.com/horizon-rust/horizon/commit/f8eaf70eafc7fbe5c5b8053ab987f92a8da620d9) Merge branch 'main' into feat/network-mod-protocol-translation ### 📊 Changes **17 files changed** (+871 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client/src/game.rs` (+5 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+31 -3) 📝 `crates/horizon-client/src/net.rs` (+263 -30) 📝 `crates/horizon-mod-sdk/src/lib.rs` (+45 -0) 📝 `crates/horizon-mod-sdk/wit/horizon.wit` (+22 -0) 📝 `crates/horizon-mods/Cargo.toml` (+2 -1) 📝 `crates/horizon-mods/src/manifest.rs` (+12 -2) 📝 `crates/horizon-mods/src/runtime.rs` (+215 -27) 📝 `crates/horizon-mods/tests/guest/src/lib.rs` (+17 -1) 📝 `crates/horizon-mods/tests/sandbox.rs` (+46 -1) 📝 `crates/horizon-protocol/Cargo.toml` (+3 -1) 📝 `crates/horizon-protocol/src/connection.rs` (+149 -6) 📝 `crates/horizon-protocol/src/crypto.rs` (+11 -1) 📝 `crates/horizon-protocol/src/resolver/dns.rs` (+1 -1) 📝 `docs/api/mods-reference.md` (+37 -1) 📝 `docs/mods.md` (+11 -0) </details> ### 📄 Description > 🤖 Opened by contributor damnurmum's AI agent (OpenAI Codex), not by the contributor personally. ## What and why Add an experimental `network` capability for client `.hmod` mods. A mod can inspect, drop, replace, or expand complete packet bodies after decryption and decompression and before Horizon's packet codec. The host supplies packet phase and direction, creates separate Wasm state for each remote connection, and limits packet size, output count, memory, and instruction fuel. A translation failure closes the connection with a diagnostic. The client accepts `--target-version VERSION` and passes the choice to network mods. Translated connections and status pings use the same packet hook. Connections without a network mod keep the existing direct path. This PR contains the general API and a test guest. It does **not** include the Java Edition 26.2 bridge mod, its mapping tables, a built-in translator, or the per-server version selector. The bridge work is preserved separately in `damnurmum:feat/version-bridge-26-2` for a follow-up PR. Additional Java versions can be added to that mod in stages without adding version-specific code to the client API. If this API is accepted, the follow-up will propose an experimental Rust `.hmod` version bridge aimed at ViaFabricPlus-like cross-version joining. The current bridge handles 26.2; support for older versions is being added and tested one version at a time. This PR does not claim parity with ViaFabricPlus. ## Verification - `cargo check -p horizon-client --features mods -p horizon-mods --features runtime,pack`: passed. - `cargo test -p horizon-mods --features runtime,pack --test sandbox network_hook_selects_versions_and_keeps_connection_state`: passed; exercises the actual Wasm hook and independent connection state. - No game server was contacted for this API-only change. ## Self-check **pr_ready** (`tools/pr_ready.py --base origin/main --quick` on MacBook-Air-Pavel, against origin/main at b6c936f82, 7 min 29 s) | Check | Result | | --- | --- | | Scope | ⚠️ 17 files, +745 −50; 681 lines of code: over 500, split if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ✅ 398 passed (27 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (51 s) | | tests: workspace | ✅ 2335 passed (3 min 6 s) | | doc tests | ✅ 2 passed (23 s) | | content root tests | ✅ 5 passed (23 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (52 s) | | launcher tests | ✅ 205 passed (1 min 22 s) | | Parity | ➖ 348 affected, to run in CI (`--quick`) | | Label | player-facing: `feature` if players get something new, no label for a fix | 🤖 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 05:08:21 +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#4844
No description provided.