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 RunSSHTunnel(ctx context.Context, user, host string, sshPort int, localFwd string, ...) error
- func SetConfigReloader(fn func(cfg *config.File))
- func SetDialHoney(...)
- func SetExecutorResolver(fn func(hosts.Record) Executor)
- func SetSSHRunInteractive(fn func(user string, r hosts.Record, recorder any) error)
- func SetSSHRunTunnel(...)
- type Executor
- type HostClient
- type RemoteFileEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReconfigureFromHoneyConfig ¶
ReconfigureFromHoneyConfig propagates config to all registered provider factories. Safe to call from CLI after loading config and from the web server on startup.
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.
func SetConfigReloader ¶ added in v0.3.3
SetConfigReloader wires a provider config reloader (called from searchrun.init).
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 SetExecutorResolver ¶ added in v0.3.3
SetExecutorResolver wires the provider registry's executor dispatch (called from searchrun.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
DialUpstream(ctx context.Context, user string, r hosts.Record, address string) (net.Conn, 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.