summaryrefslogtreecommitdiff
path: root/internal/failover/ping.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-02-12 19:18:05 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-02-19 14:15:07 +0100
commit74e36f0ead717105f26087c2cab08b41ba5a7ce8 (patch)
tree1eb2b7516bea705c9b5a50ce0965e170414ed880 /internal/failover/ping.go
parent682d70091af2044ff6d8b350da9dff13163232e2 (diff)
All: Document everything to pass revive lint
Diffstat (limited to 'internal/failover/ping.go')
-rw-r--r--internal/failover/ping.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/failover/ping.go b/internal/failover/ping.go
index 3b5faa8..59dbcc9 100644
--- a/internal/failover/ping.go
+++ b/internal/failover/ping.go
@@ -13,12 +13,14 @@ import (
// mtuOverhead defines the total MTU overhead for an ICMP ECHO message: 20 bytes IP header + 8 bytes ICMP header
var mtuOverhead = 28
+// Pinger sends pings
type Pinger struct {
listener net.PacketConn
buffer []byte
gateway net.Addr
}
+// Read reads from the ping listener with deadline `deadline`
func (p Pinger) Read(deadline time.Time) error {
// First set the deadline to read
err := p.listener.SetReadDeadline(deadline)
@@ -43,6 +45,7 @@ func (p Pinger) Read(deadline time.Time) error {
}
}
+// Send sends a single ping
func (p Pinger) Send(seq int) error {
errorMessage := fmt.Sprintf("failed sending ping, seq %d", seq)
// Make a new ICMP message