smegmesh/pkg/ctrlserver/ctrltypes.go

37 lines
691 B
Go
Raw Normal View History

package ctrlserver
2023-09-19 14:45:49 +02:00
import (
2023-10-01 20:01:35 +02:00
"github.com/tim-beatham/wgmesh/pkg/auth"
"github.com/tim-beatham/wgmesh/pkg/conn"
2023-09-19 14:45:49 +02:00
"golang.zx2c4.com/wireguard/wgctrl"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
/*
* 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
}
/*
* Defines the mesh control server this node
* is running
*/
type MeshCtrlServer struct {
2023-10-01 20:01:35 +02:00
Client *wgctrl.Client
Meshes map[string]Mesh
IfName string
Conn *conn.WgCtrlConnection
JwtManager *auth.JwtManager
2023-10-01 21:14:09 +02:00
TokenManager *auth.TokenManager
}