summaryrefslogtreecommitdiffhomepage
path: root/tunnel/tools/libwg-go/service.go
diff options
context:
space:
mode:
Diffstat (limited to 'tunnel/tools/libwg-go/service.go')
-rw-r--r--tunnel/tools/libwg-go/service.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/tunnel/tools/libwg-go/service.go b/tunnel/tools/libwg-go/service.go
index 37fb4b40..6563772b 100644
--- a/tunnel/tools/libwg-go/service.go
+++ b/tunnel/tools/libwg-go/service.go
@@ -83,6 +83,29 @@ func (e *LibwgServiceImpl) Version(ctx context.Context, req *gen.VersionRequest)
return r, nil
}
+func (e *LibwgServiceImpl) SetConfig(ctx context.Context, req *gen.SetConfigRequest) (*gen.SetConfigResponse, error) {
+ handle, ok := tunnelHandles[req.Tunnel.Handle]
+ if !ok {
+ r := &gen.SetConfigResponse{
+ }
+ return r, nil
+ }
+ err := handle.device.IpcSet(req.Settings)
+
+ if err != nil {
+ r := &gen.SetConfigResponse{
+ Error: &gen.Error{
+ Message: fmt.Sprintln(err),
+ },
+ }
+ return r, nil
+ }
+
+ r := &gen.SetConfigResponse{
+ }
+ return r, nil
+}
+
func (e *LibwgServiceImpl) StopGrpc(ctx context.Context, req *gen.StopGrpcRequest) (*gen.StopGrpcResponse, error) {
if server != nil {
server.Stop()