Documentation ¶
Overview ¶
Package ut4updater implements the Unreal Tournament 4 updater for Linux
Index ¶
- func CopyDir(source string, dest string) (err error)
- func CopyFile(source string, dest string) (err error)
- type ByVersion
- type DownloadProgressEvent
- type HashJob
- type HashProgressEvent
- type OSDistribution
- type ProgressTracker
- type UT4Updater
- func (updater *UT4Updater) CheckForUpdate() (bool, string, error)
- func (updater *UT4Updater) GenerateHashes(fileList []string, maxHashers int, updateFeedbackChan chan HashProgressEvent) (map[string]string, error)
- func (updater *UT4Updater) GetLatestVersion() (UT4Version, error)
- func (updater *UT4Updater) GetOSDistribution() OSDistribution
- func (updater *UT4Updater) GetVersionList() ([]UT4Version, error)
- func (updater *UT4Updater) GetVersionPath(version string, mustNotExist bool) (string, error)
- func (updater *UT4Updater) Update(feedback chan []byte) (UT4Version, error)
- type UT4Version
- type UpdateCheckRequest
- type UpdateCheckResponse
- type VersionMap
- type VersionMaps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ByVersion ¶
type ByVersion []UT4Version
ByVersion allows for sorting by the build version number
type DownloadProgressEvent ¶
type DownloadProgressEvent struct { Filename string Mbps float64 ETA float64 Percent float64 Completed bool }
DownloadProgressEvent contains information about an ongoing download
type HashJob ¶
type HashJob struct {
// contains filtered or unexported fields
}
HashJob is the structure that will be passed for processing of hashes
type HashProgressEvent ¶
type HashProgressEvent struct { Filename string Filepath string Error string // MB/s processed Mbps float64 // The estimated time to complete in seconds ETA float64 Percent float64 Completed bool Hash string }
HashProgressEvent contains the progress event
type OSDistribution ¶
type OSDistribution struct { KernelVersion string DistributionID string Distribution string DistributionVersion string DistributionPrettyName string }
OSDistribution contains information about the OS and distribution
type ProgressTracker ¶
type ProgressTracker struct {
// contains filtered or unexported fields
}
ProgressTracker implements a writer for tracking the progress of hash generation and file downloads
type UT4Updater ¶
type UT4Updater struct {
// contains filtered or unexported fields
}
UT4Updater is the main executor for the updater
func New ¶
func New(installPath string, keepVersions uint, runVersion string, sendStats bool, updateURL string) (*UT4Updater, error)
New creates aand initializes a new instance of UT4Updater
func (*UT4Updater) CheckForUpdate ¶
func (updater *UT4Updater) CheckForUpdate() (bool, string, error)
CheckForUpdate checks if an update is available
func (*UT4Updater) GenerateHashes ¶
func (updater *UT4Updater) GenerateHashes( fileList []string, maxHashers int, updateFeedbackChan chan HashProgressEvent) (map[string]string, error)
GenerateHashes generates SHA256 hashes for the given file list and returns the file list with the file hash
func (*UT4Updater) GetLatestVersion ¶
func (updater *UT4Updater) GetLatestVersion() (UT4Version, error)
GetLatestVersion returns the latest version installed
func (*UT4Updater) GetOSDistribution ¶
func (updater *UT4Updater) GetOSDistribution() OSDistribution
GetOSDistribution retrieves the kernel and distribution versions
func (*UT4Updater) GetVersionList ¶
func (updater *UT4Updater) GetVersionList() ([]UT4Version, error)
GetVersionList returns the available installed versions as [version]path
func (*UT4Updater) GetVersionPath ¶
func (updater *UT4Updater) GetVersionPath( version string, mustNotExist bool) (string, error)
GetVersionPath returns the path to the version, setting mustNotExist to true will return an error if the path exists
func (*UT4Updater) Update ¶
func (updater *UT4Updater) Update(feedback chan []byte) (UT4Version, error)
Update creates a backup and the current game, determines the files to be updated, downloads the files and applies the updates. Returns the new latest version. The provided feedback channel will return JSON data with the status updates. This is safe to run in a goroutine.
type UT4Version ¶
type UT4Version struct { VersionMap Path string }
UT4Version holds information about an installed UT4 version
type UpdateCheckRequest ¶
type UpdateCheckRequest struct { ClientID string `json:"client_id"` OS OSDistribution `json:"os"` Versions []string `json:"versions"` CurrentVersion string `json:"current_version"` }
UpdateCheckRequest holds the information for update requests
type UpdateCheckResponse ¶
type UpdateCheckResponse struct { CurrentVersion string `json:"current_version"` LatestVersion string `json:"latest_version"` UpdateAvailable bool `json:"update_available"` }
UpdateCheckResponse is the response for update check requests
type VersionMap ¶
type VersionMap struct { Version string `json:"version"` SemVer string `json:"semver"` ReleaseDate time.Time `json:"released"` }
VersionMap is the structure for mapping a UT4 build version to the symantic version number
type VersionMaps ¶
type VersionMaps []VersionMap
VersionMaps is an declaration for operations on a list of version maps
func (VersionMaps) GetVersionMapByVersionNumber ¶
func (versionMaps VersionMaps) GetVersionMapByVersionNumber( version string) VersionMap
GetVersionMapByVersionNumber retrieves the version map information based on the build version