Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultTimeout = 30 * time.Second
Variables ¶
This section is empty.
Functions ¶
func AllCiphers ¶ added in v0.2.0
func AllCiphers() []string
func AllHostKeyAlgorithms ¶ added in v0.2.0
func AllHostKeyAlgorithms() []string
func AllKeyExchanges ¶ added in v0.2.0
func AllKeyExchanges() []string
func UsernamePasswordConfig ¶ added in v0.2.0
func UsernamePasswordConfig(username, password string) *ssh.ClientConfig
Types ¶
type Connection ¶ added in v0.2.0
type Connection interface {
Start(ctx context.Context) error
Stop() error
Send(data []byte) error
ReadUntilFunc(ctx context.Context, timeout time.Duration, f InputCondition) ([]byte, error)
}
Connection is the low-level I/O interface for a device session.
func NewConnection ¶ added in v0.2.0
func NewConnection(stdin io.WriteCloser, stdout io.Reader) Connection
NewConnection creates a Connection from an SSH stdin/stdout pair.
func NewSSHConnection ¶ added in v0.2.0
func NewSSHConnection(host string, port uint16, config *ssh.ClientConfig) (Connection, func(), error)
NewSSHConnection dials an SSH session and returns a DeviceConnection plus a done() function that closes the session and client when called.
type Device ¶
type Device interface {
Initialize(ctx context.Context) error
DisablePaging(ctx context.Context) error
Cmd(ctx context.Context, timeout time.Duration, command string) (*Result, error)
}
Device is the minimal interface for interacting with a network switch.
type InputCondition ¶ added in v0.2.0
InputCondition returns true when the accumulated output satisfies a completion criterion.
type Settings ¶ added in v0.2.0
type Settings struct {
DriverName string
Connection Connection
Timeout time.Duration // default command timeout; 0 uses DefaultTimeout
EnablePassword *string // nil means no enable password is required
}
Settings holds the connection and timing configuration shared by all drivers.
Click to show internal directories.
Click to hide internal directories.