github.com/kelleygo/clashcore@v1.0.2/component/dialer/reuse_windows.go (about) 1 package dialer 2 3 import ( 4 "context" 5 "net" 6 "syscall" 7 8 "golang.org/x/sys/windows" 9 ) 10 11 func addrReuseToListenConfig(lc *net.ListenConfig) { 12 addControlToListenConfig(lc, func(ctx context.Context, network, address string, c syscall.RawConn) error { 13 return c.Control(func(fd uintptr) { 14 windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_REUSEADDR, 1) 15 }) 16 }) 17 }