mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

``` gofmt' started at Thu Mar 18 18:06:00 UTC 2021 transport/sockopt_unix.go diff -u transport/sockopt_unix.go.orig transport/sockopt_unix.go --- transport/sockopt_unix.go.orig 2021-03-18 18:06:01.667483834 +0000 +++ transport/sockopt_unix.go 2021-03-18 18:06:01.667483834 +0000 @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package transport transport/sockopt_windows.go diff -u transport/sockopt_windows.go.orig transport/sockopt_windows.go --- transport/sockopt_windows.go.orig 2021-03-18 18:06:01.667483834 +0000 +++ transport/sockopt_windows.go 2021-03-18 18:06:01.667483834 +0000 @@ -1,3 +1,4 @@ +//go:build windows // +build windows ```
22 lines
499 B
Go
22 lines
499 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package transport
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
"syscall"
|
|
)
|
|
|
|
func setReusePort(network, address string, conn syscall.RawConn) error {
|
|
return conn.Control(func(fd uintptr) {
|
|
syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1)
|
|
})
|
|
}
|
|
|
|
func setReuseAddress(network, address string, conn syscall.RawConn) error {
|
|
return conn.Control(func(fd uintptr) {
|
|
syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEADDR, 1)
|
|
})
|
|
}
|