network

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 11 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

View Source
var DefaultSSHDir string

DefaultSSHDir is a process-global path that can be set, and currently is by kola.

Functions

This section is empty.

Types

type Dialer

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

Dialer is an interface for anything compatible with net.Dialer

type NsDialer

type NsDialer struct {
	RetryDialer
	NsHandle netns.NsHandle
}

NsDialer is a RetryDialer that can enter any network namespace.

func NewNsDialer

func NewNsDialer(ns netns.NsHandle) *NsDialer

func (*NsDialer) Dial

func (d *NsDialer) Dial(network, address string) (net.Conn, error)

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.ExtendedAgent
	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

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

func (*SSHAgent) NewUserClient

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

NewUserClient connects to the given host via SSH using the provided username. The client will support agent forwarding but it must also be enabled per-session.

Directories

Path Synopsis
mockssh implements a basic ssh server for use in unit tests.
mockssh implements a basic ssh server for use in unit tests.
ntp
NTP v4 (RFC 5905) http://tools.ietf.org/html/rfc5905
NTP v4 (RFC 5905) http://tools.ietf.org/html/rfc5905

Jump to

Keyboard shortcuts

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