github.com/sagernet/sing@v0.4.0-beta.19.0.20240518125136-f67a0988a636/common/control/reuse_windows.go (about) 1 package control 2 3 import ( 4 "syscall" 5 ) 6 7 func ReuseAddr() Func { 8 return func(network, address string, conn syscall.RawConn) error { 9 return Raw(conn, func(fd uintptr) error { 10 return syscall.SetsockoptInt(syscall.Handle(fd), syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1) 11 }) 12 } 13 }