Documentation ¶
Index ¶
- Variables
- func ReuseportIsAvailable() bool
- type Transport
- func (t *Transport) CanDial(addr ma.Multiaddr) bool
- func (t *Transport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (transport.CapableConn, error)
- func (t *Transport) Listen(laddr ma.Multiaddr) (transport.Listener, error)
- func (t *Transport) Protocols() []int
- func (t *Transport) Proxy() bool
- func (t *Transport) String() string
- func (t *Transport) UseReuseport() bool
Constants ¶
This section is empty.
Variables ¶
var DefaultConnectTimeout = 5 * time.Second
DefaultConnectTimeout is the (default) maximum amount of time the TCP transport will spend on the initial TCP connect before giving up.
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 Transport ¶
type Transport struct { // Connection upgrader for upgrading insecure stream connections to // secure multiplex connections. Upgrader *tptu.Upgrader // Explicitly disable reuseport. DisableReuseport bool // TCP connect timeout ConnectTimeout time.Duration // contains filtered or unexported fields }
Transport is the TCP transport.
func NewTCPTransport ¶
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 (*Transport) CanDial ¶
CanDial returns true if this transport believes it can dial the given multiaddr.
func (*Transport) Dial ¶
func (t *Transport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (transport.CapableConn, error)
Dial dials the peer at the remote address.
func (*Transport) Protocols ¶
Protocols returns the list of terminal protocols this transport can dial.
func (*Transport) UseReuseport ¶
UseReuseport returns true if reuseport is enabled and available.