Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoAuthMethod = errors.New("at least one auth method (signer or password) must be provided")
Functions ¶
This section is empty.
Types ¶
type Client ¶
sshx Client is a wrapper that includes an SSH client and an SFTP client. It also provides simplified Run, Upload and Download methods.
func NewClient ¶
func NewClient(addr string, username string, options ...ClientOption) (*Client, error)
NewClient creates a new sshx Client with the given IP, username, and options. At least one of the signer or password must be set.
type ClientOption ¶
type ClientOption func(*clientOptions)
func WithFirstTimeSetup ¶
func WithFirstTimeSetup(additionalKeys ...ssh.PublicKey) ClientOption
WithFirstTimeSetup uses the password (if set) to authenticate and the signer's public key along with any additional SSH keys. After this, the password is removed and the signer is used to authenticate. If the password is not set, the signer is used to authenticate and only the additional SSH keys are added to the server. Using this method multiple times will result in duplicate keys on the server.
func WithNetwork ¶
func WithNetwork(network string) ClientOption
WithNetwork sets the network to use for SSH connections. Defaults to "tcp".
func WithPassword ¶
func WithPassword(password string) ClientOption
WithPassword sets the password on the sshxClient. Please consider using WithSigner instead. If you are using the password for a first time setup, use WithFirstTimeSetup as well.
func WithSigner ¶
func WithSigner(signer ssh.Signer) ClientOption
WithSigner sets the SSH key on the sshxClient.