package tcpreuse

Import Path
	github.com/libp2p/go-libp2p/p2p/transport/tcpreuse (on go.dev)

Dependency Relation
	imports 16 packages, and imported by 3 packages


Package-Level Type Names (total 3)
/* sort by: | */
ConnMgr enables you to share the same listen address between TCP and WebSocket transports. 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. DialContext is like Dial but takes a context. func NewConnMgr(enableReuseport bool, upgrader transport.Upgrader) *ConnMgr func github.com/libp2p/go-libp2p/p2p/transport/tcp.NewTCPTransport(upgrader transport.Upgrader, rcmgr network.ResourceManager, sharedTCP *ConnMgr, opts ...tcp.Option) (*tcp.TcpTransport, error) func github.com/libp2p/go-libp2p/p2p/transport/websocket.New(u transport.Upgrader, rcmgr network.ResourceManager, sharedTCP *ConnMgr, opts ...websocket.Option) (*websocket.WebsocketTransport, error)
( DemultiplexedConnType) IsKnown() bool ( DemultiplexedConnType) String() string DemultiplexedConnType : expvar.Var DemultiplexedConnType : fmt.Stringer func (*ConnMgr).DemultiplexedListen(laddr ma.Multiaddr, connType DemultiplexedConnType) (transport.GatedMaListener, error) const DemultiplexedConnType_HTTP const DemultiplexedConnType_MultistreamSelect const DemultiplexedConnType_TLS const DemultiplexedConnType_Unknown
Matchers are implemented here instead of in the transports so we can easily fuzz them together.
Package-Level Functions (total 5)
func IsHTTP(s Prefix) bool
func IsTLS(s Prefix) bool
func NewConnMgr(enableReuseport bool, upgrader transport.Upgrader) *ConnMgr
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.
Package-Level Variables (total 2)
EnvReuseportVal stores the value of envReuseport. defaults to true.