network

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout sets the default timeout for RetryDialer.
	DefaultTimeout = 5 * time.Second

	// DefaultKeepAlive sets the default keepalive for RetryDialer.
	DefaultKeepAlive = 30 * time.Second

	// DefaultRetries sets the default number of retries for RetryDialer.
	DefaultRetries = 7
)

Variables

This section is empty.

Functions

func IsClosed added in v0.1.0

func IsClosed(err error) bool

IsClosed detects if an error is due to a closed network connection, working around bug https://github.com/golang/go/issues/4373

Types

type Dialer

type Dialer interface {
	Dial(network, address string) (net.Conn, error)
}

Dialer is an interface for anything compatible with net.Dialer

type RetryDialer

type RetryDialer struct {
	net.Dialer
	Retries int
}

RetryDialer is intended to timeout quickly and retry connecting instead of just failing. Particularly useful for waiting on a booting machine.

func NewRetryDialer

func NewRetryDialer() *RetryDialer

NewRetryDialer initializes a RetryDialer with reasonable default settings.

func (*RetryDialer) Dial

func (d *RetryDialer) Dial(network, address string) (c net.Conn, err error)

Dial connects to a remote address, retrying on failure.

type SSHAgent

type SSHAgent struct {
	agent.Agent
	Dialer
	User   string
	Socket string
	// contains filtered or unexported fields
}

SSHAgent can manage keys, updates cloud config, and loves ponies. The embedded dialer is used for establishing new SSH connections.

func NewSSHAgent

func NewSSHAgent(dialer Dialer) (*SSHAgent, error)

NewSSHAgent constructs a new SSHAgent using dialer to create ssh connections.

func (*SSHAgent) Close

func (a *SSHAgent) Close() error

Close closes the unix socket of the agent.

func (*SSHAgent) NewClient

func (a *SSHAgent) NewClient(host string) (*ssh.Client, error)

NewClient connects to the given host via SSH, the client will support agent forwarding but it must also be enabled per-session.

func (*SSHAgent) NewPasswordClient added in v0.1.4

func (a *SSHAgent) NewPasswordClient(host string, user string, password string) (*ssh.Client, error)

NewPasswordClient connects to the given host via SSH using the provided username and password

Directories

Path Synopsis
ntp
NTP v4 (RFC 5905) http://tools.ietf.org/html/rfc5905
NTP v4 (RFC 5905) http://tools.ietf.org/html/rfc5905
Google's Omaha application update protocol, version 3.
Google's Omaha application update protocol, version 3.

Jump to

Keyboard shortcuts

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