Documentation ¶
Index ¶
- Constants
- Variables
- func CreateSSHMulchDir() error
- func DurationAsSecondsString(d time.Duration) string
- func GetSSHHost() (string, error)
- func GetSSHPath(file string) string
- func InitExitMessage()
- func ParseDuration(duration string) (time.Duration, error)
- func RenderStringTable(headers []string, data [][]string) string
- func RenderTable(headers []string, data [][]string)
- func RenderTableTruncateCol(colNum int, headers []string, data [][]string)
- func SFTPCopy(vmName string, user string, filename string) error
- func WriteSSHPair(reader io.Reader) (string, string, error)
- type API
- type APICall
- type ExitMessage
- type RootConfig
- type ServerConfig
- type VMConfig
Constants ¶
const MulchSSHSubDir = "mulch/"
MulchSSHSubDir is the name of mulch dedicated .ssh sub-directory
const ProtocolVersion = 1
ProtocolVersion implemented by this client
const SSHKeyPrefix = "id_"
SSHKeyPrefix is the prefix for SSH keys (was 'id_rsa_' but we switched to ed25519, so let's use a generic name)
const Version = "1.22.1"
Version of the client (x.y.z format)
Variables ¶
var GlobalCfgFile string
GlobalCfgFile is the config filename
var GlobalHome string
GlobalHome is the user HOME
Functions ¶
func CreateSSHMulchDir ¶
func CreateSSHMulchDir() error
CreateSSHMulchDir creates (if needed) user SSH config path and, inside, mulch directory.
func DurationAsSecondsString ¶
DurationAsSecondsString returns a string representation of a duration (seconds)
func GetSSHHost ¶
GetSSHHost returns the SSH server hostname based on mulchd API URL
func GetSSHPath ¶
GetSSHPath returns the path of a file in the user SSH config path
func ParseDuration ¶
ParseDuration returns a duration from string (ex: 1h, 10d, 1y) An empty string is valid (expiration = 0)
func RenderStringTable ¶
RenderStringTable renders a table as a string
func RenderTable ¶
RenderTable renders a table to stdout
func RenderTableTruncateCol ¶
RenderTableTruncateCol renders a table to stdout, truncatting the column colNum if table does not fit the screen width
Types ¶
type API ¶
type API struct { ServerURL string APIKey string Trace bool Time common.MessageTimestamp }
API describes the basic elements to call the API
var GlobalAPI *API
GlobalAPI is the global API instance
type APICall ¶
type APICall struct { Method string Path string Args map[string]string JSONCallback func(io.Reader, http.Header) DestFilePath string DestStream *os.File DisableSpecialMessages bool PrintLogTarget bool // contains filtered or unexported fields }
APICall describes a call to the API
func (*APICall) TimestampShow ¶
func (call *APICall) TimestampShow(show common.MessageTimestamp)
TimestampShow allow to override -d flags
type ExitMessage ¶
ExitMessage is displayed during client exit
func GetExitMessage ¶
func GetExitMessage() *ExitMessage
GetExitMessage return a pointer to the global ExitMessage
type RootConfig ¶
type RootConfig struct { ConfigFile string Server *ServerConfig Aliases map[string]string Trace bool Time common.MessageTimestamp }
RootConfig describes client application config parameters
var GlobalConfig *RootConfig
GlobalConfig is the global RootConfig instance
type ServerConfig ¶
ServerConfig describes a server (from config file) Warning: this structure is copied field by field in root_config.go, NewRootConfig(), so remember to update this function if any change is made here.