config

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CollectionInterval is the interval at which data is collected to upload.
	CollectionInterval = 33 * time.Second

	// HeartbeatInterval is the interval at which the heartbeat is sent.
	HeartbeatInterval = 60 * time.Second

	// RefreshRemoteConfigInterval is the interval at which the remote config is refreshed.
	RefreshRemoteConfigInterval = 60 * time.Second

	// TaskCheckInterval is the interval at which the task is checked.
	TaskCheckInterval = 60 * time.Second

	// ReloadRulesInterval is the interval at which the rules are reloaded.
	ReloadRulesInterval = 60 * time.Second

	// RuleCheckListenFilesInterval is the periodic interval to listen for files to be processed.
	RuleCheckListenFilesInterval = 23 * time.Second

	// RuleScanCollectInfosInterval is the interval at which the rule is scanned to collect infos.
	RuleScanCollectInfosInterval = 27 * time.Second

	// DeviceAuthCheckInterval is the interval at which the device is checked for authorization.
	DeviceAuthCheckInterval = 60 * time.Second
)
View Source
const (
	LocalFilePrefix  = "file://"
	RemoteFilePrefix = "cos://"
)

Variables

This section is empty.

Functions

func GetCollectInfoFolder

func GetCollectInfoFolder() string

func GetDBPath

func GetDBPath() string

func GetRecordCacheFolder

func GetRecordCacheFolder() string

func GetUserBaseFolder

func GetUserBaseFolder() string

Types

type ApiConfig

type ApiConfig struct {
	ServerURL   string `koanf:"server_url"   yaml:"server_url" json:"server_url"`
	ProjectSlug string `koanf:"project_slug" yaml:"project_slug" json:"project_slug"`
	OrgSlug     string `koanf:"org_slug"     yaml:"org_slug" json:"org_slug"`
	// Insecure is deprecated. TLS certificate verification is now mandatory for security.
	// This field is kept for backward compatibility but is ignored at runtime.
	Insecure bool `koanf:"insecure" yaml:"insecure" json:"insecure"`
}

type AppConfig

type AppConfig struct {
	Api ApiConfig `koanf:"api" yaml:"api" json:"api"`

	// Collector CollectorConfig `yaml:"collector"`
	Collector CollectorConfig `koanf:"collector" yaml:"collector" json:"collector"`

	// Device DeviceConfig `yaml:"device"`
	Device DeviceConfig `koanf:"device" yaml:"device" json:"device"`

	// Topics []string `yaml:"topics"`
	Topics []string `koanf:"topics" yaml:"topics" json:"topics"`

	// Register RegisterConfig `yaml:"register"`
	Register RegisterConfig `koanf:"register" yaml:"register" json:"register"`

	// Mod config
	Mod ModConfConfig `koanf:"mod" yaml:"mod" json:"mod"`

	// HttpServer HttpServerConfig `yaml:"http_server"`
	HttpServer HttpServerConfig `koanf:"http_server" yaml:"http_server" json:"http_server"`

	// PluginConfig other coscene plugin config, such as coEncoder..., which is not cos's config
	PluginConfig interface{} `koanf:"plugin_config" yaml:"plugin_config" json:"plugin_config"`

	// Upload
	Upload UploadConfig `koanf:"upload" yaml:"upload" json:"upload"`

	// Master-Slave configuration
	MasterSlave MasterSlaveConfig `koanf:"master_slave" yaml:"master_slave" json:"master_slave"`

	// import other config
	Import []string `koanf:"__import__" yaml:"__import__" json:"__import__"`
}

type CollectorConfig

type CollectorConfig struct {
	DeleteAfterIntervalInHours int  `koanf:"delete_after_interval_in_hours" yaml:"delete_after_interval_in_hours" json:"delete_after_interval_in_hours"`
	SkipCheckSameFile          bool `koanf:"skip_check_same_file" yaml:"skip_check_same_file" json:"skip_check_same_file"`
}

type ConfManager

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

func InitConfManager

func InitConfManager(cfg string, s *storage.Storage) *ConfManager

func (ConfManager) GetStorage

func (c ConfManager) GetStorage() *storage.Storage

func (ConfManager) LoadOnce

func (c ConfManager) LoadOnce() AppConfig

func (ConfManager) LoadWithRemote

func (c ConfManager) LoadWithRemote() *AppConfig

func (ConfManager) SetRemote

func (c ConfManager) SetRemote(key string, value string)

type DefaultModConfConfig

