Documentation ¶
Index ¶
- Constants
- func CleanURL(urlIn string) (string, error)
- func FileContains(filepath string, text string) (bool, error)
- func InterfaceValueToString(iv interface{}) string
- func MapStringToInterface(ms map[string]string) map[string]interface{}
- func PathExist(path string) bool
- func RemoveAPIKeyFromString(in string, key string) string
- func StringExpandVariables(str string, variables map[string]interface{}) string
- func StringFindVariables(str string) []string
- func StringIsVariable(s string, varName string) (bool, string)
- type APIBackupListEntries
- type APIBackupListEntry
- type APIKeyListEntries
- type APIKeyListEntry
- type APIKeyRightEntries
- type APIOperation
- type APIOrigin
- type APISSHConnection
- type APISSHPair
- type APISecretListEntries
- type APISecretListEntry
- type APISecretUsageEntries
- type APISecretUsageEntry
- type APISeedListEntries
- type APISeedListEntry
- type APISeedStatus
- type APIStatus
- type APITrustListEntries
- type APITrustListEntry
- type APIVMBasicListEntries
- type APIVMBasicListEntry
- type APIVMDoListEntries
- type APIVMDoListEntry
- type APIVMInfos
- type APIVMListEntries
- type APIVMListEntry
- type AsyncCallback
- type Domain
- type FakeWriteCloser
- type Message
- type MessageTimestamp
- type ProxyChainConflictingDomain
- type ProxyChainConflictingDomains
- type ProxyChainDomains
- type TCPForwarder
- type TCPPortListener
- type TCPPortListeners
- type WriteCounter
- type WriteCounterCallback
Constants ¶
const ( MessageSuccess = "SUCCESS" MessageFailure = "FAILURE" )
SUCCESS & FAILURE will end a client connection (no?)
const ( MessageError = "ERROR" MessageWarning = "WARNING" MessageInfo = "INFO" MessageTrace = "TRACE" MessageNoop = "NOOP" // MessageNoop is used for keep-alive messages )
Message types
const ( MessageNoTarget = "" MessageAllTargets = "*" )
Special message targets
const ( MessagePrintTarget = true MessagePrintNoTarget = false )
Message.Print target
const ( MessageMatchDefault = false MessageMatchExact = true )
Message.MatchTarget options
const FalseStr = "false"
const TrueStr = "true"
TrueStr is the true truth.
Variables ¶
This section is empty.
Functions ¶
func FileContains ¶
FileContains returns true if file contain text
func InterfaceValueToString ¶
func InterfaceValueToString(iv interface{}) string
InterfaceValueToString converts most interface types to string
func MapStringToInterface ¶
MapStringToInterface convert a map[string]string to a map[string]interface{}
func RemoveAPIKeyFromString ¶
RemoveAPIKeyFromString replace any API key appearance in the string
func StringExpandVariables ¶
StringExpandVariables expands "variables" ($test, for instance) in str and returns a new string
func StringFindVariables ¶
StringFindVariables returns a deduplicated slice of all "variables" ($test) in the string
Types ¶
type APIBackupListEntries ¶
type APIBackupListEntries []APIBackupListEntry
APIBackupListEntries is a list of entries for "backup list" command
type APIBackupListEntry ¶
type APIBackupListEntry struct { DiskName string VMName string Created time.Time Expire time.Time AuthorKey string Size uint64 AllocSize uint64 }
APIBackupListEntry is an entry for a backup
type APIKeyListEntries ¶
type APIKeyListEntries []APIKeyListEntry
APIKeyListEntries is a list of entries for "backup list" command
type APIKeyListEntry ¶
type APIKeyListEntry struct {
Comment string
}
APIKeyListEntry is an entry for a backup
type APIKeyRightEntries ¶
type APIKeyRightEntries []string
APIKeyRightEntries is a list of entries for "key right list" command
type APIOperation ¶
type APIOperation struct { Origin string Action string Ressource string RessourceName string StartTime time.Time }
APIOperation is currently exactly matching Operation struct
type APISSHConnection ¶
type APISSHConnection struct { FromIP string FromUser string ToUser string ToVMName string StartTime time.Time }
APISSHConnection describes a proxied SSH connection to a VM
type APISSHPair ¶
APISSHPair is an OpenSSH formatted key pair
type APISecretListEntries ¶
type APISecretListEntries []APISecretListEntry
type APISecretListEntry ¶
type APISecretUsageEntries ¶
type APISecretUsageEntries []APISecretUsageEntry
type APISecretUsageEntry ¶
type APISeedListEntries ¶
type APISeedListEntries []APISeedListEntry
APISeedListEntries is a list of entries for "seeds" command
type APISeedListEntry ¶
APISeedListEntry is an entry for a Seed
type APISeedStatus ¶
type APISeedStatus struct { Name string File string Ready bool URL string Seeder string Size uint64 StatusTime time.Time Status string LastModified time.Time PausedUntil time.Time }
APISeedStatus expose seed informations
type APIStatus ¶
type APIStatus struct { StartTime time.Time VMs int ActiveVMs int HostCPUs int VMCPUs int VMActiveCPUs int HostMemoryTotalMB int VMMemMB int VMActiveMemMB int TotalStorageMB int FreeStorageMB int FreeBackupMB int TotalBackupMB int ProvisionedDisksMB int AllocatedDisksMB int Origins []APIOrigin SSHConnections []APISSHConnection Operations []APIOperation }
APIStatus describes host status
type APITrustListEntries ¶
type APITrustListEntries []APITrustListEntry
APITrustListEntries is a list of entries for "trust list"
type APITrustListEntry ¶
APITrustListEntry is an entry for "trust list"
type APIVMBasicListEntries ¶
type APIVMBasicListEntries []APIVMBasicListEntry
APIVMBasicListEntries is a light variant of APIVMListEntries This is useful for quick requests (like completion)
type APIVMBasicListEntry ¶
type APIVMBasicListEntry struct {
Name string
}
APIVMBasicListEntry is a basic (light) entry for a VM
type APIVMDoListEntries ¶
type APIVMDoListEntries []APIVMDoListEntry
APIVMDoListEntries is a list of actions for "do" command
type APIVMDoListEntry ¶
APIVMDoListEntry is an entry for an action
type APIVMInfos ¶
type APIVMInfos struct { Name string Revision int Active bool Up bool Seed string CPUCount int RAMSizeMB uint64 DiskSizeMB uint64 AllocatedDiskSizeMB uint64 BackupDiskSizeMB uint64 Hostname string Domains []string SuperUser string AppUser string InitDate time.Time LastRebuildDuration time.Duration LastRebuildDowntime time.Duration AuthorKey string Locked bool AssignedIPv4 string AssignedMAC string DoActions []string Tags []string }
APIVMInfos expose a few VM informations
type APIVMListEntries ¶
type APIVMListEntries []APIVMListEntry
APIVMListEntries is a list of entries for "vm list" command
type APIVMListEntry ¶
type APIVMListEntry struct { Name string Revision int Active bool LastIP string `json:"last_ip"` State string Locked bool WIP string SuperUser string AppUser string }
APIVMListEntry is an entry for a VM
type AsyncCallback ¶
type AsyncCallback struct { Action string Target string Success bool Error string Duration time.Duration }
AsyncCallback are used by mulchd to notify an URL of the result of an asynchronous request
func (*AsyncCallback) AsURLValue ¶
func (ac *AsyncCallback) AsURLValue() url.Values
AsURLValue generate a url.Values version of an AsyncCallback so it can be easily POSTed
type Domain ¶
type Domain struct { Name string VMName string RedirectTo string RedirectCode int DestinationHost string DestinationPort int RedirectToHTTPS bool // used internaly by Mulch reverse proxy server ReverseProxy *httputil.ReverseProxy `json:"-"` TargetURL string Chained bool }
Domain defines a route for the reverse-proxy request handler
type FakeWriteCloser ¶
FakeWriteCloser allows to create a WriteCloser with a fake Close() from a Writer
type Message ¶
type Message struct { Time time.Time `json:"time"` Type string `json:"type"` Target string `json:"target"` Message string `json:"message"` }
Message describe a message between mulch client and mulchd server
func NewMessage ¶
NewMessage creates a new Message instance
func (*Message) MatchTarget ¶
MatchTarget returns true if the message matches the target exact searches are usefull for specific target logs (excluding all "global" messages)
type MessageTimestamp ¶
type MessageTimestamp int
MessagePrintTimestamp is the timestamp type (see MessagePrint*)
const ( MessagePrintNoTime MessageTimestamp = iota MessagePrintTime MessagePrintDateTime )
Message.Print time option
type ProxyChainConflictingDomain ¶
ProxyChainConflictingDomain describes a conflicting domain
type ProxyChainConflictingDomains ¶
type ProxyChainConflictingDomains []ProxyChainConflictingDomain
ProxyChainConflictingDomains is a list of conflicting domains
type ProxyChainDomains ¶
ProxyChainDomains list domains to forward to a target proxy
type TCPForwarder ¶
type TCPPortListener ¶
type TCPPortListener struct { // example: net.ResolveTCPAddr("10.104.0.1:9001") ListenAddr *net.TCPAddr // the key is the client VM IPv4, value is the forward destination Forwards map[string]*TCPForwarder }
TCPPortListener describe how the TCP proxy will listen on a port
type TCPPortListeners ¶
type TCPPortListeners map[uint16]*TCPPortListener
TCPPortListeners is a map of TCPPortListener instances, with the port as key
type WriteCounter ¶
type WriteCounter struct { Total uint64 CB WriteCounterCallback Step uint64 // contains filtered or unexported fields }
WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.
type WriteCounterCallback ¶
WriteCounterCallback is a user callback, called by WriteCounter during writing process