Example
SSHClient
SSHClient
boolean
Close closes the SSH connection and destroys the client
Returns the success state and error. If error is not nil,
state will be false
boolean
Example
host
, port
, username
): boolean
Connect tries to connect to provided host and port
with provided username and password with ssh.
Returns state of connection and error. If error is not nil,
state will be false
Name | Type |
---|---|
host | string |
port | number |
username | string |
boolean
Example
host
, port
): HandshakeLog
ConnectSSHInfoMode tries to connect to provided host and port
with provided host and port
Returns HandshakeLog and error. If error is not nil,
state will be false
HandshakeLog is a struct that contains information about the
ssh connection
Name | Type |
---|---|
host | string |
port | number |
HandshakeLog
Example
host
, port
, username
): boolean
ConnectWithKey tries to connect to provided host and port
with provided username and private_key.
Returns state of connection and error. If error is not nil,
state will be false
Name | Type |
---|---|
host | string |
port | number |
username | string |
boolean
Example
cmd
): string
Run tries to open a new SSH session, then tries to execute
the provided command in said session
Returns string and error. If error is not nil,
state will be false
The string contains the command output
Name | Type |
---|---|
cmd | string |
string
Example
sec
): void
SetTimeout sets the timeout for the SSH connection in seconds
Name | Type |
---|---|
sec | number |
void
Example