Documentation
¶
Overview ¶
package update contains the types and functions used by the update system.
Index ¶
- Variables
- func CheckFileHash(meta *data.TargetFileMeta, localPath string) error
- type Options
- type Runner
- type RunnerOptions
- type Updater
- func (u *Updater) Download(repoPath, localPath string) error
- func (u *Updater) Get(target, channel string) (string, error)
- func (u *Updater) LocalPath(target, channel string) string
- func (u *Updater) Lookup(target, channel string) (*data.TargetFileMeta, error)
- func (u *Updater) RepoPath(target, channel string) string
- func (u *Updater) Targets() (data.TargetFiles, error)
- func (u *Updater) UpdateMetadata() error
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultOptions are the default options to use when creating an update // client. DefaultOptions = Options{ RootDirectory: "/var/lib/orbit", ServerURL: defaultURL, RootKeys: defaultRootKeys, LocalStore: client.MemoryLocalStore(), InsecureTransport: false, Platform: constant.PlatformName, OrbitChannel: "stable", OsquerydChannel: "stable", } )
Functions ¶
func CheckFileHash ¶
func CheckFileHash(meta *data.TargetFileMeta, localPath string) error
CheckFileHash checks the file at the local path against the provided hash functions.
Types ¶
type Options ¶
type Options struct {
// RootDirectory is the root directory from which other directories should be referenced.
RootDirectory string
// ServerURL is the URL of the update server.
ServerURL string
// InsecureTransport skips TLS certificate verification in the transport if
// set to true. Best to leave this on, but due to the file signing any
// tampering by a MitM should be detectable.
InsecureTransport bool
// RootKeys is the JSON encoded root keys to use to bootstrap trust.
RootKeys string
// LocalStore is the local metadata store.
LocalStore client.LocalStore
// Platform is the target of the platform to update for. In the default
// options this is the current platform.
Platform string
// OrbitChannel is the update channel to use for Orbit.
OrbitChannel string
// OsquerydChannel is the update channel to use for osquery (osqueryd).
OsquerydChannel string
}
Options are the options that can be provided when creating an Updater.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is a specialized runner for the updater. It is designed with Execute and Interrupt functions to be compatible with oklog/run.
func NewRunner ¶
func NewRunner(client *Updater, opt RunnerOptions) (*Runner, error)
NewRunner creates a new runner with the provided options. The runner must be started with Execute.
type RunnerOptions ¶
type RunnerOptions struct {
// CheckInterval is the interval to check for updates.
CheckInterval time.Duration
// Targets is the names of the artifacts to watch for updates.
Targets map[string]string
}
RunnerOptions is options provided for the update runner.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater is responsible for managing update state.
func New ¶
New creates a new updater given the provided options. All the necessary directories are initialized.
func (*Updater) Download ¶
Download downloads the target to the provided path. The file is deleted and an error is returned if the hash does not match.
func (*Updater) Get ¶
Get returns the local path to the specified target. The target is downloaded if it does not yet exist locally or the hash does not match.
func (*Updater) Lookup ¶
func (u *Updater) Lookup(target, channel string) (*data.TargetFileMeta, error)
Lookup looks up the provided target in the local target metadata. This should be called after UpdateMetadata.
func (*Updater) Targets ¶
func (u *Updater) Targets() (data.TargetFiles, error)
Targets gets all of the known targets
func (*Updater) UpdateMetadata ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
package badgerstore implements the go-tuf LocalStore interface using Badger as a backing store.
|
package badgerstore implements the go-tuf LocalStore interface using Badger as a backing store. |