Versions in this module Expand all Collapse all v0 v0.1.0 Mar 15, 2024 Changes in this version + var Config string + var Dir string + var ForwardTaskHandlers = map[string]map[string]ForwardTaskHandleFunc + var JobDefinitions = map[string]any + var Log *zap.Logger + var LogDestinations = []string + var LogLevels = []string + var LogR *zap.Logger + var TaskHandlers = map[string]TaskHandleFunc + var Version string + func AddPortTrafficMonitor(localPort int, remoteHost string, remotePort int) + func Decrypt(encryptedData string, key []byte) ([]byte, error) + func DeletePortTrafficMonitor(localPort int) + func GenerateUnusedPort() int + func GetRandomPort() int + func InitLog(level string, destination string) + func PortIsUsed(port int) bool + func ReInitLog(level string) + func ReportStatExecutor() + func ReportTrafficExecutor() + func SelectAvailablePort(port *int) + func ShellExecutor(shell Shell) []byte + func Sign(payload interface{}, secret string) string + func SyncLog() + func ValidateLogDest(logDest string) error + func ValidateLogLevel(logLevel string) error + type Agent struct + AgentId string + DB *redis.Client + Jobs map[string]gocron.Job + Scheduler gocron.Scheduler + func NewAgent(option Options, agentId string) *Agent + func (agent *Agent) GetConfig(key string) string + func (agent *Agent) GetConfigWithGlobal(key string, global bool) string + func (agent *Agent) Ready() bool + func (agent *Agent) ReportLog(log string) + func (agent *Agent) ReportStat(status string) + func (agent *Agent) ReportTaskResult(taskId string, success bool, extra string) + func (agent *Agent) ReportTraffic(traffic string) + func (agent *Agent) Start(ctx context.Context) + func (agent *Agent) Stop() + func (agent *Agent) UpdateJobCron(cronKey string) + type CPUInfo struct + Cores int32 + Mhz float64 + ModelName string + type ConfigChangeTask struct + Key string + Value string + type ForwardTask struct + Action string + AgentPort int + ForwardId string + Method string + Options json.RawMessage + Target string + TargetPort int + type ForwardTaskHandleFunc func(forwardTask ForwardTask) (interface{}, error) + type ForwardTaskResult struct + AgentPort int + type IAgent interface + GetConfig func(key string) string + GetConfigWithGlobal func(key string, global bool) string + Ready func() bool + ReportLog func(log string) + ReportStat func(stat string) + ReportTaskResult func(taskId string, success bool, extra string) + ReportTraffic func(traffic string) + Start func(ctx context.Context) + Stop func() + UpdateJobCron func(cronKey string) + var GlobalAgent IAgent + type IpInfo struct + CountryISO string + IPv4 string + IPv6 string + func (ipInfo *IpInfo) String() string + type Options struct + Addr string + DB int + Password string + Username string + type PingTask struct + Count int + Host string + TimeOut int64 + type RemoteWriteSyncer struct + func (r RemoteWriteSyncer) Write(p []byte) (n int, err error) + type Shell struct + Args []string + Command string + Internal bool + type ShellTask struct + Internal bool + Shell string + type Task struct + Id string + OriginData []byte + Type string + type TaskHandleFunc func(task Task) (interface{}, error) + type TaskResult struct + Extra string + Id string + Success bool