config

package
v1.0.3-chat-fix Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBedrockConfig = BedrockConfig{
	Enabled:          false,
	GeyserListenAddr: DefaultConfig.GeyserListenAddr,
	UsernameFormat:   DefaultConfig.UsernameFormat,
	FloodgateKeyPath: DefaultConfig.FloodgateKeyPath,
	Managed:          BoolOrManagedGeyser{},
}

DefaultBedrockConfig provides default settings for the flattened BedrockConfig structure.

View Source
var DefaultConfig = Config{
	GeyserListenAddr: "localhost:25567",
	UsernameFormat:   ".%s",
	FloodgateKeyPath: "floodgate.pem",
	Managed:          nil,
}

DefaultConfig provides default settings for Bedrock Edition support. Bedrock support enables cross-play between Java and Bedrock players via: - Geyser: Protocol translator (Bedrock ↔ Java Edition) - Floodgate: Authentication system for offline Bedrock players

View Source
var DefaultManaged = ManagedGeyser{
	Enabled:    false,
	JarURL:     "https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/standalone",
	DataDir:    ".geyser",
	JavaPath:   "java",
	AutoUpdate: true,
}

DefaultManaged provides default settings for managed Geyser Standalone.

Functions

This section is empty.

Types

type BedrockConfig

type BedrockConfig struct {
	Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`

	// Flattened Bedrock configuration (removed nested config key)
	// Gate ↔ Geyser connection settings
	GeyserListenAddr string `yaml:"geyserListenAddr,omitempty" json:"geyserListenAddr,omitempty"`

	// Bedrock player settings
	UsernameFormat string `yaml:"usernameFormat,omitempty" json:"usernameFormat,omitempty"`

	// Floodgate authentication (enables offline Bedrock players)
	FloodgateKeyPath string `yaml:"floodgateKeyPath,omitempty" json:"floodgateKeyPath,omitempty"`

	// Managed Geyser (recommended): Gate automatically handles Geyser process
	// Can be either bool (true) or ManagedGeyser struct for advanced config
	Managed BoolOrManagedGeyser `yaml:"managed,omitempty" json:"managed,omitempty"`
}

BedrockConfig is the main Bedrock configuration that can be embedded in other configs. It supports a flattened structure (no nested "config" key) and flexible managed configuration.

func (*BedrockConfig) GetManagedConfig

func (bc *BedrockConfig) GetManagedConfig() ManagedGeyser

GetManagedConfig returns the managed configuration, handling both bool and struct forms

func (*BedrockConfig) ToConfig

func (bc *BedrockConfig) ToConfig() Config

ToConfig converts the flattened BedrockConfig to the original Config structure

func (*BedrockConfig) UnmarshalYAML

func (bc *BedrockConfig) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshaling to handle managed: true shorthand

type BoolOrManagedGeyser

type BoolOrManagedGeyser = configutil.BoolOrStruct[ManagedGeyser]

BoolOrManagedGeyser represents a field that can be either: - bool: true/false for simple enable/disable - ManagedGeyser: advanced managed configuration struct

type Config

type Config struct {
	// Gate ↔ Geyser connection settings
	GeyserListenAddr string `yaml:"geyserListenAddr,omitempty" json:"geyserListenAddr,omitempty"` // TCP address where Gate listens for Geyser connections

	// Bedrock player settings
	UsernameFormat string `yaml:"usernameFormat,omitempty" json:"usernameFormat,omitempty"` // Format for Bedrock player usernames to avoid conflicts with Java players (e.g., ".%s")

	// Floodgate authentication (enables offline Bedrock players)
	FloodgateKeyPath string `yaml:"floodgateKeyPath,omitempty" json:"floodgateKeyPath,omitempty"` // Path to Floodgate AES encryption key shared with backend servers

	// Managed Geyser (recommended): Gate automatically handles Geyser process
	Managed *ManagedGeyser `yaml:"managed,omitempty" json:"managed,omitempty"` // Automatic Geyser JAR management and process control
}

Config configures Bedrock Edition support via Geyser protocol translation and Floodgate authentication. This enables cross-play between Java Edition and Bedrock Edition (mobile, console, Windows) players.

Bedrock support requires a Geyser instance to translate between protocols. You can either: 1. Use managed mode (recommended): Gate automatically handles Geyser for you 2. Run external Geyser: You manage your own Geyser instance

func (*Config) GetManaged

func (c *Config) GetManaged() ManagedGeyser

GetManaged returns the managed config with defaults applied. If managed is not configured (nil), returns DefaultManaged. If managed is configured, merges user values with defaults.

func (*Config) Validate

func (c *Config) Validate() (warns []error, errs []error)

Validate validates the Bedrock edition configuration.

type ManagedGeyser

type ManagedGeyser struct {
	Enabled         bool           `yaml:"enabled,omitempty" json:"enabled,omitempty"`                 // Enable managed Geyser mode (Gate handles Geyser process)
	JarURL          string         `yaml:"jarUrl,omitempty" json:"jarUrl,omitempty"`                   // Download URL for Geyser Standalone JAR
	DataDir         string         `yaml:"dataDir,omitempty" json:"dataDir,omitempty"`                 // Directory for JAR and runtime data
	JavaPath        string         `yaml:"javaPath,omitempty" json:"javaPath,omitempty"`               // Path to Java executable
	AutoUpdate      bool           `yaml:"autoUpdate,omitempty" json:"autoUpdate,omitempty"`           // Download latest JAR on startup
	ExtraArgs       []string       `yaml:"extraArgs,omitempty" json:"extraArgs,omitempty"`             // Additional JVM arguments
	ConfigOverrides map[string]any `yaml:"configOverrides,omitempty" json:"configOverrides,omitempty"` // Custom overrides for auto-generated Geyser config
}

ManagedGeyser configures automatic Geyser Standalone management. When enabled, Gate automatically downloads, configures, starts, and updates Geyser. This is the recommended approach for most users.

Note: The Bedrock port (default 19132) should be configured via ConfigOverrides:

configOverrides:
  bedrock:
    port: 19133  # Custom Bedrock port

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL