mirror of
https://github.com/vishvananda/netlink.git
synced 2025-09-27 04:05:59 +08:00
Implement unix socket diagnostics
This commit is contained in:

committed by
Alessandro Boch

parent
a008cbde48
commit
ec7bcb248e
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user