2019-06-09 07:24:20 +00:00
|
|
|
package reuseport
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"golang.org/x/sys/windows"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Control(network, address string, c syscall.RawConn) (err error) {
|
2023-06-30 13:41:32 +00:00
|
|
|
controlErr := c.Control(func(fd uintptr) {
|
2019-06-09 07:24:20 +00:00
|
|
|
err = windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_REUSEADDR, 1)
|
|
|
|
})
|
2023-06-30 13:41:32 +00:00
|
|
|
if controlErr != nil {
|
|
|
|
err = controlErr
|
|
|
|
}
|
|
|
|
return
|
2019-06-09 07:24:20 +00:00
|
|
|
}
|