Initial setup and test

Set up wgctrl library
Simple create device and if it exists list the number of clients
This commit is contained in:
2026-03-01 19:02:06 +01:00
parent 8d60a4fb74
commit e6098c9b50
4 changed files with 60 additions and 0 deletions

20
main.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"fmt"
"log"
"golang.zx2c4.com/wireguard/wgctrl"
)
func main() {
client, _ := wgctrl.New()
defer client.Close()
dev, err := client.Device("wg0")
if err != nil {
log.Fatalf("get device error: %v", err)
}
fmt.Printf("Device %s has %d peers\n", dev.Name, len(dev.Peers))
}