Documentation ¶
Index ¶
- Constants
- Variables
- func SSHConfigPassword(user string, pass string) *ssh.ClientConfig
- func SetLog(l Logger)
- type HelloMessage
- type LogLevel
- type Logger
- type NoopLog
- func (l NoopLog) Debugf(format string, v ...interface{})
- func (l NoopLog) Errorf(format string, v ...interface{})
- func (l NoopLog) Fatalf(format string, v ...interface{})
- func (l NoopLog) Infof(format string, v ...interface{})
- func (l NoopLog) Panicf(format string, v ...interface{})
- func (l NoopLog) Warnf(format string, v ...interface{})
- type RPCError
- type RPCMessage
- type RPCMethod
- type RPCReply
- type RawMethod
- type ReadWriteCloser
- type Session
- type StdLog
- func (l *StdLog) Debugf(format string, v ...interface{})
- func (l *StdLog) Errorf(format string, v ...interface{})
- func (l *StdLog) Fatalf(format string, v ...interface{})
- func (l *StdLog) Infof(format string, v ...interface{})
- func (l *StdLog) Panicf(format string, v ...interface{})
- func (l *StdLog) Warnf(format string, v ...interface{})
- type Transport
- type TransportSSH
- func (t *TransportSSH) Close() error
- func (t *TransportSSH) Dial(target string, config *ssh.ClientConfig) error
- func (t *TransportSSH) Receive() ([]byte, error)
- func (t *TransportSSH) ReceiveHello() (*HelloMessage, error)
- func (t *TransportSSH) Send(data []byte) error
- func (t *TransportSSH) SendHello(hello *HelloMessage) error
- func (t *TransportSSH) WaitForBytes(b []byte) ([]byte, error)
- func (t *TransportSSH) WaitForFunc(f func([]byte) (int, error)) ([]byte, error)
- func (t *TransportSSH) WaitForRegexp(re *regexp.Regexp) ([]byte, [][]byte, error)
- func (t *TransportSSH) WaitForString(s string) (string, error)
- func (t *TransportSSH) Writeln(b []byte) (int, error)
- type TransportTelnet
- func (t *TransportTelnet) Dial(target string, username string, password string, vendor VendorIOProc) error
- func (t *TransportTelnet) Receive() ([]byte, error)
- func (t *TransportTelnet) ReceiveHello() (*HelloMessage, error)
- func (t *TransportTelnet) Send(data []byte) error
- func (t *TransportTelnet) SendHello(hello *HelloMessage) error
- func (t *TransportTelnet) WaitForBytes(b []byte) ([]byte, error)
- func (t *TransportTelnet) WaitForFunc(f func([]byte) (int, error)) ([]byte, error)
- func (t *TransportTelnet) WaitForRegexp(re *regexp.Regexp) ([]byte, [][]byte, error)
- func (t *TransportTelnet) WaitForString(s string) (string, error)
- func (t *TransportTelnet) Writeln(b []byte) (int, error)
- type VendorIOProc
Constants ¶
const ( SSH_DEFAULT_PORT = 830 SSH_NETCONF_SUBSYSTEM = "netconf" )
const ( TELNET_DEFAULT_PORT = 23 TELNET_TIMEOUT = 10 * time.Second )
const (
MSG_SEPERATOR = "]]>]]>"
)
Variables ¶
var DEFAULT_CAPABILITIES = []string{
"urn:ietf:params:xml:ns:netconf:base:1.0",
}
Functions ¶
func SSHConfigPassword ¶
func SSHConfigPassword(user string, pass string) *ssh.ClientConfig
SSHConfigPassword is a convience function that takes a username and password and returns a new ssh.ClientConfig setup to pass that username and password.
Types ¶
type HelloMessage ¶
type RPCError ¶
type RPCMessage ¶
func NewRpcMessage ¶
func NewRpcMessage(methods []RPCMethod) *RPCMessage
func (*RPCMessage) MarshalXML ¶
func (m *RPCMessage) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type RawMethod ¶
type RawMethod string
func MethodGetConfig ¶
func MethodLock ¶
func MethodUnlock ¶
func (RawMethod) MarshalMethod ¶
type ReadWriteCloser ¶
type ReadWriteCloser struct { io.Reader io.WriteCloser }
func NewReadWriteCloser ¶
func NewReadWriteCloser(r io.Reader, w io.WriteCloser) *ReadWriteCloser
type Session ¶
type Session struct { Transport Transport SessionID int ServerCapabilities []string ErrOnWarning bool }
func DialSSH ¶
func DialSSH(target string, config *ssh.ClientConfig) (*Session, error)
Create a new NETCONF session using a SSH Transport. See TransportSSH.Dial for arguments.
func DialTelnet ¶
func NewSSHSession ¶
Create a new NETCONF session using an existing net.Conn.
func NewSession ¶
type Transport ¶
type Transport interface { Send([]byte) error Receive() ([]byte, error) Close() error ReceiveHello() (*HelloMessage, error) SendHello(*HelloMessage) error }
type TransportSSH ¶
type TransportSSH struct {
// contains filtered or unexported fields
}
func (*TransportSSH) Close ¶
func (t *TransportSSH) Close() error
func (*TransportSSH) Dial ¶
func (t *TransportSSH) Dial(target string, config *ssh.ClientConfig) error
Dials and establishes an SSH sessions
target can be an IP address (e.g.) 172.16.1.1 which utlizes the default NETCONF over SSH port of 830. Target can also specify a port with the following format <host>:<port (e.g 172.16.1.1:22)
config takes a ssh.ClientConfig connection. See documentation for go.crypto/ssh for documenation. There is a helper function SSHConfigPassword thar returns a ssh.ClientConfig for simple username/password authentication
func (*TransportSSH) ReceiveHello ¶
func (t *TransportSSH) ReceiveHello() (*HelloMessage, error)
func (*TransportSSH) Send ¶
Sends a well formated netconf rpc message as a slice of bytes adding on the nessisary framining messages.
func (*TransportSSH) SendHello ¶
func (t *TransportSSH) SendHello(hello *HelloMessage) error
func (*TransportSSH) WaitForBytes ¶
func (*TransportSSH) WaitForFunc ¶
func (*TransportSSH) WaitForRegexp ¶
func (*TransportSSH) WaitForString ¶
type TransportTelnet ¶
type TransportTelnet struct {
// contains filtered or unexported fields
}
func (*TransportTelnet) Dial ¶
func (t *TransportTelnet) Dial(target string, username string, password string, vendor VendorIOProc) error
func (*TransportTelnet) ReceiveHello ¶
func (t *TransportTelnet) ReceiveHello() (*HelloMessage, error)
func (*TransportTelnet) Send ¶
Sends a well formated netconf rpc message as a slice of bytes adding on the nessisary framining messages.
func (*TransportTelnet) SendHello ¶
func (t *TransportTelnet) SendHello(hello *HelloMessage) error
func (*TransportTelnet) WaitForBytes ¶
func (*TransportTelnet) WaitForFunc ¶
func (*TransportTelnet) WaitForRegexp ¶
func (*TransportTelnet) WaitForString ¶
type VendorIOProc ¶
type VendorIOProc interface { Login(*TransportTelnet, string, string) error StartNetconf(*TransportTelnet) error }