All the Listeners from the bind folder should have the option of being created with SO_REUSEPORT, so a Config should look like:
// Config is the configuration for Bind()
type Config struct {
.......
Port uint16
// PortStrict tells us not to try other ports
PortStrict bool
// PortAttempts indicates how many times we will try finding a port
PortAttempts int
// Defaultport indicates the port to try on the first attempt if Port is zero
DefaultPort uint16
// PortReuse indicates that the listener is able to reuse the port between threads/processes
PortReuse bool
.....
// ListenTCP is the helper to use to listen on TCP ports
ListenTCP func(network string, laddr *net.TCPAddr) (*net.TCPListener, error)
// ListenUDP is the helper to use to listen on UDP ports
ListenUDP func(network string, laddr *net.UDPAddr) (*net.UDPConn, error)
.......
}
also default ListenTCP and ListenUDP should be created
All the Listeners from the bind folder should have the option of being created with
SO_REUSEPORT
, so aConfig
should look like:also default
ListenTCP
andListenUDP
should be createdwith
Control
function implemented for windows, linux, unixexample for unix: