refactor and testing

This commit is contained in:
redanthrax 2022-06-21 11:17:38 -07:00
parent 91c9de6e34
commit c038774f2c
16 changed files with 445 additions and 195 deletions

View file

@ -2,7 +2,9 @@ package agent
import (
"os"
"time"
gocmd "github.com/go-cmd/cmd"
"github.com/go-resty/resty/v2"
"github.com/kardianos/service"
"github.com/sirupsen/logrus"
@ -37,3 +39,31 @@ type Agent struct {
GoArch string
ServiceConfig *service.Config
}
type AgentConfig struct {
BaseURL string
AgentID string
APIURL string
Token string
AgentPK string
PK int
Cert string
Proxy string
CustomMeshDir string
}
type CmdStatus struct {
Status gocmd.Status
Stdout string
Stderr string
}
type CmdOptions struct {
Shell string
Command string
Args []string
Timeout time.Duration
IsScript bool
IsExecutable bool
Detached bool
}