Documentation
¶
Overview ¶
Package transport defines a uniform interface for "talk to a remote host" regardless of the underlying mechanism (SSH, jump chain, sdjz-relay, ...).
All concrete transports take a Resolver that maps host names to records and secret references to plaintext, so credentials live in the vault and never leak into transport implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecOptions ¶
ExecOptions customises a single Exec call.
type ExecResult ¶
type ExecResult struct {
ExitCode int `json:"exit_code"`
Stdout []byte `json:"stdout"`
Stderr []byte `json:"stderr"`
Duration time.Duration `json:"duration_ms"`
}
ExecResult is what we report back after running a command.
type Resolver ¶
type Resolver interface {
GetHost(ctx context.Context, name string) (*inventory.Host, error)
GetSecret(ctx context.Context, name string) (string, error)
}
Resolver is what a transport uses to fetch the data it needs from the surrounding services (inventory + vault). Decoupling is intentional so that transports can be unit-tested with fakes.
type Transport ¶
type Transport interface {
// Exec runs a command on the remote, returning its full output.
Exec(ctx context.Context, cmd string, opts ExecOptions) (*ExecResult, error)
// Put copies a stream into a remote file.
Put(ctx context.Context, src io.Reader, dst string, mode os.FileMode) error
// Get streams a remote file out to the writer.
Get(ctx context.Context, src string, dst io.Writer) error
// Close releases any underlying connection.
Close() error
}
Transport is a connection to one host.