agent

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMACAddress = errors.New("no MAC address found")

ErrNoMACAddress is returned by MACAddress when no network interface with a hardware address is found.

Functions

func DefaultBaseBackoff added in v1.2.1

func DefaultBaseBackoff() time.Duration

DefaultBaseBackoff returns the base backoff duration for update retries. Uses baseBackoffStr if set via ldflags, otherwise defaults to 5 minutes.

func DefaultMaxRetries added in v1.2.1

func DefaultMaxRetries() int

DefaultMaxRetries returns the maximum number of update retry attempts. Uses maxRetriesStr if set via ldflags, otherwise defaults to 5.

func DefaultUpdateInterval added in v1.2.0

func DefaultUpdateInterval() time.Duration

DefaultUpdateInterval returns the auto-update check interval. Uses updateIntervalStr if set via ldflags, otherwise defaults to 48 hours.

func GetAgentExecutablePath

func GetAgentExecutablePath(orgId string) string

func GetConfigFilePath

func GetConfigFilePath(orgId string) string

func GetDataDirectory added in v0.4.0

func GetDataDirectory(orgId string) string

func GetLogFilePath

func GetLogFilePath(orgId string) string

func GetProgramDirectory added in v0.4.0

func GetProgramDirectory(orgId string) string

func GetScriptsDirectory

func GetScriptsDirectory(orgId string) string

func GetServiceExecutablePath

func GetServiceExecutablePath(orgId string) string

func GetServiceManagerPath

func GetServiceManagerPath(orgId string) string

func GetServiceName

func GetServiceName(orgId string) string

Types

type Asset added in v1.0.0

type Asset struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
	Url  string `json:"url"`
}

type AutoUpdateRunner added in v1.0.0

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

func NewAutoUpdateRunner added in v1.0.0

func NewAutoUpdateRunner(
	logger hclog.Logger,
	updater Updater,
	interval time.Duration,
	maxRetries int,
	baseBackoff time.Duration,
) *AutoUpdateRunner

func (*AutoUpdateRunner) Start added in v1.0.0

func (r *AutoUpdateRunner) Start()

func (*AutoUpdateRunner) Stop added in v1.0.0

func (r *AutoUpdateRunner) Stop()

type Device

type Device struct {
	DeviceId             string             `json:"device_id"`
	RewstOrgId           string             `json:"rewst_org_id"`
	RewstEngineHost      string             `json:"rewst_engine_host"`
	SharedAccessKey      string             `json:"shared_access_key"`
	AzureIotHubHost      string             `json:"azure_iot_hub_host"`
	Broker               string             `json:"broker"`
	LoggingLevel         utils.LoggingLevel `json:"logging_level"`
	UseSyslog            bool               `json:"syslog"`
	Plugins              []Plugin           `json:"plugins"`
	DisableAgentPostback bool               `json:"disable_agent_postback"`
	DisableAutoUpdates   bool               `json:"disable_auto_updates"`
	GithubToken          string             `json:"github_token,omitempty"`
	MqttQos              *byte              `json:"mqtt_qos,omitempty"`
}

type DomainInfoProvider added in v1.0.0

type DomainInfoProvider interface {
	ADDomain(ctx context.Context) (*string, error)
	IsADDomainController(ctx context.Context) (bool, error)
	IsEntraConnectServer() (bool, error)
	EntraDomain(ctx context.Context) (*string, error)
}

func NewDomainInfoProvider added in v1.0.0

func NewDomainInfoProvider() DomainInfoProvider

type HostInfo

type HostInfo struct {
	AgentVersion          string  `json:"agent_version"`
	AgentExecutablePath   string  `json:"agent_executable_path"`
	ServiceExecutablePath string  `json:"service_executable_path"`
	HostName              string  `json:"hostname"`
	MacAddress            *string `json:"mac_address"`
	OperatingSystem       string  `json:"operating_system"`
	CpuModel              string  `json:"cpu_model"`
	RamGb                 string  `json:"ram_gb"`
	AdDomain              *string `json:"ad_domain"`
	IsAdDomainController  bool    `json:"is_ad_domain_controller"`
	IsEntraConnectServer  bool    `json:"is_entra_connect_server"`
	EntraDomain           *string `json:"entra_domain"`
	OrgId                 string  `json:"org_id"`
}

func NewHostInfo added in v1.0.0

func NewHostInfo(
	ctx context.Context,
	orgId string,
	logger hclog.Logger,
	sys SystemInfoProvider,
	domain DomainInfoProvider,
) (*HostInfo, error)

type PathsData

type PathsData struct {
	ServiceExecutablePath string    `json:"service_executable_path"`
	AgentExecutablePath   string    `json:"agent_executable_path"`
	ConfigFilePath        string    `json:"config_file_path"`
	ServiceManagerPath    string    `json:"service_manager_path"`
	Tags                  *HostInfo `json:"tags"`
}

func NewPathsData added in v1.0.0

func NewPathsData(
	ctx context.Context,
	orgId string,
	logger hclog.Logger,
	sys SystemInfoProvider,
	domain DomainInfoProvider,
) (*PathsData, error)

type Plugin added in v0.12.0

type Plugin struct {
	Name           string `json:"name"`
	ExecutablePath string `json:"executable_path"`
}

type Release added in v1.0.0

type Release struct {
	Id      int     `json:"id"`
	TagName string  `json:"tag_name"`
	Assets  []Asset `json:"assets"`
}

type RunCommandFunc added in v1.0.0

type RunCommandFunc = func(path string, args []string) error

type SystemInfoProvider added in v1.0.0

type SystemInfoProvider interface {
	Hostname() (string, error)
	HostPlatform() (string, error)
	CPUModelName() (string, error)
	TotalMemoryBytes() (uint64, error)
	MACAddress() (*string, error)
}

func NewSystemInfoProvider added in v1.0.0

func NewSystemInfoProvider() SystemInfoProvider

type Updater added in v1.0.0

type Updater interface {
	Check() (Release, error)
	Update(updaterExecutablePath string) error
	SelectAsset(release Release) (Asset, error)
	Download(asset Asset) (string, error)
	Run() error
}

func NewUpdater added in v1.0.0

func NewUpdater(
	logger hclog.Logger,
	device *Device,
	latestReleaseUrl string,
	githubToken string,
	runCommand RunCommandFunc,
) Updater

Jump to

Keyboard shortcuts

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