sshbuilder

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 6 Imported by: 0

README

go-sshbuilder

An ssh client builder to make life easier.

License

See LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder objects are built up through use of With* and friends. These are copied by value during creation so each one may be a branching point or be passed to any number of Dials.

func New

func New() Builder

Create a new Builder

func (Builder) Dial

func (b Builder) Dial() (*ssh.Client, error)

Dial the configured builder, returning a *ssh.Client

func (Builder) GetError

func (b Builder) GetError() error

get the most recent error from the build process

func (Builder) GetErrors

func (b Builder) GetErrors() []error

get any errors from the build process

func (Builder) ResumeErrors

func (b Builder) ResumeErrors() Builder

Resume error recording

func (Builder) String

func (b Builder) String() string

Returns a string representation of the options in the Builder

func (Builder) SuspendErrors

func (b Builder) SuspendErrors() Builder

Prevent errors from being recorded

func (Builder) WithDefaultAgent

func (b Builder) WithDefaultAgent() Builder

Use the default agent as provided by the environment, similarly to how ssh would find the agent.

func (Builder) WithHost

func (b Builder) WithHost(h string) Builder

Set the hostname for the connection

Mutually exclusive with WithHostPort

func (Builder) WithHostPort

func (b Builder) WithHostPort(str string) Builder

Set the host:port for the connection

Mutually exclusive with WithHost and WithPort

func (Builder) WithInsecureIgnoreHostKey

func (b Builder) WithInsecureIgnoreHostKey() Builder

Ignore host keys (insecure!)

Mutually exclusive with WithKnownHostsFiles

func (Builder) WithKnownHostsFiles

func (b Builder) WithKnownHostsFiles(khf ...string) Builder

Add a known hosts file

This will disable ignoring unknown hosts as well for safety. If you must also ignore unknown hosts if they haven't been set, call IgnoreUnknownHosts(true) after calling AddKnownHostsFile(f).

Mutually exclusive with WithInsecureIgnoreHostKey

func (Builder) WithPassword

func (b Builder) WithPassword(password string) Builder

Add a password auth method to the client which provides the passed password.

func (Builder) WithPort

func (b Builder) WithPort(port int) Builder

Set the port for the connection

Mutually exclusive with WithHostPort

func (Builder) WithUsername

func (b Builder) WithUsername(u string) Builder

Set the username for the connection

Jump to

Keyboard shortcuts

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