Go proxy that sits in front of Bedrock Dedicated Server
  • Go 99.6%
  • Shell 0.3%
  • Dockerfile 0.1%
Find a file
Smell of curry ad767c5af8
All checks were successful
golangci-lint / Lint Dockerfile. (push) Successful in 13s
Build and Release / Build GoBDS (push) Has been skipped
golangci-lint / lint (push) Successful in 1m17s
Record downstream gameplay sessions at the proxy
Report production world sessions to the website ingest so staff analytics can measure play.
2026-12-05 04:04:19 +00:00
.github/workflows Point Forgejo release Docker at the runner DinD daemon. 2026-09-16 18:53:38 -04:00
docs README: show where packets stop, and how a session runs 2026-10-31 16:08:08 -04:00
gobds Record downstream gameplay sessions at the proxy 2026-12-05 04:04:19 +00:00
policy Add claim proxy, traffic protection, session fixes (#81) 2026-07-16 11:29:12 -04:00
scripts Point Forgejo release Docker at the runner DinD daemon. 2026-09-16 18:53:38 -04:00
.dockerignore feat(docker): added Docker to project (#44) 2026-01-26 18:22:25 -05:00
.gitignore Add claim proxy, traffic protection, session fixes (#81) 2026-07-16 11:29:12 -04:00
.golangci.yml build(deps): bump golangci/golangci-lint-action from 6 to 9 (#38) 2025-12-27 12:19:56 -05:00
.hadolint.yaml feat(docker): added Docker to project (#44) 2026-01-26 18:22:25 -05:00
AGENTS.md Update AGENTS.md 2026-10-27 19:02:14 -04:00
config.example.toml Honor the ping indicator configuration 2026-11-27 01:46:27 +00:00
docker-compose.yaml feat(docker): added Docker to project (#44) 2026-01-26 18:22:25 -05:00
Dockerfile Update Dockerfile 2026-06-27 21:32:55 -04:00
filterlog.go ci: support Go 1.26 linting (#77) 2026-07-10 14:14:34 -04:00
go.mod Refresh proxy dependencies and configuration codecs [Release] 2026-11-20 11:07:13 -05:00
go.sum Refresh proxy dependencies and configuration codecs [Release] 2026-11-20 11:07:13 -05:00
main.go fix: throttle backend-unreachable proxy log spam 2026-06-27 21:06:21 -04:00
README.md Record downstream gameplay sessions at the proxy 2026-12-05 04:04:19 +00:00
whitelist.example.json This reverts commit 9e782aed22. 2025-10-03 18:53:24 +01:00

gobds

A proxy in front of Minecraft Bedrock Dedicated Server. Players connect to gobds. gobds connects to BDS. Packets that should never reach the server are dropped here, before the Script API has to notice them.

Built on gophertunnel. One process can front several worlds. Built for PokeBedrock, and the config is just a list of listen addresses and backends.

flowchart LR
  client[Bedrock client]
  client -->|RakNet| proxy[gobds]
  client -->|NetherNet| proxy
  proxy -->|RakNet| bds[BDS]
  bds -->|world and script chat| proxy
  proxy -->|rewritten packets| client

The public port is gobds. BDS stays on loopback, or wherever RemoteAddress points. The server-list pong is the proxy's own session count and the capacity in config, so a backend with LAN visibility off still shows the right numbers.

Gameplay session reporting

Set GAME_SESSIONS_URL to the site's HTTPS ingest endpoint (for example, https://api.pokebedrock.com/internal/game-sessions), GAME_SESSIONS_TOKEN to its dedicated ingest credential, and GAME_SESSIONS_WORLDS to a comma-separated allowlist of production world names. The manager passes these environment variables to the fleet proxy only. Apply new settings by recreating the proxy container. Leave them unset on development and standalone proxies that should not report.

An authenticated player who finishes spawning on a configured world gets one session UUID. Disconnects and transfers end the connection on that world. A successful connection to a new world starts a new UUID under the same XUID. Only the UUID, XUID, world and observation times are sent. The hub and connections that fail before completing spawn are outside this measurement.

The proxy sends joins and disconnects in batches every five seconds and reports connected sessions and world coverage roughly once a minute, including for empty worlds. Failed deliveries retry in memory. Close records are retained for up to 24 hours with a cap of 10,000 per world. The game continues during a reporting outage. Graceful shutdown attempts one final flush. An abrupt proxy exit can lose unsent observations. The last delivered heartbeat bounds measured playtime when no disconnect arrives.

Why the packets stop here

The Script API runs after BDS has accepted an action, and some client actions never become a script event at all. gobds is on the wire.

A denied claim action is removed from the packet. A break or place outside the world border is removed too. Chunks outside that border are not forwarded. A hold-to-interact that repeats every tick is dropped, so the script engine does not pay for it. A melee swing at a painting, armor stand, or cushion inside a claim is stripped from the movement packet on 1.26.60, where that swing carries no entity id and the script entityHurt path never runs. The movement packet itself still goes through.

Claim data comes from an HTTP endpoint and is stored as an immutable snapshot. A snapshot older than MaxSnapshotAge fails open and the action is passed to BDS. A panic in the claim path fails open the same way. Pickup cannot be enforced here: Bedrock resolves item pickup on the server, and the client only hears about it afterwards.

Chat, commands, forms, and inventory have size caps. With [TrafficProtection] Enforce = true, rate excess is dropped. The default is observe and count.

What a session does

  1. The client joins the public listener. RakNet is always on. NetherNet (WebRTC, Bedrock 26.50 and later) is optional and sits beside it: signaling on the game port's TCP, ICE on UDPPort. Clients that fail ICE do not fall back inside this proxy. RakNet is a second listener, not a retry of the same join.
  2. Optional gates run before BDS is dialed: a VPN check, a hub authentication service ("join through the hub"), the whitelist, reserved slots for whitelisted names, and a duplicate-XUID reject.
  3. gobds dials BDS with that client's identity. Upstream transport defaults to RakNet. Transport = "nethernet" dials BDS over NetherNet instead, and RemoteAddress is then the BDS signaling address.
  4. Handled packets pass through a handler. Cancel means the other side never sees that packet. Everything else is forwarded.
  5. The behavior pack publishes its command catalog as chat, prefixed [PROXY_SYSTEM][COMMANDS]=. A catalog bigger than one Text packet is split into [PROXY_SYSTEM][COMMANDS:i/n]= chunks. gobds reassembles them, merges them into AvailableCommands, and drops the vanilla entry when a pack command uses the same name. Otherwise BDS runs vanilla.
  6. A pack command the client runs is forwarded to BDS as chat with a leading -, and the original command packet is cancelled. Vanilla commands the pack does not shadow pass through. me, tell, w, and msg are dropped.
  7. Disconnect removes the session. The advertised player count is the live set across every listener on that server, RakNet and NetherNet together.
sequenceDiagram
  participant Client
  participant Gobds
  participant BDS
  Client->>Gobds: join
  Gobds->>BDS: dial with the client's identity
  BDS-->>Gobds: "[PROXY_SYSTEM][COMMANDS]"
  Gobds-->>Client: AvailableCommands
  Client->>Gobds: break a claimed block
  Note over BDS: that packet never arrives
  Client->>Gobds: a pack command
  Gobds->>BDS: chat, leading "-"

Also on the session

Resource packs Served by the proxy from [[Resources.Packs]]. Clients do not receive BDS world packs. Each offer can require a minimum memory tier and a language. Filters are AND-ed. Tier 0 and an empty language match everyone. Index 0 is the highest priority.
Item runtime IDs Written to item-registry-<server>.json from the registry BDS sent. Add-on item IDs follow the host's directory order, so each machine's map is its own.
XUID BDS sees the proxy's connection. The player's XUID is delivered as encrypted chat, prefixed [PROXY_XUID], using [Encryption] Key.
Latency Forwarded to BDS as [PROXY_PING] <ms> when it changes.
Name tags pokemon: entities get a per-client translation of the name the server sent, which one name tag cannot do. Nicknames marked with the nick prefix are left alone. See docs/name_tags.md.
AFK Idle players are warned on a timer. Once the server is at or above FullnessThreshold (default 0.9), the longest-idle sessions are kicked first.
Claims, visually With DenyRenderingEnabled, protected ground is drawn as deny blocks in the subchunks the client loads.

Command registration, aliases, and the chunk format are in docs/Commands.md. Claim payload shape is in docs/Claims.md.

Run

config.toml is gitignored. Start from the example:

cp config.example.toml config.toml
go run .

Point each server's LocalAddress at the port players use, and RemoteAddress at BDS.

[[Network.Servers]]
Name = 'survival'
LocalAddress = '0.0.0.0:19132'
RemoteAddress = '127.0.0.1:19133'
Transport = 'raknet'
MOTD = 'survival'
MaxPlayers = 85

[Network.Servers.NetherNet]
Enabled = false
UDPPort = 19133

NetherNet needs TCP open on the game port and UDP open on UDPPort. TurnAddress / TurnSecret add a coturn relay for clients behind symmetric NAT. Empty means no TURN. PublicIP is an optional host ICE candidate.

A resource pack:

[[Resources.Packs]]
URL = 'https://example.com/pack.mcpack'
MinMemoryTier = 0
Language = ''

URLResources and PathResources still load, unfiltered, after Packs.

Claims, when you want them, are one HTTP endpoint per server:

[Network.Servers.ClaimService]
Enabled = true
URL = 'http://127.0.0.1:3001/api/database/world/table/claims'
Key = 'secret-key'

[Claims]
PrefilterEnabled = true
DenyRenderingEnabled = false
PollInterval = '15s'
MaxSnapshotAge = '45s'

The Key is sent as the raw Authorization header, no Bearer prefix. Keep it in config.toml, not in git.