1
0
forked from extern/smegmesh
smegmesh/pkg/ctrlserver/ctrltypes.go

54 lines
1.2 KiB
Go
Raw Normal View History

package ctrlserver
2023-09-19 14:45:49 +02:00
import (
2023-10-10 21:14:40 +02:00
"github.com/tim-beatham/wgmesh/pkg/conf"
2023-10-01 20:01:35 +02:00
"github.com/tim-beatham/wgmesh/pkg/conn"
"github.com/tim-beatham/wgmesh/pkg/mesh"
"github.com/tim-beatham/wgmesh/pkg/query"
2023-09-19 14:45:49 +02:00
"golang.zx2c4.com/wireguard/wgctrl"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
type MeshRoute struct {
Destination string
Path []string
}
// Represents a WireGuard MeshNode
type MeshNode struct {
2023-09-20 00:50:44 +02:00
HostEndpoint string
WgEndpoint string
PublicKey string
WgHost string
Timestamp int64
Routes []MeshRoute
2023-11-13 11:44:14 +01:00
Description string
Alias string
Services map[string]string
2023-09-19 14:45:49 +02:00
}
// Represents a WireGuard Mesh
2023-09-19 14:45:49 +02:00
type Mesh struct {
SharedKey *wgtypes.Key
Nodes map[string]MeshNode
}
2023-11-05 19:03:58 +01:00
type CtrlServer interface {
GetConfiguration() *conf.WgMeshConfiguration
GetClient() *wgctrl.Client
GetQuerier() query.Querier
GetMeshManager() mesh.MeshManager
Close() error
GetConnectionManager() conn.ConnectionManager
}
// Represents a ctrlserver to be used in WireGuard
type MeshCtrlServer struct {
Client *wgctrl.Client
2023-11-05 19:03:58 +01:00
MeshManager mesh.MeshManager
2023-10-05 18:48:54 +02:00
ConnectionManager conn.ConnectionManager
ConnectionServer *conn.ConnectionServer
2023-10-10 21:14:40 +02:00
Conf *conf.WgMeshConfiguration
Querier query.Querier
}