spectrum

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 4 Imported by: 2

README

Spectrum

Spectrum is a blazingly fast, lightweight, and flexible Minecraft: Bedrock Edition proxy.

Discord

Examples

Explore how to use Spectrum in the example directory.

Implementations

Spectrum's protocol uses TCP and QUIC instead of RakNet and the standard Minecraft protocol, providing better reliability and performance. Check out compatible implementations:

Usage

API

Spectrum offers an external TCP service for communication between downstream servers and the proxy. This versatile service supports tasks like player transfers and kicks, using packets for efficient data exchange. For guidance, see this example. Official implementations also include an API client for easy integration.

Discovery

Spectrum introduces Discovery, a method for locating servers when players join. It handles connections asynchronously, determining the server address for connection or signaling disconnection errors. This process allows for blocking operations like database queries and HTTP requests. Spectrum also supports static discovery for consistent address use and can serve load balancing purposes.

Processor

The Processor interface in Spectrum handles incoming and outgoing packets within sessions, enabling custom filtering and manipulation. This functionality supports implementing anti-cheat measures and other security features. Downstream servers are responsible for prefixing packets to indicate decoding necessity, as per Spectrum protocol specifications.

Why Spectrum?

  1. Protocol Innovation: Utilizes TCP and QUIC for enhanced reliability and performance, unlike traditional proxies relying on RakNet and standard Minecraft protocol.

  2. Efficient Packet Handling: Maintains high throughput by bypassing unnecessary packet decoding, optimizing data transmission and reducing latency.

  3. Customizability: Provides extensive customization options, including defining transfer transitions and custom behaviors, for unique gameplay experiences.

  4. Lightweight and Fast: Built for high performance with a lightweight architecture, capable of handling various connection loads efficiently.

  5. Stateless: Simplifies scalability with a stateless design, enhancing flexibility and efficiency in server management by not keeping track of registered servers within the proxy. Transfer between servers is as easy as sending Spectrum's transfer packet to the player from downstream servers.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	// Addr is the address to listen on.
	Addr string `yaml:"addr"`
	// Token is the authentication token that Spectrum uses to authenticate with servers.
	// When making requests to servers, Spectrum sends this token to the server for validation.
	Token string `yaml:"token"`
	// LatencyInterval is the interval at which the latency of the connection is updated in milliseconds.
	// The lower the interval, the more accurate the latency will be, but the more bandwidth it will use.
	LatencyInterval int64 `yaml:"latency_interval"`
}

func DefaultOpts

func DefaultOpts() *Opts

type Spectrum

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

func NewSpectrum

func NewSpectrum(discovery server.Discovery, logger internal.Logger, opts *Opts) *Spectrum

func (*Spectrum) Accept

func (s *Spectrum) Accept() (*session.Session, error)

func (*Spectrum) Close

func (s *Spectrum) Close() error

func (*Spectrum) Listen

func (s *Spectrum) Listen(config minecraft.ListenConfig) (err error)

func (*Spectrum) Registry

func (s *Spectrum) Registry() *session.Registry

type StatusProvider

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

func NewStatusProvider

func NewStatusProvider(message string) *StatusProvider

func (*StatusProvider) ServerStatus

func (s *StatusProvider) ServerStatus(playerCount int, maxPlayers int) minecraft.ServerStatus

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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