spectrum

package module
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 10 Imported by: 0

README

Spectrum

Spectrum is a blazingly fast, lightweight, and easy to use Minecraft: Bedrock Edition proxy.

Discord

Examples

Explore how to use Spectrum in the example directory.

Implementations

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

Usage

API

Spectrum provides an external TCP service for communication between downstream servers and the proxy through packets. This service supports tasks such as player transfers and kicks and is designed to be extensible, allowing you to register your own packets and handlers.

For a practical example, see the example API implementation. Official implementations include an API client for easy integration. If you’re using Go, you can use the Dial function from the API package to dial an API service.

Discovery

Spectrum introduces Discovery, a method for server determination 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. In addition, Spectrum offers an in-built static discovery that maintains a constant server address. Furthermore, the discovery feature can also function as a server load balancer.

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?

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

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

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

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

  • 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.

  • Deterministic: Takes a unique approach by sidestepping entity translations altogether, relying solely on deterministic entity identifiers provided by the downstream servers.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spectrum

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

Spectrum represents a proxy server managing server discovery, network transport, and connections through an underlying minecraft.Listener.

func NewSpectrum

func NewSpectrum(discovery server.Discovery, logger *slog.Logger, opts *util.Opts, transport tr.Transport) *Spectrum

NewSpectrum creates a new Spectrum instance using the provided server.Discovery. It initializes opts with default options from util.DefaultOpts() if opts is nil, and defaults to TCP transport if transport is nil transport.TCP.

func (*Spectrum) Accept

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

Accept accepts an incoming minecraft.Conn and creates a new session for it. This method should be called in a loop to continuously accept new connections.

func (*Spectrum) Close

func (s *Spectrum) Close() error

Close closes the listener and stops listening for incoming connections.

func (*Spectrum) Discovery added in v0.0.13

func (s *Spectrum) Discovery() server.Discovery

Discovery returns the server discovery instance.

func (*Spectrum) Listen

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

Listen sets up a minecraft.Listener for incoming connections based on the provided minecraft.ListenConfig. The listener is then used by the Accept() method for accepting incoming connections.

func (*Spectrum) Listener added in v0.0.26

func (s *Spectrum) Listener() *minecraft.Listener

Listener returns the listener instance.

func (*Spectrum) Opts added in v0.0.13

func (s *Spectrum) Opts() util.Opts

Opts returns the configuration options.

func (*Spectrum) Registry

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

Registry returns the session registry instance.

func (*Spectrum) Transport added in v0.0.13

func (s *Spectrum) Transport() tr.Transport

Transport returns the transport instance.

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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