cli

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cli 提供 xray-agent 的管理子命令:status / restart / logs / uninstall / help。 无参数或 run 走主循环(见 cmd/agent/main.go)。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSubcommand

func IsSubcommand(arg string) bool

IsSubcommand 判断第一个参数是否为已知子命令或帮助别名。

func IsSystemdManaged

func IsSystemdManaged() bool

IsSystemdManaged 判断本机是否安装了 xray-agent 的 systemd 单元(无论服务是否在运行)。

func IsSystemdService

func IsSystemdService() bool

IsSystemdService 判断当前进程是否由 systemd 拉起:服务进程带 INVOCATION_ID 环境变量, 终端手动执行无此变量——用于区分「服务内启动」与「交互式误启动」。

func Run

func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int

Run 执行子命令,返回进程退出码(0 成功 / 1 执行失败 / 2 用法错误)。

Types

This section is empty.

Jump to

Keyboard shortcuts

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