This commit is contained in:
Kekskurse 2021-05-14 16:27:10 +02:00
commit 347b902cf0
Signed by: kekskurse
GPG key ID: 728ACCB59341E7E4
2 changed files with 37 additions and 0 deletions

11
Readme.md Normal file
View file

@ -0,0 +1,11 @@
#GoWgPKG
git.keks.cloud/kekskurse/gowgpkg
Go Package to configure Wireguard on Linux
* Create Devices
* Configure Device
* Create Wireguard
* Configure wireguard
* Provides Structs with all needed information

26
devices.go Normal file
View file

@ -0,0 +1,26 @@
package gowgpkg
import (
"fmt"
"golang.zx2c4.com/wireguard/wgctrl"
)
type Device struct {
}
func ListDevices() ([]Device, error) {
client, err := wgctrl.New()
if err != nil {
return nil, fmt.Errorf("Can't create wgctrl Client: %w", err)
}
devices, err := client.Devices()
if err != nil {
return nil, fmt.Errorf("Can't get list of devices: %w", err)
}
fmt.Println(devices)
return nil, nil
}