gate

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 15 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 sets up a Logger, reads in a Config, validates it and sets up os signal handling before starting the instance.

The Gate is shutdown on stop channel close or on occurrence of any significant error. Config validation warnings are logged but ignored.

Types

type Gate

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

Gate manages one or multiple proxy editions (Bedrock & Java).

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 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)

func WithAutoShutdownOnSignal added in v0.20.3

func WithAutoShutdownOnSignal(enabled bool) StartOption

WithAutoShutdownOnSignal 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 StartOption for Start.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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