netconf

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: BSD-2-Clause-Views Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPort is the default SSH port used when communicating with
	// NETCONF
	DefaultPort = 830
)

Variables

This section is empty.

Functions

func Dial

func Dial(target string, config *ssh.ClientConfig, port int) (*session.Session, error)

Dial creates a new NETCONF session using a SSH Transport. See TransportSSH.Dial for arguments.

func DialSSHTimeout

func DialSSHTimeout(target string, config *ssh.ClientConfig, timeout time.Duration) (*session.Session, error)

DialSSHTimeout creates a new NETCONF session using a SSH Transport with timeout. See TransportSSH.Dial for arguments. The timeout value is used for both connection establishment and Read/Write operations.

func NewSSHSession

func NewSSHSession(conn net.Conn, config *ssh.ClientConfig) (*session.Session, error)

NewSSHSession creates a new NETCONF session using an existing net.Conn.

func SSHConfigPassword

func SSHConfigPassword(user string, pass string) *ssh.ClientConfig

SSHConfigPassword is a convenience function that takes a username and password and returns a new ssh.ClientConfig setup to pass that username and password. Convenience means that HostKey checks are disabled so it's probably less secure

func SSHConfigPubKeyAgent

func SSHConfigPubKeyAgent(user string) (*ssh.ClientConfig, error)

SSHConfigPubKeyAgent is a convience function that takes a username and returns a new ssh.Clientconfig setup to pass credentials received from an ssh agent

func SSHConfigPubKeyFile

func SSHConfigPubKeyFile(user string, file string, passphrase string) (*ssh.ClientConfig, error)

SSHConfigPubKeyFile is a convenience function that takes a username, private key and passphrase and returns a new ssh.ClientConfig setup to pass credentials to DialSSH

Types

type TransportSSH

type TransportSSH struct {
	transport.TransportBasicIO              // Embedded Transport basic IO base type
	SSHClient                  *ssh.Client  // SSH Client
	SSHSession                 *ssh.Session // SSH Client Session
}

TransportSSH maintains the information necessary to communicate with the remote device over SSH

func (*TransportSSH) Close

func (t *TransportSSH) Close() error

Close closes an existing SSH session and socket if they exist.

func (*TransportSSH) DialSSH

func (t *TransportSSH) DialSSH(target string, config *ssh.ClientConfig, port int) error

DialSSH connects and establishes 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 documentation. There is a helper function SSHConfigPassword thar returns a ssh.ClientConfig for simple username/password authentication

func (*TransportSSH) SetupSession

func (t *TransportSSH) SetupSession() error

SetupSession sorts out wiring

Jump to

Keyboard shortcuts

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