type DefaultModConfConfig struct {
	ListenDirs            []string `koanf:"listen_dirs" yaml:"listen_dirs" json:"listen_dirs"`
	CollectDirs           []string `koanf:"collect_dirs" yaml:"collect_dirs" json:"collect_dirs"`
	Ros2CustomizedMsgDirs []string `koanf:"ros2_customized_msgs_dirs" yaml:"ros2_customized_msgs_dirs" json:"ros2_customized_msgs_dirs"`
	UploadFiles           []string `koanf:"upload_files" yaml:"upload_files" json:"upload_files"`
	SkipPeriodHours       int      `koanf:"skip_period_hours" yaml:"skip_period_hours" json:"skip_period_hours"`
	RecursivelyWalkDirs   bool     `koanf:"recursively_walk_dirs" yaml:"recursively_walk_dirs" json:"recursively_walk_dirs"`
}

type DeviceConfig

type DeviceConfig struct {
	ExtraFiles []string `koanf:"extra_files" yaml:"extra_files" json:"extra_files"`
}

type FileModRegisterConfig

type FileModRegisterConfig struct {
	SnFile  string `koanf:"sn_file"  yaml:"sn_file" json:"sn_file"`
	SnField string `koanf:"sn_field" yaml:"sn_field" json:"sn_field"`
}

type HttpServerConfig

type HttpServerConfig struct {
	Port int `koanf:"port" yaml:"port" json:"port"`
}

type MasterConfig added in v1.1.11

type MasterConfig struct {
	Port              int           `yaml:"port"`                // Master listening port
	SlaveTimeout      time.Duration `yaml:"slave_timeout"`       // Slave timeout duration
	MaxSlaves         int           `yaml:"max_slaves"`          // Maximum number of slaves (0 = unlimited)
	FileTransferChunk int           `yaml:"file_transfer_chunk"` // File transfer chunk size
	RequestTimeout    time.Duration `yaml:"request_timeout"`     // Request timeout duration
}

MasterConfig master configuration.

func DefaultMasterConfig added in v1.1.11

func DefaultMasterConfig() *MasterConfig

DefaultMasterConfig returns default master configuration.

type MasterSlaveConfig added in v1.1.11

type MasterSlaveConfig struct {
	// Whether to enable master mode (default false)
	Enabled bool `koanf:"enabled" yaml:"enabled" json:"enabled"`
}

type ModConfConfig

type ModConfConfig struct {
	Name   string      `koanf:"name" yaml:"name" json:"name"`
	Config interface{} `koanf:"conf" yaml:"conf" json:"conf"`
}

type NetworkRule added in v1.1.9

type NetworkRule struct {
	Enabled         bool     `koanf:"enabled" yaml:"enabled" json:"enabled"`
	BlackInterfaces []string `koanf:"black_interfaces" yaml:"black_interfaces" json:"black_interfaces"`
	Server          string   `koanf:"server" yaml:"server" json:"server"`
}

type RegisterConfig

type RegisterConfig struct {
	Provider string      `koanf:"type"   yaml:"type" json:"type"`
	Conf     interface{} `koanf:"config" yaml:"config" json:"config"`
}

type SlaveConfig added in v1.1.11

type SlaveConfig struct {
	ID                string        `yaml:"id"`                 // Unique slave ID (auto-generated)
	IP                string        `yaml:"ip"`                 // IP address of the slave, required
	Port              int           `yaml:"port"`               // Listening port
	MasterIP          string        `yaml:"master_ip"`          // Master IP address, required
	MasterPort        int           `yaml:"master_port"`        // Master port
	HeartbeatInterval time.Duration `yaml:"heartbeat_interval"` // Heartbeat interval
	RequestTimeout    time.Duration `yaml:"request_timeout"`    // Request timeout
	MaxFileSize       int64         `yaml:"max_file_size"`      // Maximum file size
	FilePrefix        string        `yaml:"file_prefix"`        // File folder prefix
}

SlaveConfig slave configuration.

func DefaultSlaveConfig added in v1.1.11

func DefaultSlaveConfig() *SlaveConfig

DefaultSlaveConfig returns default slave configuration.

type UploadConfig added in v1.1.9

type UploadConfig struct {
	NetworkRule NetworkRule `koanf:"network_rule" yaml:"network_rule" json:"network_rule"`
	// RateLimit controls upload throughput, e.g. "10MB", "512KB". Empty or zero means unlimited.
	RateLimit string `koanf:"rate_limit" yaml:"rate_limit" json:"rate_limit"`
}

Jump to

Keyboard shortcuts

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