Closed g41797 closed 1 year ago
Yes - PRs welcome!
I wonder if Available
is used anywhere? code search doesn't surface any obvious uses of it, so it may just be a left over remnant.
I'd like to create N udp servers for the same port
Because on windows this functionality does not exist I should to call Available
in order to write portable code
Looks like Available will call control.available()
Also looks strange that for reuseaddr and reuseport returns 1 bool
your turn
I wonder if
Available
is used anywhere? code search doesn't surface any obvious uses of it, so it may just be a left over remnant.
btw what is the reason to require go 1.20?
btw what is the reason to require go 1.20?
It's our release policy to support the two most recent Go releases.
- leave Available as-is and add AvailReuseAddr & AvailReusePort or
- func Available() (reuseaddr, reuseport bool)
What's the use case for splitting it into two?
so something like:
// Available returns whether or not SO_REUSEADDR and SO_REUSEPORT are available in the OS.
func Available() (reuseaddr, reuseport bool) {
return available()
}
Again, what's the use case? What problem are you trying to solve?
because SO_REUSEADDR is not enough: "..traditional SO_REUSEADDR socket option already allows multiple UDP sockets to be bound to, and accept datagrams on, the same UDP port. However, by contrast with SO_REUSEPORT, SO_REUSEADDR does not prevent port hijacking and does not distribute datagrams evenly across the receiving threads" The SO_REUSEPORT socket option
That's not what we're using reuseport though. We only use it for TCP, to be able to run a listener and outgoing connections on the same port. I don't think we should get into the specifics of SO_REUSEPORT and SO_REUSEADDR, as they're highly platform specific.
no problem you got star and new fork
So for every os _SO_REUSEPORT_ is available
But for windows (see below) it does not exist
do you accept PRs?