Versions in this module Expand all Collapse all v0 v0.0.10 Apr 10, 2026 v0.0.9 Mar 17, 2026 Changes in this version + const APP_NAME + const HEADER_AGENT_ADDRESS + const HEADER_AGENT_BUILD_TIME + const HEADER_AGENT_GIT_BRANCH + const HEADER_AGENT_GIT_COMMIT + const HEADER_AGENT_GIT_TAG + const HEADER_AGENT_HOSTNAME + const HEADER_AGENT_ID + const HEADER_AGENT_KEY + var StatusToString = map[STATUS]string + var StringToStatus = map[string]STATUS + func ComparedEncryptKey(cipheredSrc, cipheredTarget string) (bool, error) + func DecryptAgentKey(cipheredKey string) (string, error) + func EncodeMessage(v any) (json.RawMessage, error) + func EncryptAgentKey(text string) (string, error) + type Action string + const ACTION_CANCEL_TASK + const ACTION_RUN_TASK + type Agent struct + CreateTime time.Time + Id string + UpdateTime time.Time + func NewAgent(req CreateAgentRequest) *Agent + func (a *Agent) EncryptAgentKey() error + func (a *Agent) String() string + func (a *Agent) TableName() string + func (a *Agent) UpdateHeartbeatAt(t time.Time) + func (a *Agent) ValidateKey(id, key string) error + func (e *Agent) LoadFromEvent(event *bus.Event) error + func (e *Agent) ToBusEvent(topic string) *bus.Event + func (r *Agent) DecryptedAgentKey() error + func (r *Agent) RefreshCrendential() + type AgentCrendential struct + IsEncrypted bool + Key string + OldKey string + RefreshAt time.Time + func (c AgentCrendential) TableName() string + type AgentMessage struct + Data json.RawMessage + RequestId string + Type MessageType + type AgentMetricMessage struct + AgentId string + CPUCores int + CPUUsagePercent float64 + DiskTotalGB int64 + DiskUsagePercent float64 + DiskUsedGB int64 + FileHandleUsagePercent float64 + GoroutineCount int + InodeUsagePercent float64 + LoadAverage1 float64 + LoadAverage15 float64 + LoadAverage5 float64 + MemoryTotalMB int64 + MemoryUsagePercent float64 + MemoryUsedMB int64 + ProcessCount int + ReportTime time.Time + RunningTasks int + type AgentRegistryInfo struct + Address string + HostName string + NodeName string + RegistryAt *time.Time + func (r *AgentRegistryInfo) SetNodeName(name string) + func (r *AgentRegistryInfo) SetRegistryAt(t time.Time) + func (r *AgentRegistryInfo) String() string + func (r *AgentRegistryInfo) TableName() string + type AgentRegistryInfoRequest struct + func (r *AgentRegistryInfoRequest) TableName() string + type AgentRegistryRequest struct + AgentId string + AgentKey string + func NewAgentRegistryRequest() *AgentRegistryRequest + func (a *AgentRegistryRequest) GetWebSocketConn() *websocket.Conn + func (a *AgentRegistryRequest) SetWebSocketConn(conn *websocket.Conn) + type AgentStatus struct + LatestHeartbeatAt *time.Time + Message string + OfflineAt *time.Time + Status STATUS + func NewAgentOnlineStatus() *AgentStatus + func (r *AgentStatus) Error(err error) + func (r *AgentStatus) IsOnline() bool + func (r *AgentStatus) Offline(t time.Time) + func (r *AgentStatus) Online(t time.Time) + func (r *AgentStatus) SetLatestHeartbeatAt(t time.Time) + func (r *AgentStatus) SetOfflineAt(t time.Time) + func (r *AgentStatus) SetStatus(status STATUS) + func (r *AgentStatus) String() string + func (r *AgentStatus) TableName() string + func (r *AgentStatus) Unknown(msg string) + type AgentVersion struct + BuildTime string + GitBranch string + GitCommit string + GitTag string + type CloseConnectionRequest struct + SkipDecrement bool + SkipOffline bool + func NewCloseConnectionRequest(agentId string) *CloseConnectionRequest + func (r *CloseConnectionRequest) SetSkipDecrement(skip bool) *CloseConnectionRequest + func (r *CloseConnectionRequest) SetSkipOffline(skip bool) *CloseConnectionRequest + type Connection struct + Agent *Agent + func NewConnection(ws *websocket.Conn, agent *Agent) *Connection + func (c *Connection) Close() error + func (c *Connection) GetErrorChan() <-chan error + func (c *Connection) RegisterMessageHandler(msgType MessageType, handler ResponseHandler) + func (c *Connection) RunTask(req *RunTaskRequest) error + func (c *Connection) SetLogger(log *zerolog.Logger) *Connection + func (c *Connection) StartMessageLoop(ctx context.Context) + type CreateAgentRequest struct + Description string + Enabled *bool + Envs []string + Features []string + Label map[string]string + MaxRunningTasks int + Metadata map[string]string + Name string + func NewCreateAgentRequest() *CreateAgentRequest + func (r *CreateAgentRequest) AddEnv(envs ...string) + func (r *CreateAgentRequest) AddFeature(features ...string) + func (r *CreateAgentRequest) Validate() error + type DESCRIBE_BY int + const DESCRIBE_BY_ID + const DESCRIBE_BY_NAME + type DescribeAgentRequest struct + DescribeBy DESCRIBE_BY + Value string + func NewDescribeAgentRequest(id string) *DescribeAgentRequest + func (r *DescribeAgentRequest) WithId(id string) *DescribeAgentRequest + func (r *DescribeAgentRequest) WithName(name string) *DescribeAgentRequest + type GetConnectionRequest struct + AgentId string + func NewGetConnectionRequest(agentId string) *GetConnectionRequest + type HeartbeatConfig struct + IntervalSec int + MaxMissed int + type HeartbeatReportRequest struct + AgentId string + func NewHeartbeatReportRequest(agentId string) *HeartbeatReportRequest + type HeartbeatReportResponse struct + Agent *Agent + type MessageType string + const MESSAGE_TYPE_AGENT_METRIC + const MESSAGE_TYPE_TASK_CONFIRM + const MESSAGE_TYPE_TASK_LOG + const MESSAGE_TYPE_TASK_RESULT + type QueryAgentRequest struct + AgentIds []string + Enabled *bool + EnvName *string + Feature string + Label map[string]string + Status *STATUS + func NewQueryAgentRequest() *QueryAgentRequest + func (r *QueryAgentRequest) SetEnabled(v bool) *QueryAgentRequest + func (r *QueryAgentRequest) SetEnvName(v string) *QueryAgentRequest + func (r *QueryAgentRequest) SetFeature(v string) *QueryAgentRequest + func (r *QueryAgentRequest) SetStatus(v STATUS) *QueryAgentRequest + func (r *QueryAgentRequest) String() string + type Register interface + CloseConnection func(context.Context, *CloseConnectionRequest) error + GetConnection func(context.Context, *GetConnectionRequest) (*Connection, error) + HeartbeatReport func(context.Context, *HeartbeatReportRequest) (*HeartbeatReportResponse, error) + RegisterAgent func(context.Context, *AgentRegistryRequest) (*Connection, error) + func GetRegister() Register + type ResponseHandler interface + HandleResponse func(ctx context.Context, msg *AgentMessage) error + type RunTaskRequest struct + Action Action + RequestId string + Task *task.Task + func NewRunTaskRequest(action Action, task *task.Task) *RunTaskRequest + func (e *RunTaskRequest) LoadFromEvent(event *bus.Event) error + func (e *RunTaskRequest) ToBusEvent(topic string) *bus.Event + func (r *RunTaskRequest) LogCallback() func(content string) + func (r *RunTaskRequest) LogDebug(msg string) + func (r *RunTaskRequest) LogError(msg string) + func (r *RunTaskRequest) LogInfo(msg string) + func (r *RunTaskRequest) LogSuccess(msg string) + func (r *RunTaskRequest) LogWarn(msg string) + func (r *RunTaskRequest) SetLogCallback(callback func(content string)) *RunTaskRequest + func (r *RunTaskRequest) String() string + type RunTaskResponse struct + func NewRunTaskResponse(req *RunTaskRequest, result *script.ExecutionResult) *RunTaskResponse + func (r *RunTaskResponse) UpdateTaskStatus() + type STATUS int + const STATUS_ERROR + const STATUS_OFFLINE + const STATUS_ONLINE + const STAUTS_UNKNOWN + func ParseSTATUSFromString(s string) STATUS + func (t *STATUS) UnmarshalJSON(data []byte) error + func (t STATUS) MarshalJSON() ([]byte, error) + type Service interface + CreateAgent func(context.Context, *CreateAgentRequest) (*Agent, error) + DescribeAgent func(context.Context, *DescribeAgentRequest) (*Agent, error) + QueryAgent func(context.Context, *QueryAgentRequest) (*types.Set[*Agent], error) + RunTask func(context.Context, *task.Task) error + UpdateAgent func(context.Context, *UpdateAgentRequest) (*Agent, error) + func GetService() Service + type TaskConfirmMessage struct + AgentId string + TaskId string + type TaskHandler interface + HandleTask func(context.Context, *RunTaskRequest) (*RunTaskResponse, error) + type TaskLogMessage struct + Content string + Sequence int64 + TaskId string + Time time.Time + type UpdateAgentRequest struct + func NewUpdateAgentRequest() *UpdateAgentRequest