Documentation
¶
Index ¶
- func NewSSHClient(cfg *Config) (*ssh.Client, error)
- type Client
- func (cli *Client) AllShorts(ctx context.Context) ([]container.Short, error)
- func (cli *Client) Close() error
- func (cli *Client) DaemonHost() string
- func (cli *Client) DaemonVersion() string
- func (cli *Client) FilesIn(ctx context.Context, root file.Info) ([]file.Info, error)
- func (cli *Client) Logs(ctx context.Context, id string) (LogSeq, context.CancelFunc)
- func (cli *Client) PauseContainer(ctx context.Context, id string) error
- func (cli *Client) StartContainer(ctx context.Context, id string) error
- func (cli *Client) StopContainer(ctx context.Context, id string) error
- func (cli *Client) Terminal(ctx context.Context, id string, in io.Reader, out io.Writer) error
- func (cli *Client) UnpauseContainer(ctx context.Context, id string) error
- type ClientOptions
- type Config
- type LogSeq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSSHClient ¶
NewSSHClient creates a new SSH client from the given config.
Settings from ~/.ssh/config are applied first, overriding any values in cfg. Host keys are verified against ~/.ssh/known_hosts.
Authentication is attempted in order:
- Password prompt, if cfg.AskPassword() is true.
- SSH agent via SSH_AUTH_SOCK, if the socket is available and has signers.
- Identity file (defaults: id_ed25519, id_rsa, id_ecdsa); prompts for passphrase if needed.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(cOpts ...ClientOptions) (*Client, error)
func (*Client) DaemonHost ¶
func (*Client) DaemonVersion ¶
func (*Client) FilesIn ¶ added in v0.3.0
FilesIn returns the files in the given directory inside the container. If the Path field of the root is empty, it defaults to the working directory of the container, or "/" if the working directory is not set.
func (*Client) PauseContainer ¶ added in v0.2.0
func (*Client) StartContainer ¶ added in v0.2.0
func (*Client) StopContainer ¶ added in v0.2.0
type ClientOptions ¶
type ClientOptions func(*Config)
func WithAskPassword ¶
func WithAskPassword(ask bool) ClientOptions
func WithDockerHost ¶
func WithDockerHost(host string) ClientOptions
func WithHost ¶
func WithHost(host string) ClientOptions
func WithIdentityFile ¶
func WithIdentityFile(identityFile string) ClientOptions
func WithUsername ¶
func WithUsername(username string) ClientOptions
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func NewConfig ¶
func NewConfig(opts ...ClientOptions) (*Config, error)
NewSSHClient creates a new SSH client for the given optins.
Note that the host, username, port and identity file can be rewritten during ssh client construction with the value provided in the ~/.ssh/config file.
Use the method of the client to get the constructed Addr, Host, Port, Username, AskPassword, SSHDir and DockerSocket.