transport

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	closer.Closer

	// AcceptStream returns the next stream opened by the peer, blocking until one is available.
	AcceptStream(context.Context) (Stream, error)

	// OpenStream opens a new bidirectional stream.
	// There is no signaling to the peer about new streams.
	// The peer can only accept the stream after data has been sent on it.
	OpenStream(context.Context) (Stream, error)

	// LocalAddr returns the local address.
	LocalAddr() net.Addr

	// RemoteAddr returns the address of the peer.
	RemoteAddr() net.Addr

	// IsClosedError checks whenever the passed error is a closed connection error.
	IsClosedError(error) bool
}

type Listener

type Listener interface {
	closer.Closer

	// Accept waits for and returns the next connection to the listener.
	// The listener must close the new connection if the listener is closed.
	Accept() (Conn, error)

	// Addr returns the listener's network address.
	Addr() net.Addr
}

type Stream

type Stream interface {
	net.Conn

	// IsClosed returns true, if the stream has been closed locally or by the remote peer.
	IsClosed() bool

	// ClosedChan returns a closed channel as soon as the stream closes.
	ClosedChan() <-chan struct{}
}

type Transport

type Transport interface {
	Dial(cl closer.Closer, ctx context.Context, addr string) (Conn, error)
	Listen(cl closer.Closer, addr string) (Listener, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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