Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var EnvReuseportVal = true
EnvReuseportVal stores the value of envReuseport. defaults to true.
var ErrListenerExists = errors.New("listener already exists for this conn type on this address")
Functions ¶
func IsMultistreamSelect ¶
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 ConnMgr ¶
type ConnMgr struct {
// contains filtered or unexported fields
}
ConnMgr enables you to share the same listen address between TCP and WebSocket transports.
func NewConnMgr ¶
func NewConnMgr(enableReuseport bool, gater connmgr.ConnectionGater, rcmgr network.ResourceManager) *ConnMgr
func (*ConnMgr) DemultiplexedListen ¶
func (t *ConnMgr) DemultiplexedListen(laddr ma.Multiaddr, connType DemultiplexedConnType) (manet.Listener, error)
DemultiplexedListen returns a listener for laddr listening for `connType` connections. The connections accepted from returned listeners need to be upgraded with a `transport.Upgrader`. NOTE: All listeners for port 0 share the same underlying socket, so they have the same specific port.
type DemultiplexedConnType ¶
type DemultiplexedConnType int
const ( DemultiplexedConnType_Unknown DemultiplexedConnType = iota DemultiplexedConnType_MultistreamSelect DemultiplexedConnType_HTTP DemultiplexedConnType_TLS )
func (DemultiplexedConnType) IsKnown ¶
func (t DemultiplexedConnType) IsKnown() bool
func (DemultiplexedConnType) String ¶
func (t DemultiplexedConnType) String() string