transport

package
v0.3.11-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTcpMultiaddr

func IsTcpMultiaddr(a ma.Multiaddr) bool

func IsUtpMultiaddr

func IsUtpMultiaddr(a ma.Multiaddr) bool

func ReuseErrShouldRetry

func ReuseErrShouldRetry(err error) bool

ReuseErrShouldRetry diagnoses whether to retry after a reuse error. if we failed to bind, we should retry. if bind worked and this is a real dial error (remote end didnt answer) then we should not retry.

func ReuseportIsAvailable

func ReuseportIsAvailable() bool

reuseportIsAvailable returns whether reuseport is available to be used. This is here because we want to be able to turn reuseport on and off selectively. For now we use an ENV variable, as this handles our pressing need:

IPFS_REUSEPORT=false ipfs daemon

If this becomes a sought after feature, we could add this to the config. In the end, reuseport is a stop-gap.

Types

type Conn

type Conn interface {
	manet.Conn

	Transport() Transport
}

type DialOpt

type DialOpt interface{}

type Dialer

type Dialer interface {
	Dial(raddr ma.Multiaddr) (Conn, error)
	Matches(ma.Multiaddr) bool
}

type Listener

type Listener interface {
	Accept() (Conn, error)
	Close() error
	Addr() net.Addr
	Multiaddr() ma.Multiaddr
}

type ReuseportOpt

type ReuseportOpt bool
var ReusePorts ReuseportOpt = true

type TcpTransport

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

func NewTCPTransport

func NewTCPTransport() *TcpTransport

func (*TcpTransport) Dialer

func (t *TcpTransport) Dialer(laddr ma.Multiaddr, opts ...DialOpt) (Dialer, error)

func (*TcpTransport) Listen

func (t *TcpTransport) Listen(laddr ma.Multiaddr) (Listener, error)

func (*TcpTransport) Matches

func (t *TcpTransport) Matches(a ma.Multiaddr) bool

type TimeoutOpt

type TimeoutOpt time.Duration

type Transport

type Transport interface {
	Dialer(laddr ma.Multiaddr, opts ...DialOpt) (Dialer, error)
	Listen(laddr ma.Multiaddr) (Listener, error)
	Matches(ma.Multiaddr) bool
}

Jump to

Keyboard shortcuts

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