github.com/xxf098/lite-proxy@v0.15.1-0.20230422081941-12c69f323218/transport/dialer/sockopt_linux.go (about) 1 // +build linux 2 3 package dialer 4 5 import ( 6 "syscall" 7 8 "github.com/xxf098/lite-proxy/common" 9 "golang.org/x/sys/unix" 10 ) 11 12 func setReusePort(fd uintptr) error { 13 if err := syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil { 14 return common.NewError("failed to set SO_REUSEPORT").Base(err) 15 } 16 return nil 17 }