Documentation
¶
Index ¶
- Constants
- func GetNetconfTransportNames() []string
- func GetTransportNames() []string
- type Args
- type File
- type InChannelAuthData
- type SSHArgs
- type Standard
- type System
- type Telnet
- type TelnetArgs
- type Transport
- func (t *Transport) Close(force bool) error
- func (t *Transport) GetHost() string
- func (t *Transport) GetPort() int
- func (t *Transport) InChannelAuthData() *InChannelAuthData
- func (t *Transport) IsAlive() bool
- func (t *Transport) Open() error
- func (t *Transport) Read() ([]byte, error)
- func (t *Transport) ReadN(n int) ([]byte, error)
- func (t *Transport) Write(b []byte) error
Constants ¶
const ( // DefaultTransport is the default transport constant for scrapligo, this defaults to the // "system" transport. DefaultTransport = "system" // InChannelAuthUnsupported indicates that the transport does *not* support in channel auth. InChannelAuthUnsupported = "in-channel-auth-unsupported" // InChannelAuthSSH indicates that the transport supports in channel ssh auth. InChannelAuthSSH = "in-channel-auth-ssh" // InChannelAuthTelnet indicates that the transport supports in channel telnet auth. InChannelAuthTelnet = "in-channel-auth-telnet" )
const (
// FileTransport transport name.
FileTransport = "file"
)
const (
// StandardTransport is the standard (crypto/ssh) transport for scrapligo.
StandardTransport = "standard"
)
const (
// SystemTransport is the default "system" (/bin/ssh wrapper) transport for scrapligo.
SystemTransport = "system"
)
const (
// TelnetTransport is the telnet transport for scrapligo.
TelnetTransport = "telnet"
)
Variables ¶
This section is empty.
Functions ¶
func GetNetconfTransportNames ¶
func GetNetconfTransportNames() []string
GetNetconfTransportNames returns a slice of available NETCONF transport type names.
func GetTransportNames ¶
func GetTransportNames() []string
GetTransportNames is returns a slice of available transport type names.
Types ¶
type Args ¶
type Args struct { Host string Port int User string Password string TimeoutSocket time.Duration ReadSize int TermHeight int TermWidth int // contains filtered or unexported fields }
Args is a struct representing common transport arguments.
type File ¶
File transport is a transport object that "connects" to a file rather than a device, it probably has no use outside of testing.
func NewFileTransport ¶
NewFileTransport returns an instance of File transport. This is for testing purposes only.
type InChannelAuthData ¶
type InChannelAuthData struct { Type string User string Password string PrivateKeyPassPhrase string }
InChannelAuthData is a struct containing all necessary information for the Channel to handle "in-channel" auth if necessary.
type SSHArgs ¶
type SSHArgs struct { StrictKey bool PrivateKeyPath string PrivateKeyPassPhrase string ConfigFile string KnownHostsFile string NetconfConnection bool }
SSHArgs is a struct representing common transport SSH specific arguments.
type Standard ¶
type Standard struct { SSHArgs *SSHArgs ExtraCiphers []string ExtraKexs []string // contains filtered or unexported fields }
Standard is the standard (crypto/ssh) transport object.
func NewStandardTransport ¶
NewStandardTransport returns an instance of Standard transport.
func (*Standard) IsAlive ¶
IsAlive returns true if the Standard transport session attribute is not nil.
type System ¶
type System struct { SSHArgs *SSHArgs ExtraArgs []string OpenBin string OpenArgs []string // contains filtered or unexported fields }
System is the default (/bin/ssh wrapper) transport object.
func NewSystemTransport ¶
NewSystemTransport returns an instance of System transport.
type Telnet ¶
type Telnet struct { TelnetArgs *TelnetArgs // contains filtered or unexported fields }
Telnet is the telnet transport object.
func NewTelnetTransport ¶
func NewTelnetTransport(a *TelnetArgs) (*Telnet, error)
NewTelnetTransport returns an instance of Telnet transport.
func (*Telnet) IsAlive ¶
IsAlive returns true if the connection (c) attribute of the Telnet object is not nil.
type TelnetArgs ¶
type TelnetArgs struct{}
TelnetArgs is a struct representing common transport Telnet specific arguments.
func NewTelnetArgs ¶
func NewTelnetArgs(options ...util.Option) (*TelnetArgs, error)
NewTelnetArgs returns an instance of TelnetArgs with any provided options set. This should, just like the other NewXArgs functions, not be called directly by users.
type Transport ¶
type Transport struct { Args *Args Impl transportImpl // contains filtered or unexported fields }
Transport is a struct which wraps a transportImpl object and provides a unified interface to any type of transport selected by the user.
func NewTransport ¶
func NewTransport( l *logging.Instance, host, transportType string, options ...util.Option, ) (*Transport, error)
NewTransport returns an instance of Transport with the requested transport implementation (as defined in transportType) set. Typically, users should not need to call this as the process of Driver creation will handle this for you.
func (*Transport) Close ¶
Close closes the underlying transportImpl transport object. force option is required for netconf as there will almost certainly always be a read in progress that we cannot stop and will block, therefore we need a way to bypass the lock.
func (*Transport) GetHost ¶
GetHost is a convenience method to return the Transport Args Host value.
func (*Transport) GetPort ¶
GetPort is a convenience method to return the Transport Args Port value.
func (*Transport) InChannelAuthData ¶
func (t *Transport) InChannelAuthData() *InChannelAuthData
InChannelAuthData returns an instance of InChannelAuthData indicating if in-channel auth is supported, and if so, the necessary fields to accomplish that.
func (*Transport) IsAlive ¶
IsAlive returns true if the underlying transportImpl reports liveness, otherwise false.