updater

package
v0.107.32 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package updater 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

	Version string
	Channel string
	GOARCH  string
	GOOS    string
	GOARM   string
	GOMIPS  string

	// ConfName is the name of the current configuration file.  Typically,
	// "AdGuardHome.yaml".
	ConfName string
	// WorkDir is the working directory that is used for temporary files.
	WorkDir string
}

Config is the AdGuard Home updater configuration.

type Updater

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

Updater is the AdGuard Home updater.

func NewUpdater

func NewUpdater(conf *Config) *Updater

NewUpdater creates a new Updater.

func (*Updater) NewVersion

func (u *Updater) NewVersion() (nv string)

NewVersion returns the available new version.

func (*Updater) Update

func (u *Updater) Update(firstRun bool) (err error)

Update performs the auto-update. It returns an error if the update failed. If firstRun is true, it assumes the configuration file doesn't exist.

func (*Updater) VersionCheckURL

func (u *Updater) VersionCheckURL() (vcu string)

VersionCheckURL returns the version check URL.

func (*Updater) VersionInfo

func (u *Updater) VersionInfo(forceRecheck bool) (vi VersionInfo, err error)

VersionInfo downloads the latest version information. If forceRecheck is false and there are cached results, those results are returned.

type VersionInfo

type VersionInfo struct {
	NewVersion      string `json:"new_version,omitempty"`
	Announcement    string `json:"announcement,omitempty"`
	AnnouncementURL string `json:"announcement_url,omitempty"`
	// TODO(a.garipov): See if the frontend actually still cares about
	// nullability.
	CanAutoUpdate aghalg.NullBool `json:"can_autoupdate,omitempty"`
}

VersionInfo contains information about a new version.

Jump to

Keyboard shortcuts

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