multiplexer

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Connection messageType = iota
	Disconnection
	Packet
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TargetServer is the address of the target server to connect to
	TargetServer string

	// Port is the local port to listen on
	Port string

	// InitialDelay specifies the delay after establishing a new connection
	// before it can be used
	InitialDelay time.Duration

	// Timeout specifies the read/write timeout for connections
	Timeout time.Duration

	// MaxConnections specifies the maximum number of target connections
	// to maintain in the connection pool
	MaxConnections int

	// ReconnectBackoff specifies the initial backoff time for reconnection attempts
	// This will increase exponentially with failed attempts
	ReconnectBackoff time.Duration

	// HealthCheckInterval specifies how often to check connection health
	HealthCheckInterval time.Duration

	// QueueSize specifies the size of the request queue
	QueueSize int

	// MaxRequestSize limits the size of incoming requests
	MaxRequestSize int

	// MaxResponseSize limits the size of responses from the target
	MaxResponseSize int

	// IdleTimeout specifies how long a connection can remain idle
	// before it's closed
	IdleTimeout time.Duration
}

Config holds all configuration options for the multiplexer

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration

type Multiplexer

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

func New

func New(targetServer, port string, messageReader message.Reader, delay time.Duration, timeout time.Duration) Multiplexer

New creates a multiplexer with default config

func NewWithConfig

func NewWithConfig(config Config, messageReader message.Reader) Multiplexer

NewWithConfig creates a multiplexer with detailed configuration

func (*Multiplexer) Close

func (mux *Multiplexer) Close() error

Close gracefully shuts down the multiplexer

func (*Multiplexer) Start

func (mux *Multiplexer) Start() error

Jump to

Keyboard shortcuts

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