Documentation ¶
Overview ¶
Package manage provides the management interface for the backup system.
Package manage provides the management interface for the backup system.
Package manage provides the management interface for the backup system.
Package manage provides the interface for the backup system.
Package manage provides the interface for the backup system.
Package manage provides the management interface for the backup system.
Package manage provides the management interface for the backup system.
Index ¶
- Constants
- type Agent
- func (a *Agent) Bytes() []byte
- func (a *Agent) Error() error
- func (a *Agent) ErrorMessage() string
- func (a *Agent) HCL() *Agent
- func (a *Agent) HasErrors() bool
- func (a *Agent) JSON() *Agent
- func (a *Agent) Load(filename string) *Agent
- func (a *Agent) LoadTemplate() *Agent
- func (a *Agent) Save(filename string, format string) *Agent
- func (a *Agent) String() string
- func (a *Agent) YAML() *Agent
- type AgentParams
- type Azure
- type Backblaze
- type Build
- type BuildParams
- type CustomFields
- type File
- type FileOptions
- type FileRepo
- func (fr *FileRepo) Download(src string, dst string) *FileRepo
- func (fr *FileRepo) Error() error
- func (fr *FileRepo) ErrorMessage() string
- func (fr *FileRepo) HasErrors() bool
- func (fr *FileRepo) Search(term string) *FileRepo
- func (fr *FileRepo) SetOptions(options *ServerOptions) *FileRepo
- func (fr *FileRepo) ToString() string
- func (fr *FileRepo) Upload(src string) *FileRepo
- type FileServer
- type GHSAccessConf
- type GHSAccessTable
- type GHSHTTPFileInfo
- type GHSResponse
- type GHSUserControl
- type Google
- type KeyPair
- type Manage
- type Options
- type Rest
- type Restic
- type Secrets
- func (s *Secrets) Error() error
- func (s *Secrets) ErrorMessage() string
- func (s *Secrets) GenerateKeys() *Secrets
- func (s *Secrets) HCL() string
- func (s *Secrets) HasErrors() bool
- func (s *Secrets) JSON() string
- func (s *Secrets) Load(filename string) *Secrets
- func (s *Secrets) LoadTemplate() *Secrets
- func (s *Secrets) Save(filename string, format string) *Secrets
- func (s *Secrets) String() string
- type SecretsTemplate
- type ServerOptions
- type TRMM
- func (t *TRMM) Bytes() []byte
- func (t *TRMM) Error() error
- func (t *TRMM) ErrorMessage() string
- func (t *TRMM) HCL() *TRMM
- func (t *TRMM) HasErrors() bool
- func (t *TRMM) JSON() *TRMM
- func (t *TRMM) Load(filename string) *TRMM
- func (t *TRMM) LoadTemplate() *TRMM
- func (t *TRMM) Save(filename string, format string) *TRMM
- func (t *TRMM) String() string
- func (t *TRMM) YAML() *TRMM
- type Template
Constants ¶
const AGENT_KEYS = "agent/agent-keys.json.base64"
AGENT_KEYS must match the go:embed directive in agent/agent.go The path is relative to the git root of this repository.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { Template lib.AgentTemplate // contains filtered or unexported fields }
Agent starts a new Agent function chain
func (*Agent) ErrorMessage ¶
ErrorMessage returns the error message.
func (*Agent) LoadTemplate ¶
LoadTemplate will load the template agent.hcl embedded into the binary.
type AgentParams ¶
AgentParams defines the parameters used by the agent, namely the private key. The public key is included to output the hash for comparison purposes. This may help identify the agent.
type Azure ¶
type Azure struct { AccountName *string `hcl:"azure_account_name,attr" json:"azure_account_name,omitempty"` AccountKey *string `hcl:"azure_account_key,attr" json:"azure_account_key,omitempty"` }
Azure config
type Backblaze ¶
type Backblaze struct { AccountID *string `hcl:"b2_account_id,attr" json:"b2_account_id,omitempty"` AccountKey *string `hcl:"b2_account_key,attr" json:"b2_account_key,omitempty"` }
Backblaze config
type Build ¶
type Build struct { AgentParams *AgentParams GitRoot string // contains filtered or unexported fields }
Build parameters for a target device.
func (*Build) BuildAgent ¶
BuildAgent will build the package for deployment to an agent.
func (*Build) GatherInfo ¶
GatherInfo will gather the external info for the build.
func (*Build) SetAgentParams ¶
func (b *Build) SetAgentParams(ap *AgentParams) *Build
SetAgentParams will set the Agent parameters.
func (*Build) SetFilename ¶
SetFilename will set the filename according to the build parameters.
type BuildParams ¶
type BuildParams struct { // OS is the output of uname -s for *nix and // Windows | *nix // "Windows" | "Windows_NT" | `uname -s` OS string // Arch is the output of uname -m for *nix and // "amd64" | "386" | "arm" | "arm64" | `uname -m` Arch string Filename string Version string BuildTime string BuildEnv string GitCommit string GitTag string GitBranch string URL string Authors string License string Copyright string }
BuildParams defines the parameters used during building. Some of these options will not be set when using "go build" to build the 'backup' cli tool. Most of these should be set when building the 'a8n-backup' agent that is run on the endpoints.
type CustomFields ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File contains the information about the file.
type FileOptions ¶
type FileOptions struct {
Action string
}
FileOptions contains options for the FileRepo
type FileRepo ¶
type FileRepo struct {
// contains filtered or unexported fields
}
FileRepo is the main structure for a file repository.
func NewFileRepo ¶
func NewFileRepo(options *FileOptions) *FileRepo
NewFileRepo starts a new FileRepo request.
func (*FileRepo) ErrorMessage ¶
ErrorMessage returns the error message.
func (*FileRepo) SetOptions ¶
func (fr *FileRepo) SetOptions(options *ServerOptions) *FileRepo
SetOptions will set the parameters for the server, like domain, path, and authentication. Environmental variables are checked first, then options provided.
type FileServer ¶
type FileServer struct { Options *ServerOptions Request *http.Request Response []byte // contains filtered or unexported fields }
FileServer contains information about the file server.
type GHSAccessConf ¶
type GHSAccessConf struct { Upload bool `yaml:"upload" json:"upload"` Delete bool `yaml:"delete" json:"delete"` Users []GHSUserControl `yaml:"users" json:"users"` AccessTables []GHSAccessTable `yaml:"accessTables" json:"AccessTables"` }
GHSAccessConf is the access configuration for GoHttpServer https://github.com/codeskyblue/gohttpserver/blob/26545513de66f0cf6975bfad48358586dc413779/httpstaticserver.go#L490
type GHSAccessTable ¶
GHSAccessTable is the access permissions for GoHttpServer https://github.com/codeskyblue/gohttpserver/blob/26545513de66f0cf6975bfad48358586dc413779/httpstaticserver.go#L469
type GHSHTTPFileInfo ¶
type GHSHTTPFileInfo struct { Name string `json:"name"` Path string `json:"path"` Type string `json:"type"` Size int64 `json:"size"` ModTime int64 `json:"mtime"` }
GHSHTTPFileInfo is the file information for GoHttpServer https://github.com/codeskyblue/gohttpserver/blob/26545513de66f0cf6975bfad48358586dc413779/httpstaticserver.go#L469
type GHSResponse ¶
type GHSResponse struct { Auth GHSAccessConf `json:"auth"` Files []GHSHTTPFileInfo `json:"files"` }
GHSResponse is the response object from GoHttpServer
type GHSUserControl ¶
type GHSUserControl struct { Email string `json:"Email"` Upload bool `json:"Upload"` Delete bool `json:"Delete"` Token string `json:"Token"` }
GHSUserControl is the user information for GoHttpServer https://github.com/codeskyblue/gohttpserver/blob/26545513de66f0cf6975bfad48358586dc413779/httpstaticserver.go#L469
type Google ¶
type Google struct { ProjectID *string `hcl:"google_project_id,attr" json:"google_project_id,omitempty"` ApplicationCredentials *string `hcl:"google_application_credentials,attr" json:"google_application_credentials,omitempty"` }
Google config
type KeyPair ¶
type KeyPair struct { Public string `hcl:"public_key" json:"public_key"` Private string `hcl:"private_key" json:"private_key"` }
KeyPair represents the public/private key pair in the HCL template.
type Manage ¶
type Manage struct { Agent *Agent Secrets *Secrets TRMM *TRMM Message *crypto.Message // contains filtered or unexported fields }
Manage will start a Manage function chain.
func (*Manage) ErrorMessage ¶
ErrorMessage returns the error message.
func (*Manage) LoadTemplates ¶
LoadTemplates will load a blank config for the Agent, Secrets and TRMM configs. HCL _can_ preserve the original file structure if hclwrite is used. Currently, that is not the case. https://pkg.go.dev/github.com/hashicorp/hcl2/gohcl#EncodeIntoBody https://pkg.go.dev/github.com/hashicorp/hcl2/hclwrite#example-package-GenerateFromScratch
func (*Manage) RemoveEmbedFile ¶
RemoveEmbedFile will save the private key to the embedded file for the agent module.
func (*Manage) SaveEmbedFile ¶
SaveEmbedFile will save the private key to the embedded file for the agent module.
type Options ¶
type Options struct { ConfigDir string AgentConfig string Secrets string SecretsAction string // "load" or "save" TRMM string BuildParams *BuildParams AgentParams *AgentParams }
Options for the manage command. This is more like a config than options.
type Rest ¶
type Rest struct { Host *string `hcl:"host,attr" json:"host,omitempty"` Port *string `hcl:"port,attr" json:"port,omitempty" default:"443"` Username *string `hcl:"username,attr" json:"username,omitempty"` Password *string `hcl:"password,attr" json:"password,omitempty"` Path *string `hcl:"path,attr" json:"path,omitempty" default:""` }
Rest config for a rest-server
type Restic ¶
type Restic struct { Repository *string `hcl:"repository,attr" json:"repository"` Password *string `hcl:"password,attr" json:"password,omitempty"` // Encryption password KeyHint *string `hcl:"key_hint,attr" json:"key_hint,omitempty"` OSStorageUrl *string `hcl:"os_storage_url,attr" json:"os_storage_url,omitempty"` OSAuthToken *string `hcl:"os_auth_token,attr" json:"os_auth_token,omitempty"` B2AccountID *string `hcl:"b2_account_id,attr" json:"b2_account_id,omitempty"` B2AccountKey *string `hcl:"b2_account_key,attr" json:"b2_account_key,omitempty"` AzureAccountName *string `hcl:"azure_account_name,attr" json:"azure_account_name,omitempty"` AzureAccountKey *string `hcl:"azure_account_key,attr" json:"azure_account_key,omitempty"` GoogleProjectID *string `hcl:"google_project_id,attr" json:"google_project_id,omitempty"` GoogleApplicationCredentials *string `hcl:"google_application_credentials,attr" json:"google_application_credentials,omitempty"` BWLimit *string `hcl:"bw_limit,attr" json:"bw_limit,omitempty"` }
Restic config See https://restic.readthedocs.io/en/latest/040_backup.html#environment-variables
type Secrets ¶
type Secrets struct { Agent *crypto.KeyPair TRMM *crypto.KeyPair Template SecretsTemplate // contains filtered or unexported fields }
Secrets starts a new Secrets function chain
func (*Secrets) ErrorMessage ¶
ErrorMessage returns the error message.
func (*Secrets) GenerateKeys ¶
GenerateKeys will generate public/private encryption keys and store them in the struct.
func (*Secrets) LoadTemplate ¶
LoadTemplate will load the template secrets.hcl.
type SecretsTemplate ¶
type SecretsTemplate struct { Agent KeyPair `hcl:"agent,block" json:"agent"` TRMM KeyPair `hcl:"trmm,block" json:"trmm"` }
SecretsTemplate represents the template for loading/saving to HCL.
type ServerOptions ¶
type ServerOptions struct { Domain string Path string FilePath string AuthType string // "basic" | "none" Username string Password string }
ServerOptions will set the options for the server.
type TRMM ¶
type TRMM struct { Template Template // contains filtered or unexported fields }
TRMM starts a new TRMM function chain
func (*TRMM) ErrorMessage ¶
ErrorMessage returns the error message.
func (*TRMM) LoadTemplate ¶
LoadTemplate will load the template trmm.hcl embedded into the binary.
type Template ¶
type Template struct { CustomFields CustomFields `hcl:"custom_fields,block" json:"custom_fields"` Hosting lib.Hosting `hcl:"hosting,block" json:"hosting"` }
Template manages the config for the Tactical RMM integration.