net/dump: init
This adds netdump, a library which dumps the network configuration of a
Linux host via netlink and generates a Net specification from it.
Change-Id: I78007df1da4fbf24ba9128eb2e966df0dea9274e
Reviewed-on: https://review.monogon.dev/c/monogon/+/1231
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Leopold Schabel <leo@monogon.tech>
diff --git a/net/dump/cli/main.go b/net/dump/cli/main.go
new file mode 100644
index 0000000..2ad76e9
--- /dev/null
+++ b/net/dump/cli/main.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "fmt"
+ "log"
+
+ "google.golang.org/protobuf/encoding/prototext"
+
+ netdump "source.monogon.dev/net/dump"
+)
+
+func main() {
+ netconf, _, err := netdump.Dump()
+ if err != nil {
+ log.Fatalf("failed to dump network configuration: %v", err)
+ }
+ fmt.Println(prototext.Format(netconf))
+}