2023-09-18 16:52:28 +02:00
|
|
|
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"
|
2023-10-22 14:34:49 +02:00
|
|
|
"github.com/tim-beatham/wgmesh/pkg/mesh"
|
2023-09-19 14:45:49 +02:00
|
|
|
"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-10-24 17:00:46 +02:00
|
|
|
Timestamp int64
|
2023-10-25 19:34:38 +02:00
|
|
|
Routes []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-10-02 17:03:41 +02:00
|
|
|
Client *wgctrl.Client
|
2023-10-26 17:53:12 +02:00
|
|
|
MeshManager *mesh.MeshManager
|
2023-10-05 18:48:54 +02:00
|
|
|
ConnectionManager conn.ConnectionManager
|
2023-10-02 17:03:41 +02:00
|
|
|
ConnectionServer *conn.ConnectionServer
|
2023-10-10 21:14:40 +02:00
|
|
|
Conf *conf.WgMeshConfiguration
|
2023-09-18 16:52:28 +02:00
|
|
|
}
|