mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-08-09 13:24:52 +02:00
Stubbing out WireGuard components
Stubbing our WireGuard components so that I can use docker/podman network_mode=host. This is much more efficient than the docker/podman userspace network.
This commit is contained in:
@ -2,6 +2,7 @@ package robin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
@ -10,6 +11,7 @@ import (
|
||||
"github.com/tim-beatham/wgmesh/pkg/ctrlserver"
|
||||
"github.com/tim-beatham/wgmesh/pkg/ipc"
|
||||
"github.com/tim-beatham/wgmesh/pkg/mesh"
|
||||
"github.com/tim-beatham/wgmesh/pkg/query"
|
||||
"github.com/tim-beatham/wgmesh/pkg/rpc"
|
||||
)
|
||||
|
||||
@ -242,6 +244,27 @@ func (n *IpcHandler) DeleteService(service string, reply *string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *IpcHandler) GetNode(args ipc.GetNodeArgs, reply *string) error {
|
||||
node := n.Server.GetMeshManager().GetNode(args.MeshId, args.NodeId)
|
||||
|
||||
if node == nil {
|
||||
*reply = "nil"
|
||||
return nil
|
||||
}
|
||||
|
||||
queryNode := query.MeshNodeToQueryNode(node)
|
||||
|
||||
bytes, err := json.Marshal(queryNode)
|
||||
|
||||
if err != nil {
|
||||
*reply = err.Error()
|
||||
return nil
|
||||
}
|
||||
|
||||
*reply = string(bytes)
|
||||
return nil
|
||||
}
|
||||
|
||||
type RobinIpcParams struct {
|
||||
CtrlServer ctrlserver.CtrlServer
|
||||
}
|
||||
|
Reference in New Issue
Block a user