Implement unix socket diagnostics

This commit is contained in:
Sven Rebhan
2023-11-15 23:05:25 +01:00
committed by Alessandro Boch
parent a008cbde48
commit ec7bcb248e
4 changed files with 197 additions and 4 deletions

View File

@@ -4,6 +4,7 @@
package netlink
import (
"fmt"
"log"
"net"
"os/user"
@@ -91,3 +92,18 @@ func TestSocketDiagUDPnfo(t *testing.T) {
}
}
}
func TestUnixSocketDiagInfo(t *testing.T) {
want := syscall.AF_UNIX
result, err := UnixSocketDiagInfo()
if err != nil {
t.Fatal(err)
}
for i, r := range result {
fmt.Println(r.DiagMsg)
if got := r.DiagMsg.Family; got != uint8(want) {
t.Fatalf("%d: protocol family = %v, want %v", i, got, want)
}
}
}