Documentation
¶
Index ¶
- func DirSize(path string) string
- func Download(url, dest string) error
- func DownloadRequireTor(url, dest string) error
- func IsServiceActive(name string) bool
- func ParseSourceIP(routeOutput string) string
- func PublicIPv4() string
- func ReadFileRoot(path string) ([]byte, error)
- func ReadPublicIPv4(ctx context.Context) (string, error)
- func ReadRebootRequired() (bool, error)
- func ReadServiceActive(ctx context.Context, name string) (bool, error)
- func ReadServiceState(ctx context.Context, name string) (string, error)
- func RebootRequired() bool
- func Run(name string, args ...string) error
- func RunCombinedOutput(name string, args ...string) (string, error)
- func RunOutput(name string, args ...string) (string, error)
- func RunOutputWithTimeout(timeout time.Duration, name string, args ...string) (string, error)
- func RunRoot(name string, args ...string) error
- func RunRootCombinedOutput(name string, args ...string) (string, error)
- func RunRootOutput(name string, args ...string) (string, error)
- func RunRootOutputWithTimeout(timeout time.Duration, name string, args ...string) (string, error)
- func RunRootSilent(name string, args ...string) error
- func RunSilent(name string, args ...string) error
- func ServiceAction(name, action string) error
- func WriteFileRoot(path string, content []byte, perm os.FileMode) error
- type DiskInfo
- type MemInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirSize ¶
DirSize measures a directory tree with du. Root only: the data directories it is used on belong to service users. The unprivileged status screen gets the LND size through the helper's dir-size operation (which calls this as root) and the Bitcoin size from bitcoind's own RPC — it never calls this directly.
func Download ¶
Download fetches a URL to a local path using torsocks if available. It does not require Tor.
func DownloadRequireTor ¶
DownloadRequireTor fetches a URL and fails if torsocks is unavailable. It makes up to three attempts, with two-second gaps. Tool-specific limits apply within each attempt; the wget path has no overall deadline.
func IsServiceActive ¶
func ParseSourceIP ¶
ParseSourceIP extracts the source IP from "ip route get" output. Exported for testing.
func PublicIPv4 ¶
func PublicIPv4() string
PublicIPv4 returns the server's public IPv4 address. Uses the kernel routing table (no network call) and caches the result. Only relevant in hybrid (clearnet+tor) P2P mode.
func ReadFileRoot ¶
ReadFileRoot requires the process to be root and returns os.ReadFile's result, preserving errors for os.IsNotExist checks. Ordinary unprivileged TUI reads use staged files; separate helper operations can refresh privileged evidence.
func ReadRebootRequired ¶
func ReadServiceActive ¶
ReadServiceActive separates an inactive unit from a failed systemd query.
func ReadServiceState ¶
ReadServiceState retains transitional states for mutation postconditions.
func RebootRequired ¶
func RebootRequired() bool
func RunCombinedOutput ¶
RunCombinedOutput executes a command and returns combined stdout+stderr. Used for GPG commands which write status to stderr.
func RunOutputWithTimeout ¶
RunOutputWithTimeout returns trimmed stdout on success using its own timeout; it does not accept a caller context. Output is discarded on error. Expiry interrupts the command, but descendant-held output pipes can delay return because no WaitDelay is set.
func RunRootCombinedOutput ¶
RunRootCombinedOutput requires root and returns combined stdout and stderr, trimmed on success and untrimmed on command failure.
func RunRootOutput ¶
RunRootOutput requires root and returns trimmed stdout on success. Output is discarded on error.
func RunRootOutputWithTimeout ¶
RunRootOutputWithTimeout requires root and uses RunOutputWithTimeout's output and timeout behavior, including its output-pipe wait limitation.
func RunRootSilent ¶
RunRootSilent requires root and executes a command, discarding all output.
func ServiceAction ¶
func WriteFileRoot ¶
WriteFileRoot creates a private, exclusive input temporary file, then requires root to install its content and mode at a fixed .<base>.tmp destination and move that file onto path. Callers must ensure the destination is suitable. The destination staging name is not exclusive, close errors are ignored and files are not fsynced; this is not a general crash-safe replacement primitive. Install and move failures are logged centrally.