package reuseport

Import Path
	github.com/libp2p/go-libp2p/p2p/net/reuseport (on go.dev)

Dependency Relation
	imports 12 packages, and imported by 2 packages

Involved Source Files dial.go dialer.go listen.go reuseport.go reuseport_posix.go Package reuseport provides a basic transport for automatically (and intelligently) reusing TCP ports. To use, construct a new Transport and configure listeners tr.Listen(...). When dialing (tr.Dial(...)), the transport will attempt to reuse the ports it's currently listening on, choosing the best one depending on the destination address. It is recommended to set SO_LINGER to 0 for all connections, otherwise reusing the port may fail when re-dialing a recently closed connection. See https://hea-www.harvard.edu/~fine/Tech/addrinuse.html for details.
Package-Level Type Names (only one)
/* sort by: | */
Transport is a TCP reuse transport that reuses listener ports. The zero value is safe to use. Dial dials the given multiaddr, reusing ports we're currently listening on if possible. Dial attempts to be smart about choosing the source port. For example, If we're dialing a loopback address and we're listening on one or more loopback ports, Dial will randomly choose one of the loopback ports and addresses and reuse it. DialContext is like Dial but takes a context. Listen listens on the given multiaddr. If reuseport is supported, it will be enabled for this listener and future dials from this transport may reuse the port. Note: You can listen on the same multiaddr as many times as you want (although only *one* listener will end up handling the inbound connection).
Package-Level Variables (only one)
ErrWrongProto is returned when dialing a protocol other than tcp.