github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/util/clissh/secure_client.go (about)

     1  package clissh
     2  
     3  import (
     4  	"net"
     5  
     6  	"golang.org/x/crypto/ssh"
     7  )
     8  
     9  //go:generate counterfeiter . SecureClient
    10  
    11  type SecureClient interface {
    12  	NewSession() (SecureSession, error)
    13  	Conn() ssh.Conn
    14  	Dial(network, address string) (net.Conn, error)
    15  	Wait() error
    16  	Close() error
    17  }
    18  
    19  type secureClient struct {
    20  	client *ssh.Client
    21  }
    22  
    23  func (sc secureClient) Close() error {
    24  	return sc.client.Close()
    25  }
    26  
    27  func (sc secureClient) Conn() ssh.Conn {
    28  	return sc.client.Conn
    29  }
    30  
    31  func (sc secureClient) Dial(n, addr string) (net.Conn, error) {
    32  	return sc.client.Dial(n, addr)
    33  }
    34  
    35  func (sc secureClient) NewSession() (SecureSession, error) {
    36  	return sc.client.NewSession()
    37  }
    38  
    39  func (sc secureClient) Wait() error {
    40  	return sc.client.Wait()
    41  }