Documentation
¶
Overview ¶
Package hostexec defines the execution surface (HostClient, Executor) shared by the TUI, web server, CUE runner, and provider-specific transports.
Index ¶
- func ReconfigureFromHoneyConfig(cfg *config.File)
- func RegisterProxmoxExecutor(fn func(r hosts.Record) Executor)
- func RunSSHTunnel(ctx context.Context, user, host string, sshPort int, localFwd string, ...) error
- func SetDialHoney(...)
- func SetK8sExecutor(ex Executor)
- func SetSSHRunInteractive(fn func(user string, r hosts.Record, recorder any) error)
- func SetSSHRunTunnel(...)
- type Executor
- type HostClient
- type ProxmoxBackendRuntime
- type ProxmoxExecMode
- type RemoteFileEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReconfigureFromHoneyConfig ¶
ReconfigureFromHoneyConfig stores Proxmox backend credentials and exec modes for API transport. Safe to call from CLI after loading config and from the web server on startup.
func RegisterProxmoxExecutor ¶
RegisterProxmoxExecutor registers a resolver that returns a non-nil Executor when this process should use Proxmox API transport for the given record (from proxmoxprovider.init).
func RunSSHTunnel ¶
func RunSSHTunnel(ctx context.Context, user, host string, sshPort int, localFwd string, out io.Writer) error
RunSSHTunnel runs the SSH local-forward tunnel registered by sshclient (used for Proxmox hybrid/pve tunnel fallback).
func SetDialHoney ¶
func SetDialHoney(fn func(user, hostAlias string, overridePort int, identityFile string) (HostClient, error))
SetDialHoney registers the SSH HostClient dialer (from sshclient.init).
func SetK8sExecutor ¶
func SetK8sExecutor(ex Executor)
SetK8sExecutor registers the Kubernetes pod executor (typically from ui.init).
func SetSSHRunInteractive ¶
SetSSHRunInteractive registers the TTY interactive runner (from ui.init).
Types ¶
type Executor ¶
type Executor interface {
Dial(user string, r hosts.Record) (HostClient, error)
RunInteractive(user string, r hosts.Record) error
RunTunnel(ctx context.Context, user string, r hosts.Record, localFwd string, out io.Writer) error
}
Executor creates HostClients and runs interactive SSH-style sessions or tunnels.
type HostClient ¶
type HostClient interface {
Run(cmd string) ([]byte, error)
// RunWithStreams runs a remote command with stdin/stdout/stderr wired through.
// stderr may be nil to discard remote stderr.
RunWithStreams(cmd string, stdin io.Reader, stdout, stderr io.Writer) error
Upload(localPath, remotePath string) error
Download(remotePath, localPath string) error
ListRemoteDir(path string) ([]RemoteFileEntry, error)
StatRemote(path string) (RemoteFileEntry, error)
MkdirAllRemote(path string) error
RemoveRemote(path string, recursive bool) error
Close() error
}
HostClient defines running commands and file operations on a single host.
type ProxmoxBackendRuntime ¶
type ProxmoxBackendRuntime struct {
Name string
ExecMode ProxmoxExecMode
URL string
User string
Password string
TokenID string
TokenSec string
Insecure bool
}
ProxmoxBackendRuntime holds in-memory Proxmox API credentials (never put secrets in hosts.Record JSON).
func ProxmoxBackendByName ¶
func ProxmoxBackendByName(name string) (ProxmoxBackendRuntime, bool)
ProxmoxBackendByName returns API runtime config for a named Proxmox backend (empty name matches first entry).
type ProxmoxExecMode ¶
type ProxmoxExecMode string
ProxmoxExecMode controls how honey runs commands against Proxmox guests.
const ( // ProxmoxExecSSH runs commands and file ops over guest SSH (default). ProxmoxExecSSH ProxmoxExecMode = "ssh" // ProxmoxExecPVE uses the Proxmox API where supported (QEMU guest agent; LXC uses guest SSH for exec, PVE console for TTY). ProxmoxExecPVE ProxmoxExecMode = "pve" // ProxmoxExecHybrid uses API for QEMU exec / LXC exec path and SSH for file ops and tunnels where applicable. ProxmoxExecHybrid ProxmoxExecMode = "hybrid" )