gate

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Overview

Package gate is the main package for running one or more Minecraft proxy editions.

Index

Constants

This section is empty.

Variables

View Source
var Viper = viper.New()

Viper is the default viper instance used by Start to load in a config.Config.

Functions

func LoadConfig added in v0.19.0

func LoadConfig(v *viper.Viper) (*config.Config, error)

LoadConfig loads in config.Config from viper. It is used by Start with the packages Viper if no WithConfig option is given.

func Start

func Start(ctx context.Context, opts ...StartOption) error

Start is a convenience function to set up and run a Gate instance.

It uses the logr.Logger from the provided context, reads in a Config, validates it and sets up os signal handling before starting the instance.

The Gate is shutdown when the context is canceled or on occurrence of any significant error like severe configuration error or unable to bind to a port.

Config validation warnings are logged but ignored.

Types

type Gate

type Gate struct {
	// contains filtered or unexported fields
}

Gate is the root holder of various child processes.

func New

func New(options Options) (gate *Gate, err error)

New returns a new Gate instance. The given Options requires a validated Config.

func (*Gate) Bedrock

func (g *Gate) Bedrock() *bproxy.Proxy

Bedrock returns the Bedrock edition proxy, or nil if none.

func (*Gate) Java

func (g *Gate) Java() *jproxy.Proxy

Java returns the Java edition proxy, or nil if none.

func (*Gate) Start

func (g *Gate) Start(ctx context.Context) error

Start starts the Gate instance and all underlying proc.

type LoadConfigFunc added in v0.33.0

type LoadConfigFunc func() (*config.Config, error)

LoadConfigFunc is a function that loads in a config.Config.

type Options

type Options struct {
	// Config requires a valid Gate configuration.
	Config *config.Config
	// The event manager to use.
	// If none is set, no events are sent.
	EventMgr event.Manager
}

Options are Gate options.

type StartOption added in v0.19.0

type StartOption func(o *startOptions)

StartOption is an option for Start.

func WithAutoConfigReload added in v0.33.0

func WithAutoConfigReload(path string) StartOption

WithAutoConfigReload is a StartOption for Start that automatically reloads the config when a file change is detected.

This setting is disabled by default.

func WithAutoShutdownOnSignal added in v0.20.3

func WithAutoShutdownOnSignal(enabled bool) StartOption

WithAutoShutdownOnSignal is a StartOption for Start that automatically shuts down the Gate instance when a shutdown signal is received.

This setting is enabled by default.

func WithConfig added in v0.19.0

func WithConfig(c config.Config) StartOption

WithConfig is a StartOption for Start that uses the provided config.Config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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