[management, client] Add logout feature (#4268)

This commit is contained in:
Viktor Liu
2025-08-04 10:17:36 +02:00
committed by GitHub
parent 552dc60547
commit b5ed94808c
18 changed files with 710 additions and 125 deletions

View File

@@ -13,6 +13,7 @@ import (
"fyne.io/systray"
log "github.com/sirupsen/logrus"
"github.com/netbirdio/netbird/client/proto"
"github.com/netbirdio/netbird/version"
)
@@ -231,3 +232,19 @@ func (h *eventHandler) runSelfCommand(ctx context.Context, command, arg string)
log.Printf("command '%s %s' completed successfully", command, arg)
}
func (h *eventHandler) logout(ctx context.Context) error {
client, err := h.client.getSrvClient(defaultFailTimeout)
if err != nil {
return fmt.Errorf("failed to get service client: %w", err)
}
_, err = client.Logout(ctx, &proto.LogoutRequest{})
if err != nil {
return fmt.Errorf("logout failed: %w", err)
}
h.client.getSrvConfig()
return nil
}