lib/keepalive_linux.go
raw| 1 | //go:build linux |
| 2 | |
| 3 | package lib |
| 4 | |
| 5 | import ( |
| 6 | "syscall" |
| 7 | ) |
| 8 | |
| 9 | func SetTcpKeepaliveProbes(fd, count int) error { |
| 10 | return syscall.SetsockoptInt( |
| 11 | fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPCNT, count) |
| 12 | } |
| 13 | |
| 14 | func SetTcpKeepaliveInterval(fd, interval int) error { |
| 15 | return syscall.SetsockoptInt( |
| 16 | fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, interval) |
| 17 | } |