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)
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.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.