mux

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Type selects the mux backend: "smux" (default) or "yamux".
	Type string

	// SMUX Protocol version, support 1,2
	Version int

	// Disabled keepalive
	KeepAliveDisabled bool

	// KeepAliveInterval is how often to send a NOP command to the remote
	KeepAliveInterval time.Duration

	// KeepAliveTimeout is how long the session
	// will be closed if no data has arrived
	KeepAliveTimeout time.Duration

	// MaxFrameSize is used to control the maximum
	// frame size to sent to the remote
	MaxFrameSize int

	// MaxReceiveBuffer is used to control the maximum
	// number of data in the buffer pool
	MaxReceiveBuffer int

	// MaxStreamBuffer is used to control the maximum
	// number of data per stream
	MaxStreamBuffer int

	// MaxStreamWindow is the yamux MaxStreamWindowSize in bytes.
	MaxStreamWindow int
}

type Session

type Session interface {
	GetConn() (net.Conn, error)
	Accept() (net.Conn, error)
	Close() error
	IsClosed() bool
}

Session multiplexes streams over a single underlying connection.

func ClientSession

func ClientSession(conn net.Conn, cfg *Config) (Session, error)

ClientSession creates a client-side mux session over conn.

func ServerSession

func ServerSession(conn net.Conn, cfg *Config) (Session, error)

ServerSession creates a server-side mux session over conn.

Jump to

Keyboard shortcuts

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