update

package
v0.105.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package update provides an updater for AdGuardHome.

Index

Constants

View Source
const MaxPackageFileSize = 32 * 1024 * 1024

MaxPackageFileSize is a maximum package file length in bytes. The largest package whose size is limited by this constant currently has the size of approximately 9 MiB.

View Source
const MaxResponseSize = 64 * 1024

MaxResponseSize is responses on server's requests maximum length in bytes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Client *http.Client

	VersionURL    string // version.json URL
	VersionString string
	OS            string // GOOS
	Arch          string // GOARCH
	ARMVersion    string // ARM version, e.g. "6"
	NewVersion    string // VersionInfo.NewVersion
	PackageURL    string // VersionInfo.PackageURL
	ConfigName    string // current config file ".../AdGuardHome.yaml"
	WorkDir       string // updater work dir (where backup/upd dirs will be created)
}

Config - updater config

type Updater

type Updater struct {
	Config // Updater configuration
	// contains filtered or unexported fields
}

Updater - Updater

func NewUpdater

func NewUpdater(cfg Config) *Updater

NewUpdater - creates a new instance of the Updater

func (*Updater) DoUpdate

func (u *Updater) DoUpdate() error

DoUpdate - conducts the auto-update 1. Downloads the update file 2. Unpacks it and checks the contents 3. Backups the current version and configuration 4. Replaces the old files

func (*Updater) GetVersionResponse

func (u *Updater) GetVersionResponse(forceRecheck bool) (VersionInfo, error)

GetVersionResponse - downloads version.json (if needed) and deserializes it

type VersionInfo

type VersionInfo struct {
	NewVersion           string // New version string
	Announcement         string // Announcement text
	AnnouncementURL      string // Announcement URL
	SelfUpdateMinVersion string // Min version starting with which we can auto-update
	CanAutoUpdate        bool   // If true - we can auto-update
}

VersionInfo - VersionInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL