transport

package
v0.0.0-...-f10b52b Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrConnRefused  = errs.Err("connection refused")
	ErrNotListening = errs.Err("not listening")
)

errors

Variables

View Source
var (
	// OptionDomains is option's domain
	OptionDomains = []string{"transport"}
	// Options for transport
	Options = transportOptions{}
)

Functions

func ParseScheme

func ParseScheme(addr string) (scheme string)

ParseScheme parse scheme from address

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 RegisterTransportWithScheme

func RegisterTransportWithScheme(t Transport, scheme string)

RegisterTransportWithScheme register transport as an alias 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) (a string, err 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 Address

type Address struct {
	// contains filtered or unexported fields
}

Address is transport Connection's address as net.Addr

func NewAddress

func NewAddress(scheme, addr string) *Address

NewAddress create an address

func (*Address) Network

func (a *Address) Network() string

Network address's network

func (*Address) String

func (a *Address) String() string

Network address's value

type Connection

type Connection interface {
	Transport() Transport
	net.Conn
	Writev(v ...[]byte) (int64, error)
	LocalAddress() string
	RemoteAddress() string
	RawConn() net.Conn
}

Connection is connection between peers.

func NewConnection

func NewConnection(transport Transport, nc net.Conn, accepted bool) (Connection, error)

NewConnection allocates a new Connection using the net.Conn

type Dialer

type Dialer interface {
	Dial(opts options.Options) (Connection, error)
}

Dialer is dialer

type Listener

type Listener interface {
	Listen(opts options.Options) error
	Accept(opts options.Options) (Connection, error)
	Close() error
}

Listener is listener

type Transport

type Transport interface {
	Scheme() string
	NewDialer(address string) (Dialer, error)
	NewListener(address string) (Listener, error)
}

Transport is transport

func GetTransport

func GetTransport(scheme string) Transport

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

func GetTransportFromAddr

func GetTransportFromAddr(addr string) Transport

GetTransportFromAddr get transport for the address scheme

Directories

Path Synopsis
Package all is used to register all transports.
Package all is used to register all transports.
Package ipc implements the IPC transport on top of UNIX domain sockets.
Package ipc implements the IPC transport on top of UNIX domain sockets.

Jump to

Keyboard shortcuts

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