Version: v0.0.0-...-48db7f4 Latest Latest

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

Go to latest
Published: Jan 29, 2020 License: GPL-3.0 Imports: 21 Imported by: 0




This section is empty.


View Source
var (
	ErrApi        = errors.New("api error")
	ErrDeprecated = errors.New("api deprecated")
View Source
var CanaryVersion string


func DumpProcessMap

func DumpProcessMap()

func NewSystemLibrary

func NewSystemLibrary(lib libspector.Library) (sysLib systemLibrary, err error)

func ShipProcessMap

func ShipProcessMap(a *Agent)


type Agent

type Agent struct {
	DoneChannel chan os.Signal
	// contains filtered or unexported fields

func NewAgent

func NewAgent(version string, conf *conf.Conf, clients ...Client) *Agent

func (*Agent) BuildAndSyncWatchers

func (agent *Agent) BuildAndSyncWatchers()

func (*Agent) CloseWatches

func (agent *Agent) CloseWatches()

This has to be called before exiting

func (*Agent) FirstRun

func (agent *Agent) FirstRun() bool

func (*Agent) Heartbeat

func (agent *Agent) Heartbeat() error

func (*Agent) OnChange

func (agent *Agent) OnChange(w Watcher)

func (*Agent) PerformUpgrade

func (agent *Agent) PerformUpgrade()

func (*Agent) RegisterServer

func (agent *Agent) RegisterServer() error

func (*Agent) StartPolling

func (agent *Agent) StartPolling()

instantiate structs, fs hook

func (*Agent) SyncAllFiles

func (agent *Agent) SyncAllFiles()

type CanaryClient

type CanaryClient struct {
	// contains filtered or unexported fields

func NewClient

func NewClient(apiKey string, server *Server) *CanaryClient

func (*CanaryClient) CreateServer

func (c *CanaryClient) CreateServer(srv *Server) (string, error)

func (*CanaryClient) FetchUpgradeablePackages

func (client *CanaryClient) FetchUpgradeablePackages() (map[string]string, error)

func (*CanaryClient) Heartbeat

func (client *CanaryClient) Heartbeat(uuid string, files Watchers) error

func (*CanaryClient) SendFile

func (client *CanaryClient) SendFile(path string, kind string, contents []byte) error

func (*CanaryClient) SendProcessState

func (client *CanaryClient) SendProcessState(match string, body []byte) error

type ChangeHandler

type ChangeHandler func(Watcher)

type Client

type Client interface {
	Heartbeat(string, Watchers) error
	SendFile(string, string, []byte) error
	SendProcessState(string, []byte) error
	CreateServer(*Server) (string, error)
	FetchUpgradeablePackages() (map[string]string, error)

type MockClient

type MockClient struct {

func (*MockClient) CreateServer

func (m *MockClient) CreateServer(_a0 *Server) (string, error)

func (*MockClient) FetchUpgradeablePackages

func (m *MockClient) FetchUpgradeablePackages() (map[string]string, error)

func (*MockClient) Heartbeat

func (m *MockClient) Heartbeat(_a0 string, _a1 Watchers) error

func (*MockClient) SendFile

func (m *MockClient) SendFile(_a0 string, _a1 string, _a2 []byte) error

func (*MockClient) SendProcessState

func (m *MockClient) SendProcessState(_a0 string, _a1 []byte) error

type ProcessWatcher

type ProcessWatcher interface {
	Match() string
	StateJson() []byte

type Server

type Server struct {
	Hostname string   `json:"hostname"`
	Uname    string   `json:"uname"`
	Ip       string   `json:"ip"`
	Name     string   `json:"name"`
	UUID     string   `json:"uuid,omitempty"`
	Distro   string   `json:"distro,omitempty"`
	Release  string   `json:"release,omitempty"`
	Tags     []string `json:"tags,omitempty"`

func NewServer

func NewServer(agentConf *conf.Conf, serverConf *conf.ServerConf) *Server

Creates a new server and syncs conf if needed

func (*Server) IsCentOS

func (server *Server) IsCentOS() bool

func (*Server) IsNew

func (server *Server) IsNew() bool

func (*Server) IsUbuntu

func (server *Server) IsUbuntu() bool

type TextWatcher

type TextWatcher interface {
	Contents() ([]byte, error)
	Path() string
	Kind() string
	MarshalJSON() ([]byte, error)

type UpgradeCommand

type UpgradeCommand struct {
	Name string
	Args []string

type UpgradeSequence

type UpgradeSequence []UpgradeCommand

type Watcher

type Watcher interface {

func NewAllProcessWatcher

func NewAllProcessWatcher(callback ChangeHandler) Watcher

func NewCommandOutputWatcher

func NewCommandOutputWatcher(process string, callback ChangeHandler) Watcher

Process watchers track changes in the output of a command

func NewFileWatcher

func NewFileWatcher(path string, callback ChangeHandler) Watcher

File watchers track changes in the contents of a file

func NewProcessWatcher

func NewProcessWatcher(match string, callback ChangeHandler) Watcher

type Watchers

type Watchers []Watcher


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL