//go:build !windows package cat import "golang.org/x/sys/unix" // setSocketReuse is the Unix half of the Windows SO_REUSEADDR above. Linux // wants SO_REUSEPORT as well before two processes may share a bound UDP port; // it is not defined on every Unix, so a refusal there is ignored. func setSocketReuse(fd uintptr) error { if err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1); err != nil { return err } _ = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1) return nil }