mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
18 lines
386 B
Go
18 lines
386 B
Go
package dialer
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func addrReuseToListenConfig(lc *net.ListenConfig) {
|
|
addControlToListenConfig(lc, func(ctx context.Context, network, address string, c syscall.RawConn) error {
|
|
return c.Control(func(fd uintptr) {
|
|
windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_REUSEADDR, 1)
|
|
})
|
|
})
|
|
}
|