import 'github.com/yahoo/vssh'
Share your thoughts, experiences and the tales behind the art. VSSH Go library to handle tens of thousands SSH connections and execute the command(s) with higher-level API for building network device / server automation. Documentation and examples are available via godoc. Jixipix pastello 1 1 5 download free.
Package vssh is a Go library to handle tens of thousands SSH connections and executethe command with higher-level API for building network device / server automation.
By calling the run method vssh sends the given command to all available clients orbased on your query it runs the command on the specific clients and the results ofthe ran command can be received in two options, streaming or final result.In streamingyou can get line by line from command’s stdout / stderr in real time or in case ofnon-real time you can get the whole of the lines together.
This example demonstrates integration vSSH with AWS EC2
Code:
GetConfigPEM returns SSH configuration that uses the given private key.the keyfile should be unencrypted PEM-encoded private key file.
GetConfigUserPass returns SSH configuration that uses the givenusername and password.
SetClientsShardNumber sets the clients shard number.
vSSH uses map data structure to keep the clientsdata in the memory. Sharding helps to have better performanceon write/read with mutex. This setting can be tuned if needed.
ClientOption represents client optional parameters.
DisableRequestPty disables the pty.
RequestPty sets the pty parameters.
SetLabels sets labels for a client.
SetMaxSessions sets maximum sessions for given client.
MaxSessionsError represents max sessions error.
Response represents the response for given session.
This example demonstrates the use of GetText() for two hosts.
Code:
Err returns response error.
Affinity designer 1 5 4 – vector graphic design software. ExitStatus returns the exit status of the remote command.
GetStream constructs a new stream from a response.
GetText gets the final result of the given response.
ID returns response identification.
RunOption represents run optional parameters.
SetLimitReaderStderr sets limit for stderr reader.
SetLimitReaderStdout sets limit for stdout reader.
This example demonstrates how to set limit the amount of returned data
Code:
King slot machine. Stream represents data stream for given response.It provides convenient interfaces to get the returneddata real-time.
BytesStderr returns the most recent data scanned by ScanStderr as bytes.
BytesStdout returns the most recent data scanned by ScanStdout as bytes.
Gif recorder 1 0 – record your screen. Close cleans up the stream's response.
Err returns stream response error.
Mobile app mockup sketch. Input writes the given reader to remote command's standardinput when the command starts.
ScanStderr provides a convenient interface for reading stderrwhich it connected to remote host. It reads a line and buffersit. The TextStdout() or BytesStdout() methods return the bufferin string or bytes.
ScanStdout provides a convenient interface for reading stdoutwhich it connected to remote host. It reads a line and buffersit. The TextStdout() or BytesStdout() methods return the bufferin string or bytes.
Signal sends the given signal to remote process.
TextStderr returns the most recent data scanned by ScanStderr as string.
TextStdout returns the most recent data scanned by ScanStdout as string.
TimeoutError represents timeout error.
VSSH represents VSSH instance.
New constructs a new VSSH instance.
AddClient adds a new SSH client to VSSH.
CurrentProc returns number of running processes / workers.
DecreaseProc destroys the idle processes / workers.
ForceReConn reconnects the client immediately.
IncreaseProc adds more processes / workers.
OnDemand changes VSSH connection behavior. By default VSSHconnects to all of the clients before any run request andit maintains the authenticated SSH connection to all clients.We can call this 'persistent SSH connection' but withOnDemand it tries to connect to clients once the run requestedand it closes the appropriate connection once the response data returned.
Run sends a new run query with given context, command and timeout.
Adobe xd cc 19 0 22 pistol. timeout allows you to set a limit on the length of time the commandwill run for. You can cancel the running command by context.WithCancel.
RunWithLabel runs the command on the specific clients whichthey matched with given query statement.
SetInitNumProc sets the initial number of processes / workers.
You need to set this number right after creating vssh.
There are two other methods in case you need to changethe settings in the middle of your code.
SetLogger sets external logger.
Start starts vSSH, including action queue and re-connect procedures.You can construct and start the vssh like below:
StartWithContext is same as Run but it accepts external context.
Wait stands by until percentage of the clients have been processed.An optional percentage can be passed as an argument - otherwise the defaultvalue of 100% is used.
Package vssh imports 18 packages (graph). Updated 2020-10-23. Refresh now. Tools for package owners.