updater

package
v0.0.0-...-5f17d81 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SpecificVersion string // Version specified via command line flag
)

Functions

func CollectAndShipSwarmLogs

func CollectAndShipSwarmLogs() error

func CompareVersions

func CompareVersions(v1, v2 Version) int

func ExtractVersionFromFolder

func ExtractVersionFromFolder(folder string) (string, error)

func GetConfigServ

func GetConfigServ() *service.Config

func InstallService

func InstallService()

func IsBackendMaintenanceError

func IsBackendMaintenanceError(err error) bool

IsBackendMaintenanceError checks if the error is due to backend being unavailable (maintenance or down)

func IsEnterpriseImage

func IsEnterpriseImage(serviceName string) (bool, error)

func IsInMaintenanceWindow

func IsInMaintenanceWindow() bool

func MonitorConnection

func MonitorConnection(server string, timeSleep time.Duration, maxAttempts int, hasConnection *bool)

func RegisterInstance

func RegisterInstance() error

func RunService

func RunService()

func SaveVersion

func SaveVersion(vers, edition, changelog string) error

func SortVersions

func SortVersions(versions []map[string]string) []map[string]string

func SyncSystemLogs

func SyncSystemLogs()

func UninstallService

func UninstallService()

func UpdateWindowConfig

func UpdateWindowConfig()

Types

type Auth

type Auth struct {
	ID  string `json:"id"`
	Key string `json:"key"`
}

type ConfigBackend

type ConfigBackend struct {
	ID                   int            `json:"id"`
	SectionID            int            `json:"sectionId"`
	ConfParamShort       string         `json:"confParamShort"`
	ConfParamLarge       string         `json:"confParamLarge"`
	ConfParamDescription string         `json:"confParamDescription"`
	ConfParamValue       string         `json:"confParamValue"`
	ConfParamRegexp      string         `json:"confParamRegexp"`
	ConfParamRequired    bool           `json:"confParamRequired"`
	ConfParamDatatype    string         `json:"confParamDatatype"`
	ModificationTime     string         `json:"modificationTime"`
	ModificationUser     string         `json:"modificationUser"`
	ConfParamOption      string         `json:"confParamOption"`
	Section              SectionBackend `json:"section"`
}

type InstanceConfig

type InstanceConfig struct {
	Server      string `yaml:"server"`
	InstanceID  string `yaml:"instance_id"`
	InstanceKey string `yaml:"instance_key"`
}

type InstanceDTOInput

type InstanceDTOInput struct {
	Name        string `json:"name"`
	Country     string `json:"country"`
	Email       string `json:"email"`
	Version     string `json:"version"`
	Edition     string `json:"edition"`
	CurrentIp   string `json:"current_ip"`
	MappingName string `json:"mapping_name,omitempty"`
}

type InstanceDTOOutput

type InstanceDTOOutput struct {
	ID string `json:"id"`
	InstanceDTOInput
	CreatedAt string `json:"created_at"`
}

type InstanceInfo

type InstanceInfo struct {
	Name       string `json:"name"`
	Country    string `json:"country"`
	Email      string `json:"email"`
	Version    string `json:"version"`
	InstanceID string `json:"instance_id"`
}

type LicenseEncrypted

type LicenseEncrypted struct {
	ExpiresAt   time.Time `json:"expires_at"`
	Datasources int64     `json:"datasources"`
	CPU         int64     `json:"cpu"`
	Memory      int64     `json:"memory"`
	Type        string    `json:"type"`
	CreatedAt   string    `json:"created_at"`
}

type MaintenanceWindow

type MaintenanceWindow struct {
	Days      []int  `json:"days"`      // 0=Sunday, 1=Monday, ..., 6=Saturday
	StartTime string `json:"startTime"` // Format: "HH:MM"
	EndTime   string `json:"endTime"`   // Format: "HH:MM"
}

type SectionBackend

type SectionBackend struct {
	ID          int    `json:"id"`
	Section     string `json:"section"`
	Description string `json:"description"`
	ShortName   string `json:"shortName"`
}

type UpdateDTO

type UpdateDTO struct {
	ID        string           `json:"id"`
	Instance  InstanceDTOInput `json:"instance,omitempty"`
	Version   VersionDTO       `json:"version"`
	Edition   string           `json:"edition"`
	Sent      bool             `json:"sent"`
	Approved  bool             `json:"approved"`
	ApproveAt time.Time        `json:"aprove_at,omitempty"`
}

type UpdaterClient

type UpdaterClient struct {
	Config  InstanceConfig
	License string
}

func GetUpdaterClient

func GetUpdaterClient() *UpdaterClient

func (*UpdaterClient) CheckLicense

func (c *UpdaterClient) CheckLicense() error

func (*UpdaterClient) CheckUpdate

func (c *UpdaterClient) CheckUpdate() error

func (*UpdaterClient) LicenseProcess

func (c *UpdaterClient) LicenseProcess()

func (*UpdaterClient) MarkUpdateSent

func (c *UpdaterClient) MarkUpdateSent(updateId string) error

func (*UpdaterClient) UpdateInstaller

func (c *UpdaterClient) UpdateInstaller(version string) error

func (*UpdaterClient) UpdateProcess

func (c *UpdaterClient) UpdateProcess()

func (*UpdaterClient) UpdateToNewVersion

func (c *UpdaterClient) UpdateToNewVersion(version, edition, changelog string) error

func (*UpdaterClient) UploadLogs

func (c *UpdaterClient) UploadLogs(ctx context.Context, path string) error

type Version

type Version struct {
	Major          int
	Minor          int
	Patch          int
	PrereleaseName string // alpha, beta, rc, or empty
	PrereleaseNum  int    // the number after alpha.X, beta.X, rc.X
	Original       string
}

Version sorting functions

func ParseVersion

func ParseVersion(versionStr string) Version

type VersionDTO

type VersionDTO struct {
	Version   string `json:"version"`
	Changelog string `json:"changelog"`
}

type VersionFile

type VersionFile struct {
	Version   string `json:"version"`
	Changelog string `json:"changelog"`
	Edition   string `json:"edition"`
}

func GetVersion

func GetVersion() (VersionFile, error)

Jump to

Keyboard shortcuts

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