lite

package
v0.62.3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearVirtualHost

func ClearVirtualHost(name string) string

ClearVirtualHost cleans the given virtual host.

func FindRoute

func FindRoute(pattern string, routes ...config.Route) (host string, route *config.Route)

FindRoute returns the first route that matches the given wildcard supporting pattern.

func FindRouteWithGroups added in v0.59.0

func FindRouteWithGroups(pattern string, routes ...config.Route) (host string, route *config.Route, groups []string)

FindRouteWithGroups returns the first route that matches the given wildcard supporting pattern, along with the captured groups from wildcards.

func Forward added in v0.26.0

func Forward(
	dialTimeout time.Duration,
	routes []config.Route,
	log logr.Logger,
	client netmc.MinecraftConn,
	handshake *packet.Handshake,
	pc *proto.PacketContext,
	strategyManager *StrategyManager,
)

Forward forwards a client connection to a matching backend route.

func IsConnectionRefused added in v0.56.0

func IsConnectionRefused(err error) bool

IsConnectionRefused returns true if err indicates a connection refused error. These errors are common when backends are down and should use debug logging.

func IsTCPShieldRealIP added in v0.36.2

func IsTCPShieldRealIP(addr string) bool

IsTCPShieldRealIP returns true if the given virtual host uses TCPShieldRealIP protocol.

func ResetPingCache added in v0.37.1

func ResetPingCache()

ResetPingCache resets the ping cache.

func ResolveStatusResponse added in v0.26.0

func ResolveStatusResponse(
	dialTimeout time.Duration,
	routes []config.Route,
	log logr.Logger,
	client netmc.MinecraftConn,
	handshake *packet.Handshake,
	handshakeCtx *proto.PacketContext,
	statusRequestCtx *proto.PacketContext,
	strategyManager *StrategyManager,
) (logr.Logger, *packet.StatusResponse, error)

ResolveStatusResponse resolves the status response for the matching route and caches it for a short time.

func TCPShieldRealIP added in v0.36.2

func TCPShieldRealIP(addr string, clientAddr net.Addr) string

TCPShieldRealIP formats host addr to use the TCPShieldRealIP protocol with the given client ip.

Types

type Lite added in v0.55.0

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

Lite encapsulates all lite mode functionality for a Gate proxy instance. This provides a clean abstraction for lite mode features and avoids global state.

func NewLite added in v0.55.0

func NewLite() *Lite

NewLite creates a new Lite instance for a Gate proxy.

func (*Lite) StrategyManager added in v0.55.0

func (l *Lite) StrategyManager() *StrategyManager

StrategyManager returns the strategy manager for load balancing.

type StrategyManager added in v0.55.0

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

StrategyManager manages state for load balancing strategies across a single Gate instance. This eliminates global state and allows multiple Gate instances in the same process.

func NewStrategyManager added in v0.55.0

func NewStrategyManager() *StrategyManager

NewStrategyManager creates a new strategy manager for a Gate instance.

func (*StrategyManager) GetNextBackend added in v0.55.0

func (sm *StrategyManager) GetNextBackend(log logr.Logger, route *config.Route, routeHost string, backends []string) (string, logr.Logger, bool)

GetNextBackend returns the next backend using the specified strategy.

func (*StrategyManager) GetOrCreateCounter added in v0.55.0

func (sm *StrategyManager) GetOrCreateCounter(backend string) *atomic.Uint32

GetOrCreateCounter returns the connection counter for a backend (exposed for testing).

func (*StrategyManager) IncrementConnection added in v0.55.0

func (sm *StrategyManager) IncrementConnection(backend string) func()

IncrementConnection increments the connection counter for a backend (used with least-connections).

func (*StrategyManager) RecordLatency added in v0.55.0

func (sm *StrategyManager) RecordLatency(backend string, latency time.Duration)

RecordLatency records the latency for a backend (used with lowest-latency).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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