transport

package
v0.5.21-alpha.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Yamux = "yamux"
	Quic  = "quic"
)

Variables

View Source
var (
	ErrConnClosed = errors.New("connection closed")
)

Functions

This section is empty.

Types

type Accepter

type Accepter interface {
	Accept(mc MultiConn) (err error)
}

type MultiConn

type MultiConn interface {
	// Context returns the connection context that contains handshake details
	Context() context.Context
	// Accept accepts new sub connections
	Accept() (conn net.Conn, err error)
	// Open opens new sub connection
	Open(ctx context.Context) (conn net.Conn, err error)
	// Addr returns remote peer address
	Addr() string
	// IsClosed returns true when connection is closed
	IsClosed() bool
	// CloseChan returns a channel that will be closed with connection
	CloseChan() <-chan struct{}
	// Close closes the connection and all sub connections
	Close() error
}

MultiConn is an object of multiplexing connection containing handshake info

type Transport

type Transport interface {
	// SetAccepter sets accepter that will be called for new connections
	// this method should be called before app start
	SetAccepter(accepter Accepter)
	// Dial creates a new connection by given address
	Dial(ctx context.Context, addr string) (mc MultiConn, err error)
}

Transport is a common interface for a network transport

Directories

Path Synopsis
Package mock_transport is a generated GoMock package.
Package mock_transport is a generated GoMock package.

Jump to

Keyboard shortcuts

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