Documentation ¶
Index ¶
- Variables
- func ReuseportIsAvailable() bool
- type TcpTransport
- func (t *TcpTransport) CanDial(addr ma.Multiaddr) bool
- func (t *TcpTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tpt.Conn, error)
- func (t *TcpTransport) Listen(laddr ma.Multiaddr) (tpt.Listener, error)
- func (t *TcpTransport) Protocols() []int
- func (t *TcpTransport) Proxy() bool
- func (t *TcpTransport) String() string
- func (t *TcpTransport) 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:
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 TcpTransport ¶
type TcpTransport 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 }
TcpTransport is the TCP transport.
func NewTCPTransport ¶
func NewTCPTransport(upgrader *tptu.Upgrader) *TcpTransport
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) 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.