diff options
Diffstat (limited to 'server/sockopt_openbsd.go')
-rw-r--r-- | server/sockopt_openbsd.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/server/sockopt_openbsd.go b/server/sockopt_openbsd.go index 1adbaf94..5ce1b7ef 100644 --- a/server/sockopt_openbsd.go +++ b/server/sockopt_openbsd.go @@ -363,16 +363,11 @@ func setsockoptTcpMD5Sig(fd int, address string, key string) error { } func SetTcpMD5SigSockopt(l *net.TCPListener, address string, key string) error { - fi, err := l.File() + fi, _, err := extractFileAndFamilyFromTCPListener(l) defer fi.Close() if err != nil { return err } - fl, err := net.FileListener(fi) - defer fl.Close() - if err != nil { - return err - } return setsockoptTcpMD5Sig(int(fi.Fd()), address, key) } @@ -386,6 +381,15 @@ func setsockoptIpTtl(fd int, family int, value int) error { return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, level, name, value)) } +func SetListenTcpTTLSockopt(l *net.TCPListener, ttl int) error { + fi, family, err := extractFileAndFamilyFromTCPListener(l) + defer fi.Close() + if err != nil { + return err + } + return setsockoptIpTtl(int(fi.Fd()), family, ttl) +} + func SetTcpTTLSockopt(conn *net.TCPConn, ttl int) error { fi, family, err := extractFileAndFamilyFromTCPConn(conn) defer fi.Close() |