support regex and player name sniff
This commit is contained in:
@@ -36,8 +36,9 @@ A client opens a **control session** to the hub: it sends a Minecraft handshake
|
||||
with `Intent = 17` and a `Server Address` equal to `hex(SHA3-224(PSK))`, then
|
||||
the link switches to ChaCha20-encrypted frames keyed by the shared **PSK**,
|
||||
re-keyed to a per-connection secret. Over that session the client **registers**
|
||||
one or more hostname patterns. When a player connects to the hub with a matching
|
||||
hostname (and any normal `Intent`), the hub assigns a random **CID**, buffers
|
||||
one or more hostname patterns — each a **regular expression**. When a player
|
||||
connects to the hub with a hostname that matches a registered pattern (and any
|
||||
normal `Intent`), the hub assigns a random **CID**, buffers
|
||||
the player's bytes, and asks the client (via the control session) to take over.
|
||||
The client picks a **worker connection** — a multiplexed, encrypted TCP link
|
||||
that carries many players as lightweight *streams* — opens a stream for that CID,
|
||||
@@ -114,7 +115,7 @@ cp client/config.example.json client.json
|
||||
# "psk": "same-as-the-hub",
|
||||
# "maxConn": 4,
|
||||
# "mappings": [
|
||||
# { "pattern": "mc.example.com", "destination": "127.0.0.1:25566", "proxyProtocol": true }
|
||||
# { "pattern": "mc\\.example\\.com", "destination": "127.0.0.1:25566", "proxyProtocol": true }
|
||||
# ]
|
||||
# }
|
||||
bin/redapricot-client client.json
|
||||
@@ -122,8 +123,8 @@ bin/redapricot-client client.json
|
||||
|
||||
**3. Connect a player.** Point a DNS record for `mc.example.com` at the hub (or
|
||||
just add the hub's IP with that hostname), then join `mc.example.com` in
|
||||
Minecraft. The hub matches the pattern and tunnels you to `127.0.0.1:25566`
|
||||
behind the client. With `proxyProtocol: true`, the real server sees your true IP
|
||||
Minecraft. The hub matches the hostname against the registered regex patterns
|
||||
and tunnels you to `127.0.0.1:25566` behind the client. With `proxyProtocol: true`, the real server sees your true IP
|
||||
(enable `proxy-protocol` / a compatible front-end on that server to consume it).
|
||||
|
||||
## Container image (client)
|
||||
@@ -172,7 +173,7 @@ secrets. The base image and build flags live in `.ko.yaml`.
|
||||
| `maxConn` | `1` (clamped 1–8) | Max worker connections in the pool. |
|
||||
| `pingIntervalMs` | `20000` | Control-session keepalive interval. |
|
||||
| `mappings[]` | *(≥1 required)* | Route table (below). |
|
||||
| `mappings[].pattern` | — | Hostname players use (matched case-insensitively). |
|
||||
| `mappings[].pattern` | — | Regex matched against the whole player hostname, case-insensitively. Escape dots (`mc\.example\.com`); `.` is a wildcard. |
|
||||
| `mappings[].destination` | — | Real server `host:port` to forward to. |
|
||||
| `mappings[].proxyProtocol` | `false` | Prepend a HAProxy v2 header carrying the player's IP. |
|
||||
|
||||
@@ -197,7 +198,8 @@ go test ./e2e/... -v
|
||||
```
|
||||
|
||||
The e2e suite covers: a full player round-trip with verbatim handshake
|
||||
forwarding and case-insensitive matching, multi-megabyte transfers, concurrent
|
||||
forwarding and case-insensitive matching, regex wildcard pattern routing,
|
||||
multi-megabyte transfers, concurrent
|
||||
streams spreading across multiple worker connections, HAProxy v2 source-address
|
||||
propagation, player- and destination-initiated disconnect propagation, wrong-PSK
|
||||
rejection, and dropping of unmatched hostnames. The Go and Java crypto layers are
|
||||
|
||||
Reference in New Issue
Block a user