tcp

package
v0.0.0-...-a4f63c7 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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:

LIBP2P_TCP_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 Option

type Option func(*TcpTransport) error

func DisableReuseport

func DisableReuseport() Option

func WithConnectionTimeout

func WithConnectionTimeout(d time.Duration) Option

func WithMetrics

func WithMetrics() Option

type TcpTransport

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

TcpTransport is the TCP transport.

func NewTCPTransport

func NewTCPTransport(upgrader transport.Upgrader, rcmgr network.ResourceManager, opts ...Option) (*TcpTransport, error)

NewTCPTransport creates a tcp transport object that tracks dialers and listeners created. It represents an entire TCP stack (though it might not necessarily be).

func (*TcpTransport) CanDial

func (t *TcpTransport) CanDial(addr ma.Multiaddr) bool

CanDial returns true if this transport believes it can dial the given multiaddr.

func (*TcpTransport) Dial

Dial dials the peer at the remote address.

func (*TcpTransport) Listen

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

Listen listens on the given multiaddr.

func (*TcpTransport) Protocols

func (t *TcpTransport) Protocols() []int

Protocols returns the list of terminal protocols this transport can dial.

func (*TcpTransport) Proxy

func (t *TcpTransport) Proxy() bool

Proxy always returns false for the TCP transport.

func (*TcpTransport) String

func (t *TcpTransport) String() string

func (*TcpTransport) UseReuseport

func (t *TcpTransport) UseReuseport() bool

UseReuseport returns true if reuseport is enabled and available.

Jump to

Keyboard shortcuts

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