Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a shared managed ssh client
func (*Client) Close ¶
Close notifies the manager that this client can be removed if there is no more references to it
func (*Client) CombinedOutput ¶
CombinedOutput runs cmd on the remote host and returns its combined standard output and standard error.
func (*Client) CombinedReader ¶
func (c *Client) CombinedReader(cmd string, envs map[string]string) (reader io.ReadCloser, err error)
CombinedReader is like CombinedOutput but returns a io.Reader combining both stderr and stdout.
type ClientConfig ¶
type ClientConfig struct { // NetAddr specifies the host ip or name NetAddr string // Port specifies the host port to connect to. // Defaults to 22 if empty Port string // User to authenticate as User string // Password to authenticate with Password string // Key to authenticate with Key []byte // IgnoreHostKey specifies whether to use InsecureIgnoreHostKey as the // HostKeyCallback to disable host key verification IgnoreHostKey bool // Deadline to be used in the underlying net.Conn. // Specified as a time.Duration so its set as the sum of the current time // and the ConnDeadline when the connection is established or to upgrade the // deadline when reusing a client ConnDeadline time.Duration // DialTimeout DialTimeout time.Duration }
ClientConfig parameters for getting ssh or sftp clients from the manager
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager for shared ssh and sftp clients
func New ¶
New creates a new Manager. clientTTL specifies the maximum amount of time after which it was last accessed that client will be kept alive in the manager without open references. The client last access time is updated when the client is released gcInterval specifies the interval the manager will try to remove unused clients
func (*Manager) Close ¶
func (m *Manager) Close()
Close all running clients and shutdown the manager
func (*Manager) SFTPClient ¶
func (m *Manager) SFTPClient(config ClientConfig) (session *SFTPClient, err error)
SFTPClient creates a session from a active managed client or create a new one on demand. Clients must be closed after usage so they can be removed when they have no references
type SFTPClient ¶
SFTPClient type
func (*SFTPClient) Close ¶
func (s *SFTPClient) Close() (err error)
Close the session and notify the manager
func (*SFTPClient) Lock ¶
func (s *SFTPClient) Lock()
Lock overrides the original client channel lock (does nothing)
func (*SFTPClient) Unlock ¶
func (s *SFTPClient) Unlock()
Unlock overrides the original client channel lock (does nothing)