mirror of
https://github.com/jsimonetti/rtnetlink.git
synced 2026-03-30 17:32:04 +02:00
In order to update to v2.0.0, we need to update the module path per the Go module documentation. * https://go.dev/doc/modules/major-version Fixes: https://github.com/jsimonetti/rtnetlink/issues/225 This can be released as v2.0.1 Signed-off-by: SuperQ <superq@gmail.com>
26 lines
396 B
Go
26 lines
396 B
Go
package rtnetlink_test
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/jsimonetti/rtnetlink/v2"
|
|
)
|
|
|
|
// List all interfaces
|
|
func Example_listLink() {
|
|
// Dial a connection to the rtnetlink socket
|
|
conn, err := rtnetlink.Dial(nil)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
defer conn.Close()
|
|
|
|
// Request a list of interfaces
|
|
msg, err := conn.Link.List()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
log.Printf("%#v", msg)
|
|
}
|