mux

package
v0.0.0-...-26bfb72 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mux provides a generic muxing API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wait

func Wait(sess Session) error

Wait blocks until the session transport has shut down, and returns the error causing the shutdown.

Types

type Channel

type Channel interface {
	// Read reads up to len(data) bytes from the channel.
	Read(data []byte) (int, error)

	// Write writes len(data) bytes to the channel.
	Write(data []byte) (int, error)

	// Close signals end of channel use. No data may be sent after this
	// call.
	Close() error

	// CloseWrite signals the end of sending data.
	// The other side may still send data
	CloseWrite() error

	// ID returns the unique identifier of this channel
	// within the session
	ID() uint32
}

Channel is an ordered, reliable, flow-controlled, duplex stream that is multiplexed over a qmux session.

type Session

type Session interface {
	// Close closes the underlying transport.
	// Any blocked Accept operations will be unblocked and return errors.
	Close() error

	// Open establishes a new channel with the other end.
	Open(ctx context.Context) (Channel, error)

	// Accept waits for and returns the next incoming channel.
	Accept() (Channel, error)
}

Session is a bi-directional channel muxing session on a given transport.

type Transport

type Transport interface {
	io.Reader
	io.Writer
	io.Closer
}

Transport is an interface describing what is needed for a session

Jump to

Keyboard shortcuts

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