aboutsummaryrefslogtreecommitdiffstats
path: root/lib/keepalive_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/keepalive_linux.go')
-rw-r--r--lib/keepalive_linux.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/keepalive_linux.go b/lib/keepalive_linux.go
new file mode 100644
index 00000000..0dc32850
--- /dev/null
+++ b/lib/keepalive_linux.go
@@ -0,0 +1,17 @@
+//+build linux
+
+package lib
+
+import (
+ "syscall"
+)
+
+func SetTcpKeepaliveProbes(fd, count int) error {
+ return syscall.SetsockoptInt(
+ fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPCNT, count)
+}
+
+func SetTcpKeepaliveInterval(fd, interval int) error {
+ return syscall.SetsockoptInt(
+ fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, interval)
+}