Skip to content

About

An extremely lightweight Minecraft server routing tool. Can be also used for forcing players to use a public IP under a virtual LAN.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Transfer Server Router by AXFJ

中文 | English

v2.1.0 — Route Minecraft server simply. Supports multi-port listening (independent SLP data per port), SLP remote passthrough, YAML configuration (not compatible with the old v1 format), a redesigned defense and logging, and a new transfer-layer whitelist/blacklist with custom kick messages.

Introduction

Transfer Server Router is an extremely lightweight Minecraft server routing tool. When a player logs in, it sends a clientbound Transfer packet (equivalent to the vanilla /transfer command), so the client immediately reconnects to the configured target server. It can be used for server entry-point routing, or in scenarios where players are forced to use a public IP under a virtual LAN.

Supported client versions: 1.21.11 (774), 26.1/26.1.1/26.1.2 (775), 26.2 (776), 26.3 (777)

Target server settings: set accepts-transfers=true in the target server's server.properties, otherwise transferred players will be disconnected by the target server. All ports share one Target. The target server version must match the client version, otherwise the client will be rejected by the target server after the transfer.

Features

  • Multi-port listening (Sources): each port is bound independently; all ports share the same Target.
  • Independent SLP data per port: optionally pass through server-list data (MOTD, player counts, favicon, etc.) from a remote Minecraft server.
  • Whitelist/blacklist: match by player name (case-insensitive) or IP
  • Multi-version login
  • Defense: per-IP login rate limit, maximum connection lifetime, configurable red kick message.

Configuration (tsr_server.yml)

On first run, tsr_server.yml is generated in the working directory. v2 no longer reads the old tsr_server.properties (a warning is printed if it exists).

Target: mc.example.com:25565

Sources:
  # Static SLP: this port shows its own server-list data
  - Bind: 127.0.0.1:25565
    SLP:
      Mode: static
      Motd: "A Minecraft Server"
      VersionName: "1.21.11"
      Protocol: 774
      MaxPlayers: 20
      OnlinePlayers: 0
      PlayerList: []
    # Transfer-layer whitelist: only these players/IPs are transferred
    Access:
      Mode: whitelist
      Players: ["Steve", "AXFJ"]
      Ips: ["127.0.0.1", "10.0.0.0/8", "2001:db8::/32"]
      WhitelistKickMsg: "You are not whitelisted"
      # BlacklistKickMsg: "You are blacklisted"   # used when Mode: blacklist

  # Passthrough SLP: this port relays the remote server's list data
  - Bind: 127.0.0.1:25566
    SLP:
      Mode: passthrough
      Remote: sz.frp.one:6767
      CacheTTL: 5
      Motd: "Fallback MOTD when the remote is unreachable"
      VersionName: "1.21.11"

Defense:
  PerIP-Login-1s: 1
  PerIP-MaxConnTime: 15
  KickMsg: "Rate limit reached! Please wait for a moment before connecting."

Configuration keys

Key Description
Target Target server host:port (all Sources share it).
Sources[].Bind Listening address ip:port, must be unique.
Sources[].SLP.Mode static or passthrough.
Sources[].SLP.Motd MOTD for static mode (also used as the fallback when passthrough fails).
Sources[].SLP.VersionName Version name shown to unsupported clients.
Sources[].SLP.Protocol Protocol number shown to unsupported clients.
Sources[].SLP.MaxPlayers / OnlinePlayers Static player counts.
Sources[].SLP.PlayerList Optional sample player names (max 12).
Sources[].SLP.Remote Remote host:port for passthrough mode (required).
Sources[].SLP.CacheTTL Passthrough cache seconds (default 5).
Sources[].Access.Mode Transfer-layer mode: off (default), whitelist or blacklist.
Sources[].Access.Players Player names to match (case-insensitive, each up to 16 characters).
Sources[].Access.Ips IP/CIDR to match: 1.2.3.4, 10.0.0.0/8, ::1, 2001:db8::/32.
Sources[].Access.WhitelistKickMsg Red message when the whitelist denies a login (default You are not whitelisted).
Sources[].Access.BlacklistKickMsg Red message when the blacklist denies a login (default You are blacklisted).
Defense.PerIP-Login-1s Maximum login requests per second per IP (SLP is not limited).
Defense.PerIP-MaxConnTime Maximum lifetime of a single connection in seconds.
Defense.KickMsg Message shown to kicked clients (rendered in red).

Notes:

  • For supported client versions, SLP always echoes the client's own protocol number (to keep the server list compatible); passthrough mode preserves the remote's version name.
  • Passthrough results are cached per port for CacheTTL seconds; on failure a warning is printed and the static data is used as fallback.
  • Access rules are evaluated after Login Start (the player name is known at this point) and before the login rate limit; denied logins receive a mode-specific red message (WhitelistKickMsg / BlacklistKickMsg) login disconnect. SLP is not filtered by access rules.
  • Two internal safety caps protect against connection floods and are not configurable: 512 concurrent globally, 32 per IP.

Console commands

  • stop — graceful shutdown (waits up to 3 seconds for in-flight connections)
  • status — active connections / tracked IPs / port count / supported versions
  • help

Build & test

cargo build --release
cargo test
cargo clippy --all-targets -- -D warnings

License

Apache 2.0

About

An extremely lightweight Minecraft server routing tool. Can be also used for forcing players to use a public IP under a virtual LAN.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages