client

package
v0.0.0-...-389609b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSSHClient

func NewSSHClient(host, username, identityFile string) (*ssh.Client, error)

NewSSHClient creates a new SSH client for the given host, username, and identity file.

The host can be in the format of "example.com", "[email protected]:22", or any valid combination of username, hostname, and port. If the port is not specified, it defaults to 22.

If a username is provided, the client will use password authentication. If the username is provided in both the host string and the argument, it will return an error.

If no username is provided, it will try to use an identity file for authentication.

If the identity file is provided, it will be used. Any identity file outside of ~/.ssh will not be accepted for security reasons. Otherwise, the default identity files in the .ssh directory will be tried, e.g., id_ed25519, id_rsa, and id_ecdsa.

In either case, the client will check the host key against the known_hosts file in the ~/.ssh directory.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(host, username, identityFile string) (*Client, error)

func (*Client) Close

func (cli *Client) Close() error

func (*Client) DaemonHost

func (cli *Client) DaemonHost() string

func (*Client) DaemonVersion

func (cli *Client) DaemonVersion() string

func (*Client) Logs

func (cli *Client) Logs(ctx context.Context, id string) LogSeq

func (*Client) Shorts

func (cli *Client) Shorts(ctx context.Context) ([]container.Short, error)

type LogSeq

type LogSeq = iter.Seq2[string, error]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL