Documentation ¶
Index ¶
- Constants
- func Rpc(id, method string, params interface{}) (string, error)
- func ShowLogs(id string, follow bool) error
- func ShowRpc(params interface{}) (json.RawMessage, error)
- type AddressInput
- type AddressInputList
- type Client
- type Configuration
- type DetachedInstance
- type Formatter
- type InstancesRuntime
- type Runtime
Constants ¶
const (
AddressFormat = "%s:%s"
)
const ( // IdFlagName is the name of the flag that carries the unique idenfier for a // mole instance. IdFlagName = "id" )
Variables ¶
This section is empty.
Functions ¶
func ShowRpc ¶
func ShowRpc(params interface{}) (json.RawMessage, error)
ShowRpc is a rpc callback that returns runtime information about the mole client.
Types ¶
type AddressInput ¶
type AddressInput struct { User string `mapstructure:"user" toml:"user"` Host string `mapstructure:"host" toml:"host"` Port string `mapstructure:"port" toml:"port"` }
AddressInput holds information about a host
func (AddressInput) Address ¶
func (ai AddressInput) Address() string
Address returns a string representation of AddressInput to be used to perform network connections.
func (*AddressInput) Set ¶
func (ai *AddressInput) Set(value string) error
Set parses a string representation of AddressInput into its proper attributes.
func (AddressInput) String ¶
func (ai AddressInput) String() string
String returns a string representation of a AddressInput
func (*AddressInput) Type ¶
func (ai *AddressInput) Type() string
Type return a string representation of AddressInput.
type AddressInputList ¶
type AddressInputList []AddressInput
AddressInputList represents a collection of AddressInput objects
func (AddressInputList) List ¶
func (il AddressInputList) List() []string
List returns an array of the string representation of each AddressInput kept on the AddressInputList
func (*AddressInputList) Set ¶
func (il *AddressInputList) Set(value string) error
Set adds a string representation of a AddressInput to the AddressInputList object
func (AddressInputList) String ¶
func (il AddressInputList) String() string
String return the string representation of AddressInputList
func (*AddressInputList) Type ¶
func (il *AddressInputList) Type() string
Type return a string representation of AddressInputList.
type Client ¶
type Client struct { Conf *Configuration Tunnel *tunnel.Tunnel // contains filtered or unexported fields }
Client manages the overall state of the application based on its configuration.
type Configuration ¶
type Configuration struct { Id string `json:"id" mapstructure:"id" toml:"id"` TunnelType string `json:"tunnel-type" mapstructure:"tunnel-type" toml:"tunnel-type"` Verbose bool `json:"verbose" mapstructure:"verbose" toml:"verbose"` Insecure bool `json:"insecure" mapstructure:"insecure" toml:"insecure"` Detach bool `json:"detach" mapstructure:"detach" toml:"detach"` Source AddressInputList `json:"source" mapstructure:"source" toml:"source"` Destination AddressInputList `json:"destination" mapstructure:"destination" toml:"destination"` Server AddressInput `json:"server" mapstructure:"server" toml:"server"` Key string `json:"key" mapstructure:"key" toml:"key"` KeyValue string `json:"key-value" mapstructure:"key" toml:"key-value"` KeepAliveInterval time.Duration `json:"keep-alive-interval" mapstructure:"keep-alive-interva" toml:"keep-alive-interval"` ConnectionRetries int `json:"connection-retries" mapstructure:"connection-retries" toml:"connection-retries"` WaitAndRetry time.Duration `json:"wait-and-retry" mapstructure:"wait-and-retry" toml:"wait-and-retry"` SshAgent string `json:"ssh-agent" mapstructure:"ssh-agent" toml:"ssh-agent"` Timeout time.Duration `json:"timeout" mapstructure:"timeout" toml:"timeout"` SshConfig string `json:"ssh-config" mapstructure:"ssh-config" toml:"ssh-config"` Rpc bool `json:"rpc" mapstructure:"rpc" toml:"rpc"` RpcAddress string `json:"rpc-address" mapstructure:"rpc-address" toml:"rpc-address"` }
func (*Configuration) Merge ¶
func (c *Configuration) Merge(al *alias.Alias, givenFlags []string) error
Merge overwrites Configuration from the given Alias.
Certain attributes like Verbose, Insecure and Detach will be overwritten only if they are found on the givenFlags which should contain the name of all flags given by the user through UI (e.g. CLI).
func (Configuration) ParseAlias ¶
func (c Configuration) ParseAlias(name string) *alias.Alias
ParseAlias translates a Configuration object to an Alias object.
type DetachedInstance ¶
type DetachedInstance struct { // Id is the unique identifier of a detached application instance. The value // can be either the alias or a unique alphanumeric value. Id string // LogFile points to a file path in the file system where the application // log file is stored. LogFile string // PidFile points to a file path in the file system where the application // procces identifier is stored. PidFile string }
DetachedInstance holds the location to directories and files associated with an application instance running on background.
func NewDetachedInstance ¶
func NewDetachedInstance(id string) (*DetachedInstance, error)
NewDetachedInstance returns a new instance of DetachedInstance, making sure the application instance directory is created.
type InstancesRuntime ¶
type InstancesRuntime []Runtime
func ShowInstances ¶
func ShowInstances() (*InstancesRuntime, error)
ShowInstances returns the runtime information about all instances of mole running on the system with rpc enabled.
func (InstancesRuntime) ToToml ¶
func (ir InstancesRuntime) ToToml() (string, error)
type Runtime ¶
type Runtime Configuration
Runtime holds runtime data about an application instance.
func ShowInstance ¶
ShowInstance returns the runtime information about an application instance from the given id or alias.