diff --git a/netconf/transport_ssh.go b/netconf/transport_ssh.go index 1e40b55..c7efb55 100644 --- a/netconf/transport_ssh.go +++ b/netconf/transport_ssh.go @@ -9,6 +9,7 @@ package netconf import ( "crypto/x509" "encoding/pem" + "errors" "fmt" "io/ioutil" "net" @@ -21,6 +22,8 @@ import ( ) const ( + // bastionDefaultPort is the default port used when SSH via Bastion + bastionDefaultPort = 22 // sshDefaultPort is the default SSH port used when communicating with // NETCONF sshDefaultPort = 830 @@ -60,6 +63,52 @@ func (t *TransportSSH) Close() error { return fmt.Errorf("No connection to close") } +// DialWithBasstion connects and establishes SSH sessions over bastion host +// +// bastion can be an IP address (e.g) 172.16.2.1 which uses default port 22. +// Bastion can also specify port with format : (e.g 172.16.2.1:5001) +// 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 :