Documentation ¶
Overview ¶
Package request contains helpers to make requests to Omaha.
Index ¶
Constants ¶
const ( ProtocolVersion = "3.0" OmahaUpdaterVersion = "0.1.0.0" InstallSourceOnDemand = "ondemandupdate" InstallSourceScheduler = "scheduler" OSVersion = "Indy" OSPlatform = "Chrome OS" OmahaRequestURL = "https://tools.google.com/service/update2" Stable = "stable-channel" )
Constants taken from update_engine.
const ( // QAUpdaterID is using a different id to differentiate from real devices. QAUpdaterID = "chromeos-qa-updater" // ForcedUpdateVersion is used as the version when we want to always get a new version. ForcedUpdateVersion = "ForcedUpdate" )
Variables ¶
This section is empty.
Functions ¶
func MatchOneOfVersions ¶
MatchOneOfVersions checks if a given version matches any of the provided major versions.
Types ¶
type Action ¶
type Action struct { XMLName struct{} `xml:"action" json:"-"` Event string `xml:"event,attr"` ChromeVersion string `xml:"ChromeVersion,attr"` ChromeOSVersion string `xml:"ChromeOSVersion,attr"` }
Action is part of an Omaha Request.
type Actions ¶
type Actions struct { XMLName struct{} `xml:"actions" json:"-"` Actions []Action `xml:"action"` }
Actions is part of an Omaha Request.
type DayStart ¶
type DayStart struct { XMLName struct{} `xml:"daystart" json:"-"` ElapsedDays int `xml:"elapsed_days,attr"` ElapsedSeconds int `xml:"elapsed_seconds,attr"` }
DayStart is part of an Omaha Request.
type Manifest ¶
type Manifest struct { XMLName struct{} `xml:"manifest" json:"-"` Version string `xml:"version,attr"` Actions Actions `xml:"actions"` }
Manifest is part of an Omaha Request.
type OS ¶
type OS struct { XMLName struct{} `xml:"os"` Version string `xml:"version,attr"` Platform string `xml:"platform,attr"` SP string `xml:"sp,attr"` }
OS is part of an Omaha Request.
type Ping ¶
type Ping struct { XMLName struct{} `xml:"ping"` R int `xml:"r"` }
Ping is part of an Omaha Request.
type Request ¶
type Request struct { XMLName struct{} `xml:"request"` RequestID uuid.UUID `xml:"requestid,attr"` SessionID uuid.UUID `xml:"sessionid,attr"` Protocol string `xml:"protocol,attr"` Updater string `xml:"updater,attr"` UpdaterVersion string `xml:"updaterversion,attr"` InstallSource string `xml:"installsource,attr"` // IsMachine can be "0" or "1". IsMachine int `xml:"ismachine,attr"` OS OS `xml:"os"` Apps []RequestApp `xml:"app"` }
Request can be marshaled into an Omaha request, all required fields should be available. Structure was created based on update_engine implementation. Official documentation: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/updater/protocol_3_1.md
type RequestApp ¶
type RequestApp struct { XMLName struct{} `xml:"app"` AppID string `xml:"appid,attr"` Cohort string `xml:"cohort,attr,omitempty"` CohortName string `xml:"cohortname,attr,omitempty"` CohortHint string `xml:"cohorthint,attr,omitempty"` Version string `xml:"version,attr,omitempty"` FromVersion string `xml:"from_version,attr,omitempty"` Track string `xml:"track,attr,omitempty"` FromTrack string `xml:"from_track,attr,omitempty"` Fingerprint string `xml:"fingerprint,attr,omitempty"` OSBuildType string `xml:"os_build_type,attr,omitempty"` InstallDate int `xml:"installdate,attr,omitempty"` Board string `xml:"board,attr,omitempty"` HardwareClass string `xml:"hardware_class,attr,omitempty"` DeltaOk bool `xml:"delta_okay,attr,omitempty"` UpdateCheck RequestUpdateCheck `xml:"updatecheck"` Lang string `xml:"lang,attr,omitempty"` Requisition string `xml:"requisition,attr,omitempty"` Ping *Ping `xml:"ping,omitempty"` }
RequestApp is part of an Omaha Request.
func GenerateRequestApp ¶
func GenerateRequestApp(deviceParams *params.Device, version, track string) RequestApp
GenerateRequestApp creates a new RequestApp based on params.Device.
type RequestUpdateCheck ¶
type RequestUpdateCheck struct { XMLName struct{} `xml:"updatecheck"` TargetVersionPrefix string `xml:"targetversionprefix,omitempty,attr"` RollbackAllowed bool `xml:"rollback_allowed,attr,omitempty"` LTSTag string `xml:"ltstag,omitempty,attr"` }
RequestUpdateCheck is part of an Omaha Request.
type Response ¶
type Response struct { XMLName struct{} `xml:"response" json:"-"` Protocol string `xml:"protocol,attr"` Server string `xml:"server,attr"` DayStart DayStart `xml:"daystart"` App ResponseApp `xml:"app"` }
Response can be parsed from an Omaha response. Structure based on real Omaha responses. Official documentation: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/docs/updater/protocol_3_1.md
func (*Response) ChromeOSVersion ¶
ChromeOSVersion gets the Chrome OS version from an Omaha response. Returns an error if not found.
func (*Response) ChromeVersion ¶
ChromeVersion gets the Chrome version from an Omaha response. Returns an error if not found.
func (*Response) ValidateUpdateResponse ¶
ValidateUpdateResponse checks that the response contains an update payload.
type ResponseApp ¶
type ResponseApp struct { XMLName struct{} `xml:"app" json:"-"` AppID string `xml:"appid,attr"` Cohort string `xml:"cohort,attr,omitempty"` CohortName string `xml:"cohortname,attr,omitempty"` Status string `xml:"status,attr"` UpdateCheck ResponseUpdateCheck `xml:"updatecheck"` }
ResponseApp is part of an Omaha Request.
type ResponseUpdateCheck ¶
type ResponseUpdateCheck struct { XMLName struct{} `xml:"updatecheck" json:"-"` Status string `xml:"status,attr"` Rollback bool `xml:"_rollback,attr"` Manifest Manifest `xml:"manifest"` }
ResponseUpdateCheck is part of an Omaha Request.