spectral

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 17 Imported by: 2

README

Spectral

Spectral is a blazingly fast, lightweight, and powerful network engine designed for real-time, low-latency applications such as gaming, streaming, and other interactive services. Built on top of UDP, Spectral ensures high performance while maintaining reliability through advanced networking concepts.

Core Concepts

  • Streams: Spectral supports streams, enabling multiple data channels over a single connection. This allows for efficient data handling and avoids head-of-line blocking.
  • Reliability: Despite being built on top of the connectionless UDP protocol, Spectral incorporates mechanisms for guaranteed packet delivery.
  • Stream-level Ordering: Spectral ensures that data within a stream is delivered in the correct order, optimizing application performance where packet sequence matters.
  • Packet Pacing: The engine manages transmission timing for efficient bandwidth use and reduced network congestion.
  • Congestion Control: Spectral dynamically adjusts its transmission rate to adapt to varying network conditions, ensuring smooth data flow and minimal packet loss.
  • Retransmission: Lost or dropped packets are intelligently detected and retransmitted, providing robustness in unreliable networks.

These features make Spectral ideal for scenarios requiring fast, reliable, and scalable communication.

Examples

Explore the example directory to learn how to integrate Spectral into your project.

Implementations

Spectral is implemented in the following languages:

Additional language implementations are under development to expand its reach across different platforms.

Projects Using Spectral

Project Description Stars
Spectrum A fast and lightweight proxy for Minecraft: Bedrock Edition, leveraging Spectral for enhanced performance. Stars

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConnection

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

func (ClientConnection) AcceptStream

func (c ClientConnection) AcceptStream(_ context.Context) (*Stream, error)

func (ClientConnection) CloseWithError

func (c ClientConnection) CloseWithError(code byte, message string) (err error)

func (ClientConnection) Context

func (c ClientConnection) Context() context.Context

func (ClientConnection) LocalAddr

func (c ClientConnection) LocalAddr() net.Addr

func (*ClientConnection) OpenStream

func (c *ClientConnection) OpenStream(ctx context.Context) (*Stream, error)

func (ClientConnection) RemoteAddr

func (c ClientConnection) RemoteAddr() net.Addr

type Connection

type Connection interface {
	AcceptStream(ctx context.Context) (*Stream, error)
	OpenStream(ctx context.Context) (*Stream, error)
	CloseWithError(code byte, message string) error
	Context() context.Context
}

func Dial

func Dial(ctx context.Context, address string) (Connection, error)

type Listener

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

func Listen

func Listen(address string) (*Listener, error)

func (*Listener) Accept

func (l *Listener) Accept(ctx context.Context) (Connection, error)

func (*Listener) Close

func (l *Listener) Close() (err error)

type ServerConnection

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

func (*ServerConnection) AcceptStream

func (c *ServerConnection) AcceptStream(ctx context.Context) (*Stream, error)

func (ServerConnection) CloseWithError

func (c ServerConnection) CloseWithError(code byte, message string) (err error)

func (ServerConnection) Context

func (c ServerConnection) Context() context.Context

func (ServerConnection) LocalAddr

func (c ServerConnection) LocalAddr() net.Addr

func (ServerConnection) OpenStream

func (c ServerConnection) OpenStream(_ context.Context) (*Stream, error)

func (ServerConnection) RemoteAddr

func (c ServerConnection) RemoteAddr() net.Addr

type Stream

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

func (*Stream) Close

func (s *Stream) Close() error

func (*Stream) Context

func (s *Stream) Context() context.Context

func (*Stream) Read

func (s *Stream) Read(p []byte) (int, error)

func (*Stream) Write

func (s *Stream) Write(p []byte) (int, error)

Directories

Path Synopsis
log

Jump to

Keyboard shortcuts

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