sing/common/control/reuse_windows.go
2022-08-16 17:47:48 +08:00

13 lines
283 B
Go

package control
import (
"syscall"
)
func ReuseAddr() Func {
return func(network, address string, conn syscall.RawConn) error {
return Raw(conn, func(fd uintptr) error {
return syscall.SetsockoptInt(syscall.Handle(fd), syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
})
}
}