Gate Minecraft Proxy

repository·master·Indexed 22 days ago

https://github.com/minekube/gate

An extensible, high-performance, and parallelized Minecraft proxy server written in Go. Gate is designed for scalability and cloud environments, featuring Bedrock cross-play support via Geyser and Floodgate, automated Java version translation using vialite, and a Lite Mode for hostname-based routing. It includes a CLI for configuration management and a developer framework for implementing custom proxy commands and connection phases.

Tokens
6.6K
Snippets
26
Records
35
Agent score
76%

What's inside gate

  1. Use Gate Lite Mode for hostname-based routing

    master
    Gate Lite Mode is a lightweight version of the proxy that allows you to expose multiple Minecraft servers through a single IP address and port. It works by reverse-proxying players to different backend servers based on the hostname or subdomain they use when joining (e.g., example.com vs my.example.com).
  2. Understand the Velocity sync record and verification model

    master

    Gate ports behavior from PaperMC/Velocity. The VELOCITY_SYNC.md file serves as a committed, verifiable record of which upstream commits have been successfully ported to Gate, alongside a log of all subsequent upstream reviews.

    Key Concepts

    • Verified Sync Point: This is a specific, evidenced fact. It identifies a single upstream commit that has been verified to have its behavior implemented in a specific Gate commit. It is not a claim of general parity with upstream up to that point.
    • Verification vs. Cumulative Parity: Verification is performed per-commit. The file does not claim that all commits preceding the verified_sync_point were ported; it only guarantees the behavior of the specific commit listed.
    • The Log: The log distinguishes between two states:
      1. sync: Upstream work that was successfully ported.
      2. review: An upstream range that was examined but deliberately not ported. This distinguishes reviewed-and-rejected code from code that has simply not been seen yet.

    Portability Filter

    When reviewing upstream changes, Gate only cares about wire-format and protocol changes. Gate does not track Adventure's Java API (it uses a Go stack: go.minekube.com/common/minecraft/component). Changes to Adventure builder methods, overloads, or types are non-portable and can be ignored during review.

  3. Install Gate

    master

    You can install Gate using several methods depending on your platform:

    • Go: Use go run to execute the latest version directly.
    • Linux/macOS: Use curl to pipe the installation script to bash.
    • Windows: Use powershell to pipe the installation script to iex.
    # Go
    go run go.minekube.com/gate@latest
    
    # Linux/macOS
    curl -fsSL https://gate.minekube.com/install | bash
    
    # Windows
    powershell -c "irm https://gate.minekube.com/install.ps1 | iex"
  4. Append an entry to the Velocity sync log

    master

    To maintain the sync record, add a new item to the end of the log list in VELOCITY_SYNC.md (newest last).

    For a sync entry (Ported work)

    Use these fields:

    • date: ISO YYYY-MM-DD of the sync.
    • kind: sync.
    • upstream_commit: Full 40-hex upstream SHA that was ported.
    • gate_commit: Full 40-hex Gate SHA that landed it.
    • gate_pr: Gate PR number.
    • summary: Description of what was ported.

    Important: If a sync advances the verified point, you must also update the verified_sync_point YAML block at the top of the file with the new commit pair and set verified_on to the date of confirmation.

    For a review entry (Examined but not ported)

    Use these fields:

    • date: ISO YYYY-MM-DD of the review.
    • kind: review.
    • upstream_range: The upstream range examined (e.g., SHA..branch).
    • upstream_commit_count: Number of commits in the range.
    • ported: Either none or a description of what was taken.
    • summary: Why the range was reviewed and why it was not ported.

    Log Entry Schema Reference

    log:
      - date: 2026-06-16
        kind: sync
        upstream_commit: a7581821fb72a3eb5011f725d8876c91aa7843e1
        gate_commit: 48a7f910bdc2e7143294dedea326b445597226a9
        gate_pr: 781
        summary: >-
          Ported upstream a7581821 (shared per-proxy session ID for 26.2 login metrics) along with
          Minecraft 26.2 protocol support.
    
      - date: 2026-07-28
        kind: review
        upstream_range: a7581821fb72a3eb5011f725d8876c91aa7843e1..PaperMC/Velocity@dev/3.0.0
        upstream_commit_count: 11
        ported: none
        summary: >-
          Reviewed all 11 upstream commits (8 files) individually; none carried behavior portable to Gate.
  5. Get started with the Developers Starter Template

    master

    If you are building your own Gate-powered project or plugin, use the official starter template to begin development. You can fork the template at minekube/gate-plugin-template on GitHub.

    # Fork the template to get started
    # https://github.com/minekube/gate-plugin-template
  6. Enable Bedrock Cross-Play Support

    master

    Gate provides built-in Bedrock Edition support using integrated Geyser and Floodgate technology. This allows Bedrock players (Mobile, Console, Windows) to join Java Edition (PC) servers without requiring additional plugins.

    To enable this feature, set bedrock to true in your configuration.

    bedrock: true
  7. Understand the Source abstraction

    master

    The Source interface represents the entity invoking a command. It can be a player or the server console/terminal.

    Any type implementing Source must satisfy:

    1. permission.Subject: To allow for permission-based command requirements.
    2. SendMessage(msg component.Component, opts ...MessageOption) error: To allow the command to communicate back to the invoker.

    Functions like SourceFromContext and ContextWithSource allow you to safely retrieve or inject the Source into a context.Context for use within command handlers.

  8. Enable Java Version Compatibility via Via-powered translation

    master

    Gate can handle protocol translation using managed vialite. This allows Java clients to connect to backend servers running different Minecraft versions without needing a separate Via sidecar.

    When enabled, Gate automatically manages the vialite subprocess: it resolves the latest stable release, downloads the checksummed artifact to a local cache, and routes backend connections through it.

    To enable managed Via in classic proxy mode, use the following configuration:

    config:
      via:
        enabled: true
  9. Configure automatic config reloading

    master
    By default, Gate attempts to automatically reload its configuration if a config file is provided. You can disable this behavior using the --no-auto-reload flag, the GATE_NO_AUTO_RELOAD environment variable, or by setting noAutoReload to true within your configuration file.
  10. Use the Gate CLI

    master

    Gate is a high-performance Minecraft proxy. You can run it using the gate command. The CLI supports configuration via files (YAML, JSON), environment variables, and command-line flags. Flags provided at runtime will overwrite values found in the configuration file.

    # Run with default config (./config.yml)
    gate
    
    # Run with a specific config file
    gate --config ./my-config.yaml
    
    # Run with debug mode enabled
    gate --debug
    
    # Show version
    gate --version
  11. Reference: Velocity Sync Log Fields

    master

    The following fields are used in the VELOCITY_SYNC.md log to track upstream synchronization and reviews.

    | Field | Applies to | Meaning |
    |---|---|---|
    | `date` | both | ISO `YYYY-MM-DD` of the sync or review |
    | `kind` | both | `sync` or `review` |
    | `summary` | both | What was ported, or what was reviewed and why it was not ported |
    | `upstream_commit` | `sync` | Full 40-hex upstream SHA that was ported |
    | `gate_commit` | `sync` | Full 40-hex Gate SHA that landed it |
    | `gate_pr` | `sync` | Gate PR number |
    | `upstream_range` | `review` | The upstream range examined |
    | `upstream_commit_count` | `review` | How many commits the range held |
    | `ported` | `review` | `none`, or what was taken from the range |
  12. Run the Gate CLI

    master

    The gate binary is the entrypoint for the Gate Minecraft Proxy. It uses the gate.Execute() function to initialize and run the command-line interface, which handles proxy configuration, management, and execution.

    package main
    
    import (
    	"go.minekube.com/gate/cmd/gate"
    )
    
    func main() {
    	gate.Execute()
    }