-
Notifications
You must be signed in to change notification settings - Fork 1
Zerotierlib DOCS v.1.4
Documentation for the internal library of ZT Manager. This library handles all interactions with the ZeroTier system service and the local JSON API.
These dependencies are managed automatically within the Flatpak environment:
- requests: Handles HTTP requests to the local ZeroTier API.
-
pydbus: Securely manages the
zerotier-one.servicestatus via D-Bus (systemd). - psutil: Used for process management and monitoring.
- pathlib: Modern file path handling (native Python 3).
-
subprocess: Executes host commands (like
pkexec) viaflatpak-spawn.
Note
No requirements.txt needed: Since ZT Manager is distributed via Flatpak, all dependencies are declared in the manifest JSON.
The core class to interact with ZeroTier. It supports both Host Mode (automatic token retrieval) and Manual Mode (user-provided tokens).
-
COMMANDS:('start', 'stop', 'enable', 'disable') -
BASE_URL:http://localhost:9993/ -
PATH:~/.config/ztlib/(User configuration folder) -
FILE:zt.conf(Persistence file) -
SERVICE:zerotier-one.service
Initializes the instance. It automatically calls read_token() to load saved settings and tokens.
Checks if the zerotier-one binary is present on the host system.
Returns True if the ZeroTier service is currently active on the host.
Returns True if the service is enabled to start on boot.
Changes the system service state.
startstopenable-
disableUses D-Bus for safe interaction with the system bus.
Loads configuration from zt.conf.
- 200: Success (Token loaded and validated).
- 401: Unauthorized (Token invalid).
- 404: Config file missing.
- If
host_modeis enabled, it automatically triggersget_token().
Attempts to read /var/lib/zerotier-one/authtoken.secret from the host using pkexec. Requires user authentication.
Saves the current token and host_mode state to the config file with secure permissions (0600).
Retrieves a list of all joined networks or details of a specific one.
Joins a new ZeroTier network.
Leaves and forgets a ZeroTier network.
Returns a list of all peers/nodes currently known by the local service.
Updates settings for a specific network.
-
self.host_mode: Whether the app is in "Host Mode" (auto-fetching tokens). -
self.api_token: The current token used forX-ZT1-Authheaders.
Documentation updated on May 12, 2026, for ZT Manager v2.0.2 Stable.