transport

package
v3.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTransport

func RegisterTransport(t Transport)

RegisterTransport is used to register the transport globally, after which it will be available for all sockets. The transport will override any others registered for the same scheme.

func ResolveTCPAddr

func ResolveTCPAddr(addr string) (*net.TCPAddr, error)

ResolveTCPAddr is like net.ResolveTCPAddr, but it handles the wildcard used in nanomsg URLs, replacing it with an empty string to indicate that all local interfaces be used.

func StripScheme

func StripScheme(t Transport, addr string) (string, error)

StripScheme removes the leading scheme (such as "http://") from an address string. This is mostly a utility for benefit of transport providers.

Types

type ConnPipe

type ConnPipe interface {

	// SetOption just records an option that can be retrieved later.
	SetOption(string, interface{})
	Pipe
}

ConnPipe is used for stream oriented transports. It is a superset of Pipe, but adds methods specific for transports.

func NewConnPipe

func NewConnPipe(c net.Conn, proto ProtocolInfo) ConnPipe

NewConnPipe allocates a new Pipe using the supplied net.Conn, and initializes it. It performs no negotiation -- use a Handshaker to arrange for that.

Stream oriented transports can utilize this to implement a Transport. The implementation will also need to implement PipeDialer, PipeAccepter, and the Transport enclosing structure. Using this layered interface, the implementation needn't bother concerning itself with passing actual SP messages once the lower layer connection is established.

func NewConnPipeIPC

func NewConnPipeIPC(c net.Conn, proto ProtocolInfo) ConnPipe

NewConnPipeIPC allocates a new Pipe using the IPC exchange protocol.

type Dialer

type Dialer = mangos.TranDialer

Dialer is a factory that creates Pipes by connecting to remote listeners.

type Handshaker

type Handshaker interface {
	// Start injects a pipe into the handshaker.  The
	// handshaking is done asynchronously on a Go routine.
	Start(Pipe)

	// Waits for until a pipe has completely finished the
	// handshaking and returns it.
	Wait() (Pipe, error)

	// Close is used to close the handshaker.  Any existing
	// negotiations will be canceled, and the underlying
	// transport sockets will be closed.  Any new attempts
	// to start will return mangos.ErrClosed.
	Close()
}

Handshaker is used to support dealing with asynchronous handshaking used for some transports. This allows the initial handshaking to be done in the background, without stalling the server's accept queue. This is important to ensure that a slow remote peer cannot bog down the server or effect a denial-of-service for new connections.

func NewConnHandshaker

func NewConnHandshaker() Handshaker

NewConnHandshaker returns a Handshaker that works with Pipes created via NewConnPipe or NewConnPipeIPC.

type Listener

type Listener = mangos.TranListener

Listener is a factory that creates Pipes by listening to inbound dialers.

type Message

type Message = mangos.Message

Message is an alias for the mangos.Message

type Pipe

type Pipe = mangos.TranPipe

Pipe is a transport pipe.

type ProtocolInfo

type ProtocolInfo = mangos.ProtocolInfo

ProtocolInfo is stuff that describes a protocol.

type Transport

type Transport = mangos.Transport

Transport is our transport operations.

func GetTransport

func GetTransport(scheme string) Transport

GetTransport is used by a socket to lookup the transport for a given scheme.

Directories

Path Synopsis
Package all is used to register all transports.
Package all is used to register all transports.
Package inproc implements an simple inproc transport for mangos.
Package inproc implements an simple inproc transport for mangos.
Package ipc implements the IPC transport on top of UNIX domain sockets.
Package ipc implements the IPC transport on top of UNIX domain sockets.
Package tcp implements the TCP transport for mangos.
Package tcp implements the TCP transport for mangos.
Package tlstcp implements the TLS over TCP transport for mangos.
Package tlstcp implements the TLS over TCP transport for mangos.
Package ws implements a simple WebSocket transport for mangos.
Package ws implements a simple WebSocket transport for mangos.
Package wss implements a secure WebSocket transport for mangos.
Package wss implements a secure WebSocket transport for mangos.

Jump to

Keyboard shortcuts

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