add minecraft protocol

This commit is contained in:
InkerBot
2026-03-05 15:48:45 +08:00
parent daba0d704e
commit 66ded37577
16 changed files with 2447 additions and 8 deletions
@@ -0,0 +1,55 @@
--- /dev/null
+++ b/docs/configuration/outbound/minecraft.md
@@ -0,0 +1,52 @@
+### Structure
+
+```json
+{
+ "type": "minecraft",
+ "tag": "mc-out",
+
+ "server": "mc.example.com",
+ "server_port": 25565,
+ "username": "Steve",
+ "password": "my-secret-password",
+
+ ... // Dialer Fields
+}
+```
+
+### Dialer Fields
+
+See [Dialer Fields](/configuration/shared/dialer/) for details.
+
+### Fields
+
+#### server
+
+==Required==
+
+The Minecraft server address.
+
+#### server_port
+
+The Minecraft server port. Defaults to `25565`.
+
+#### username
+
+The username to authenticate with. Defaults to `Steve`.
+
+#### password
+
+The password to authenticate with.
+
+### Description
+
+The Minecraft outbound connects to a Minecraft inbound and tunnels traffic through the Minecraft Java Edition protocol.
+
+The connection flow is:
+
+1. Outbound connects to the server and sends a Minecraft handshake + login start
+2. Server responds with an encryption request (RSA public key + verify token)
+3. Outbound derives the shared secret from `SHA-256(password + verify_token)[:16]` and sends an encryption response
+4. Both sides switch to AES/CFB8 encryption using the derived shared secret
+5. After receiving login success, smux multiplexing is established over the encrypted connection
+6. Each smux stream carries a 1-byte command (`0x01` for TCP, `0x03` for UDP) followed by a SOCKS address header
@@ -0,0 +1,55 @@
--- /dev/null
+++ b/docs/configuration/outbound/minecraft.zh.md
@@ -0,0 +1,52 @@
+### 结构
+
+```json
+{
+ "type": "minecraft",
+ "tag": "mc-out",
+
+ "server": "mc.example.com",
+ "server_port": 25565,
+ "username": "Steve",
+ "password": "my-secret-password",
+
+ ... // 拨号字段
+}
+```
+
+### 拨号字段
+
+详见 [拨号字段](/configuration/shared/dialer/)。
+
+### 字段
+
+#### server
+
+==必填==
+
+Minecraft 服务器地址。
+
+#### server_port
+
+Minecraft 服务器端口,默认为 `25565`。
+
+#### username
+
+认证使用的用户名,默认为 `Steve`。
+
+#### password
+
+认证使用的密码。
+
+### 说明
+
+Minecraft 出站连接至 Minecraft 入站,通过 Minecraft Java Edition 协议隧道传输流量。
+
+连接流程:
+
+1. 出站连接至服务器,发送 Minecraft 握手包和登录开始包
+2. 服务端回复加密请求(RSA 公钥 + 验证令牌)
+3. 出站通过 `SHA-256(password + verify_token)[:16]` 派生共享密钥,发送加密响应
+4. 双方切换至使用派生共享密钥的 AES/CFB8 加密
+5. 收到登录成功后,在加密连接上建立 smux 多路复用
+6. 每个 smux 流携带 1 字节命令(`0x01` 表示 TCP`0x03` 表示 UDP)加 SOCKS 地址头