transport

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 FallbackDialer

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

func (*FallbackDialer) Dial

func (fbd *FallbackDialer) Dial(a ma.Multiaddr) (Conn, error)

func (*FallbackDialer) Matches

func (fbd *FallbackDialer) Matches(a 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
}

type UtpSocket

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

func (*UtpSocket) Accept

func (s *UtpSocket) Accept() (Conn, error)

func (*UtpSocket) Addr

func (t *UtpSocket) Addr() net.Addr

func (*UtpSocket) Close

func (t *UtpSocket) Close() error

func (*UtpSocket) Dial

func (s *UtpSocket) Dial(raddr ma.Multiaddr) (Conn, error)

func (*UtpSocket) Matches

func (s *UtpSocket) Matches(a ma.Multiaddr) bool

func (*UtpSocket) Multiaddr

func (t *UtpSocket) Multiaddr() ma.Multiaddr

type UtpTransport

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

func NewUtpTransport

func NewUtpTransport() *UtpTransport

func (*UtpTransport) Dialer

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

func (*UtpTransport) Listen

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

func (*UtpTransport) Matches

func (d *UtpTransport) Matches(a ma.Multiaddr) bool

Jump to

Keyboard shortcuts

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