Client FRP Manager
Language
- Go.
Runtime Context
- Client launcher for the bundled
frpctransient systemd unit.
Purpose
- Starts/stops the FRPC transient systemd unit, passes runtime template values to frpc, checks connection state through systemd, and reports state to heartbeat payloads.
Key Files
packages/client/internal/frp/manager.gopackages/client/internal/frp/types.gopackages/client/internal/frp/manager_test.gopackages/client/cmd/nixstasis/frp_session.gopackages/client/cmd/nixstasis/frp_session_test.gopackages/client/build/root-dir/usr/share/nixstasis/frpc.tomlpackages/client/internal/config/config.gopackages/client/cmd/nixstasis/poll.go
Public Interfaces
- Types:
ManagerConnectionStatus
- Functions and methods:
NewManager(*Manager).Start(*Manager).Stop(*Manager).IsActive(*Manager).GetStatusconfig.FRPCBinaryPathconfig.FRPCConfigPath
Dependencies
Internal
internal/config
External
- OS process execution via
os/exec. - systemd transient units via
systemd-runandsystemctl.
Client-Server Interaction Details
- Heartbeat responses include
remote_access_tokenonly while remote access is requested for the device. - If
remote_access_tokenis non-empty and FRP is inactive,pollOncestarts thenixstasis-frpctransient unit using configured non-secret FRP values and the heartbeat token. - If
remote_access_tokenis absent or empty and FRP is active,pollOncestops FRPC. - If the heartbeat token changes while FRP is active,
pollOncerestarts FRPC with the current token. - FRP status is included in subsequent heartbeat requests as
connection_status. frpc.tomlremains client-owned in/usr/share/nixstasis/frpc.tomland frpc expands{{ .Envs.* }}placeholders from the session environment.- FRPS auth is passed to the transient unit as a systemd credential and converted
to
FRPS_AUTH_TOKENinsidefrp-session, avoiding token exposure insystemd-run --setenvmetadata.
Traceable references:
packages/client/internal/frp/manager.gopackages/client/cmd/nixstasis/frp_session.gopackages/client/cmd/nixstasis/poll.gopackages/client/internal/config/config.go