{"modulePath":"github.com/https-cert/deploy","version":"v0.7.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package remote\n\n## Functions\n\n```go\nfunc QuotePOSIXShellArg(value string) string\n```\nQuotePOSIXShellArg 将单个值安全编码为 POSIX shell 参数。\n\n## Types\n\n```go\ntype Executor struct {\n\t// contains filtered or unexported fields\n}\n```\nExecutor 封装通用 SSH 认证、远端命令执行和受限临时文件传输。\n\n```go\nfunc NewExecutor(sshConfig *config.SSHConfig, purpose, tempPrefix string, knownHostsFiles ...string) (*Executor, error)\n```\nNewExecutor 建立支持密码或私钥认证并带 TOFU 主机密钥校验的 SSH 连接。\n\n```go\nfunc NewExecutorContext(ctx context.Context, sshConfig *config.SSHConfig, purpose, tempPrefix string, knownHostsFiles ...string) (*Executor, error)\n```\nNewExecutorContext 建立可由调用方取消的 SSH 连接。\n\n```go\nfunc (executor *Executor) Close()\n```\nClose 关闭 SSH 客户端连接。\n\n```go\nfunc (executor *Executor) CreateTempDir() (string, error)\n```\nCreateTempDir 在远端创建仅 SSH 用户可读写的业务专用临时目录。\n\n```go\nfunc (executor *Executor) CreateTempDirContext(ctx context.Context) (string, error)\n```\nCreateTempDirContext 在远端创建临时目录并响应调用方取消。\n\n```go\nfunc (executor *Executor) IsRoot() bool\n```\nIsRoot 返回当前 SSH 会话是否使用 root 用户。\n\n```go\nfunc (executor *Executor) RemoveTempDir(tempDir string) error\n```\nRemoveTempDir 清理经过固定前缀校验的 SSH 临时目录。\n\n```go\nfunc (executor *Executor) RemoveTempDirContext(ctx context.Context, tempDir string) error\n```\nRemoveTempDirContext 清理经过固定前缀校验的远端临时目录。\n\n```go\nfunc (executor *Executor) Run(command string, input []byte, privileged bool) ([]byte, error)\n```\nRun 执行单条 SSH 命令；非 root 会话的特权命令自动通过 sudo 提权。\n\n```go\nfunc (executor *Executor) RunContext(ctx context.Context, command string, input []byte, privileged bool) ([]byte, error)\n```\nRunContext 执行 SSH 命令，并在取消或硬超时后关闭会话并等待其退出。\n\n```go\nfunc (executor *Executor) Upload(remoteFile string, content []byte) error\n```\nUpload 通过 SSH 标准输入将敏感文件写入远端受限临时目录。\n\n```go\nfunc (executor *Executor) UploadContext(ctx context.Context, remoteFile string, content []byte) error\n```\nUploadContext 通过 SSH 标准输入写入文件并响应调用方取消。\n\n","path":"github.com/https-cert/deploy/internal/client/deploys/remote","name":"remote","synopsis":"","isRedistributable":true}
