2023-09-18 16:52:28 +02:00
|
|
|
package ctrlserver
|
|
|
|
|
2023-09-19 14:45:49 +02:00
|
|
|
import (
|
|
|
|
"golang.zx2c4.com/wireguard/wgctrl"
|
|
|
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
|
|
|
)
|
2023-09-18 16:52:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Represents a WireGuard node
|
|
|
|
*/
|
|
|
|
type MeshNode struct {
|
2023-09-20 00:50:44 +02:00
|
|
|
HostEndpoint string
|
|
|
|
WgEndpoint string
|
|
|
|
PublicKey string
|
|
|
|
WgHost string
|
2023-09-19 14:45:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type Mesh struct {
|
|
|
|
SharedKey *wgtypes.Key
|
|
|
|
Nodes map[string]MeshNode
|
2023-09-18 16:52:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defines the mesh control server this node
|
|
|
|
* is running
|
|
|
|
*/
|
|
|
|
type MeshCtrlServer struct {
|
2023-09-19 14:45:49 +02:00
|
|
|
Client *wgctrl.Client
|
|
|
|
Meshes map[string]Mesh
|
2023-09-20 00:50:44 +02:00
|
|
|
IfName string
|
2023-09-18 16:52:28 +02:00
|
|
|
}
|