desktop

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrApprovalPending = errors.New("host approval pending for network")

ErrApprovalPending is returned when a join request is awaiting admin approval.

View Source
var ErrApprovalRequired = errors.New("host approval required for network")

ErrApprovalRequired is returned when the user must request join before connecting.

View Source
var ErrDeviceBlocked = errors.New("access blocked: this device doesn't meet security requirements")

ErrDeviceBlocked is returned when posture checks block network access.

View Source
var ErrJITAccessRequired = errors.New("JIT access required: please request access from network admin")

ErrJITAccessRequired is returned when connect/join is blocked pending JIT approval.

View Source
var ErrNetworkNotConnected = errors.New("connect to the network before choosing an exit node")

ErrNetworkNotConnected is returned when exit list/select runs before the network is connected. Overlay VPN probes are the only ranking signal, so the mesh has to be up first.

Functions

func ApplyDesiredConnectedFlags

func ApplyDesiredConnectedFlags()

ApplyDesiredConnectedFlags sets node.Connected from persisted desired state without restarting. Call after Pull and before building the WireGuard iface so reboot / daemon reset comes up on the last connected networks.

func CancelDeviceNetworkJoinOnServer

func CancelDeviceNetworkJoinOnServer(network, token string) error

CancelDeviceNetworkJoinOnServer cancels a pending join approval request.

func ConnectNetwork

func ConnectNetwork(network, server, token string) error

ConnectNetwork joins (if needed) then connects locally.

func DropNetworkExitSelection

func DropNetworkExitSelection(network, token string) error

DropNetworkExitSelection clears the server exit on one network and leaves the saved exit for any other network in place.

func FetchDeviceNetworks

func FetchDeviceNetworks(server, token string) ([]models.DeviceNetwork, error)

FetchDeviceNetworks returns networks visible to the user from the server device API.

func GetDeviceSelectedExitNode

func GetDeviceSelectedExitNode(network, token string) (*models.DeviceExitNode, error)

GetDeviceSelectedExitNode returns the currently selected exit node, or nil if none. The network must be connected so health/latency come from the overlay probe.

func IsRegisteredToServer

func IsRegisteredToServer(server string) bool

IsRegisteredToServer reports whether netclient is fully registered to the given server. Partial Settings entries (API only, empty Server and TenantID) do not count; classic enrollments with Server set but empty TenantID do.

func JoinDeviceNetworkOnServer

func JoinDeviceNetworkOnServer(network, token string) (string, error)

JoinDeviceNetworkOnServer registers the host on a network via the device API. Returns join status: "joined".

func LeaveDeviceNetworkOnServer

func LeaveDeviceNetworkOnServer(network, token string) error

LeaveDeviceNetworkOnServer removes the host from a network via the device API.

func ListDeviceExitNodes

func ListDeviceExitNodes(network, token string) ([]models.DeviceExitNode, error)

ListDeviceExitNodes returns internet egress exit nodes available to this device on the network. The network must be connected so exits can be ranked by overlay VPN probes.

func ListDeviceExitNodesForUI

func ListDeviceExitNodesForUI(network, token string) ([]models.DeviceExitNode, error)

ListDeviceExitNodesForUI returns exit nodes for the desktop selector. With an active session it may run while disconnected so the GUI can show the restored exit name after logout/login; overlay latency probes still require a live mesh.

func NetworkRequiresAutoExit

func NetworkRequiresAutoExit(network, server, token string) (bool, error)

NetworkRequiresAutoExit reports whether the network forces auto exit selection.

func RegisterDeviceOnServer

func RegisterDeviceOnServer(server, token string) error

RegisterDeviceOnServer registers the host via the device REST API using a user JWT.

func RegisterSession

func RegisterSession(server, username, authToken, password, tenantID string) error

RegisterSession registers or refreshes a desktop UI session against a server. password is ignored (legacy desktop clients may still send it); authToken must be the user JWT. tenantID may be empty for classic non-MSP on-prem; MSP/SaaS should pass the workspace tenant.

func ReleaseSession

func ReleaseSession(clearServer bool, unregisterHost bool) error

ReleaseSession disconnects all networks and optionally clears server context. Currently connected networks (and exit selection) are saved so the next login can restore them. Local default routes are restored before disconnect so logout does not wait on a daemon restart for internet to return.

When unregisterHost is true (user/tenant handoff on PUT /session only), DELETE the host under the current session JWT after local disconnect. That lets a different user or MSP tenant enroll this machine next. Normal logout must pass unregisterHost=false so the same user can re-login without re-enrolling.

func RequestJITOnServer

func RequestJITOnServer(network, token, reason string) error

RequestJITOnServer submits a JIT access request via the server user JIT API.

func RestoreDesiredConnections

func RestoreDesiredConnections(username, tenantID string) error

RestoreDesiredConnections reconnects networks this user last had connected. Used after desktop login. Restarts the daemon once if anything changes.

func SelectDeviceExitNode

func SelectDeviceExitNode(network, token, egressID string) (*models.DeviceExitNode, error)

SelectDeviceExitNode selects or clears (empty egressID) the exit node for the device. Switching A→B is not done in one step: clear first (None), then assign. The server rejects a direct switch while RelayedBy still points at the current gateway. Peer/IGW routes are applied by the MQTT peer update; we do not pull here. Selecting an exit requires the network to be connected. Clearing is always allowed.

func SelectNearestDeviceExitNode

func SelectNearestDeviceExitNode(network, token string) (*models.DeviceExitNode, error)

SelectNearestDeviceExitNode lists exits, picks the nearest available one, and selects it. Persists auto_exit so session restore re-picks nearest rather than a fixed egress id. Switching A→B clears the current selection first (server rejects direct switch). Requires the network to be connected so ranking uses overlay VPN probes.

Waits for ExitOverlayProbeGrace after connect so latency samples are stable. Without this, UI Auto / enforced auto right after tunnel setup ranks on deferred or inflated RTTs and picks the wrong exit.

func SyncDeviceWithServer

func SyncDeviceWithServer(token string) error

SyncDeviceWithServer pulls host config (reset auto-relay + refresh peer cache) and applies it in-process. Peers are always replaced so tray Sync fully reconfigures WireGuard without a daemon restart.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL