Involved Source Filesaddr.gocontrol_unix.go Package reuseport provides Listen and Dial functions that set socket
options in order to be able to reuse ports. You should only use this
package if you know what SO_REUSEADDR and SO_REUSEPORT are.
For example:
// listen on the same port. oh yeah.
l1, _ := reuse.Listen("tcp", "127.0.0.1:1234")
l2, _ := reuse.Listen("tcp", "127.0.0.1:1234")
// dial from the same port. oh yeah.
l1, _ := reuse.Listen("tcp", "127.0.0.1:1234")
l2, _ := reuse.Listen("tcp", "127.0.0.1:1235")
c, _ := reuse.Dial("tcp", "127.0.0.1:1234", "127.0.0.1:1235")
Note: cant dial self because tcp/ip stacks use 4-tuples to identify connections,
and doing so would clash.
Package-Level Functions (total 7)
Available returns whether or not SO_REUSEPORT or equivalent behaviour is
available in the OS.
Dial dials the given network and address. see net.Dial
Returns a net.Conn created from a file descriptor for a socket
with SO_REUSEPORT and SO_REUSEADDR option set.
Dial dials the given network and address, with the given timeout. see
net.DialTimeout Returns a net.Conn created from a file descriptor for
a socket with SO_REUSEPORT and SO_REUSEADDR option set.
Listen listens at the given network and address. see net.Listen
Returns a net.Listener created from a file discriptor for a socket
with SO_REUSEPORT and SO_REUSEADDR option set.
ListenPacket listens at the given network and address. see net.ListenPacket
Returns a net.Listener created from a file discriptor for a socket
with SO_REUSEPORT and SO_REUSEADDR option set.
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.