Documentation ¶
Overview ¶
Package providers defines the interfaces that LazySSH provider implementations must conform to.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Factories ¶
Factories is an index of Factory objects by Machine type name.
var (
FactoryMap Factories
)
type Factory ¶
Factory produces a Provider for a specific type of Machine, based on 'target' configuration provided by the user.
type Machine ¶
type Machine struct { // ModActive messages indicate activity on the Machine. A message +1 // indicates a new forwarded TCP connection is opened, and a message -1 // indicates a TCP connection was closed. ModActive chan int8 // Translate messages are requests to translate SSH direct-tcpip parameters // to a Dialer address. The provider should not process/reply to these // messages until it has verified connectivity to the Machine. Translate chan *TranslateMsg // Stop messages are sent by the Manager to request the Machine immediately // shut down. Stop chan struct{} // State can be used by the provider to store machine-specific state. State interface{} }
Machine represents a running machine, and holds channels via which the Provider receives commands from the Manager.
type Provider ¶
type Provider interface { // start a new Machine if one is already running. // // Called from the Manager message loop goroutine, and should not block. IsShared() bool // RunMachine is responsible for managing the entire Machine lifecycle. // // Runs on a dedicated goroutine per machine, so is free to block. // // Typically, the Provider will immediately make external calls to start the // machine, wait for proper connectivity to the Machine, then go into a loop // processing the messages on the various channels on the Machine struct. // // Once the Provider determines there is no more activity via ModActive // messages, or when it receives a Stop message, it exits the message loop // and makes the necessary external calls to stop the machine again. // Specifically, this method should not return without stopping the machine. RunMachine(mach *Machine) }
Provider is responsible for managing the Machine lifecycle.
Structs implementing Provider encapsulate parsed and validated 'target' configuration, and are created by the associated Factory for the type of Machine requested.
Note that methods on Provider may be called from different goroutines. See the documentation of each method for details.
type TranslateMsg ¶
type TranslateMsg struct { // Addr is the address the SSH client wants to connect to. It contains user // input verbatim, so may be a IP address, hostname, etc. Addr string // Port is the TCP port the SSH client wants to connect to. Port uint16 // Reply is the channel the translation result is sent to. The result is a // Dailer address used to make the actual TCP connection to the Machine. The // provider should not send a reply until it has verified connectivity to the // Machine. Reply chan string }
TranslateMsg is the type sent on the Machine Translate channel.
Directories ¶
Path | Synopsis |
---|---|
Implements the 'aws_ec2' target type, which uses AWS SDK to create and terminate EC2 virtual machines.
|
Implements the 'aws_ec2' target type, which uses AWS SDK to create and terminate EC2 virtual machines. |
Implements the 'forward' type, which is essentially a dummy that doesn't really make any external calls, but simply forwards connections to a fixed address.
|
Implements the 'forward' type, which is essentially a dummy that doesn't really make any external calls, but simply forwards connections to a fixed address. |
Implements the 'hcloud' target type, which uses HCLOUD SDK to create and terminate hcloud virtual machines.
|
Implements the 'hcloud' target type, which uses HCLOUD SDK to create and terminate hcloud virtual machines. |
Implements the 'virtualbox' target type, which uses the VirtualBox CLI to start/stop existing virtual machines.
|
Implements the 'virtualbox' target type, which uses the VirtualBox CLI to start/stop existing virtual machines. |