masterbot

package module
v0.0.0-...-98e5a49 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BotStatStopped     string = "S"
	BotStatRunning     string = "R"
	BotStatPaused      string = "P" //Used to disable
	BotStatUnreachable string = "U"
)
View Source
const SSHPort string = "22"

Variables

View Source
var ErrCreatingSession = errors.New("Error failed creating session")
View Source
var ErrDialingToBot = errors.New("Error failed dialing to bot")
View Source
var ErrFailedPingingBot = errors.New("Error failed pinging bot")
View Source
var ErrFailedStartingBot = errors.New("Error failed to starting bot")
View Source
var ErrLoadingCliCerts = errors.New("Error Loading client certificates")
View Source
var ErrNoBotsToPing = errors.New("Error no bots to ping at")
View Source
var ErrParsingConfig = errors.New("Error parsing config.json")
View Source
var ErrParsingSSHKeys = errors.New("Error parsing SSH keys (id_dsa)")
View Source
var ErrReadingConfig = errors.New("Error reading config.json")
View Source
var ErrReadingSSHKeys = errors.New("Error reading SSH keys (id_dsa)")
View Source
var ErrStatusStoppingBot = errors.New("Error of status stopping bot")
View Source
var ErrStoppingBot = errors.New("Error stopping bot")
View Source
var Kairos *cron.Cron
View Source
var ReBotSearchInputParameters *regexp.Regexp = regexp.MustCompile("#([\\pL0-9_]+)")
View Source
var ReBotSearchOutputData *regexp.Regexp = regexp.MustCompile("\\$([\\pL0-9_]+)")

Functions

This section is empty.

Types

type BotClientPtr

type BotClientPtr *BotClientT

type BotClientT

type BotClientT struct {
	BinDir       string         `json:"bindir"`
	BinName      string         `json:"binname"`
	Listen       string         `json:"listen"`
	Host         Hosts          `json:"host"`
	SysUser      string         `json:"sysuser"`
	WorkDir      string         `json:"workdir"`
	SearchPath   string         `json:"searchpath"`
	SearchPathRE *regexp.Regexp `json:"-"`
	StatusT
	CronPingId []int    `json:"-"`
	CronPingFn []func() `json:"-"`
}

func (*BotClientT) PingAt

func (s *BotClientT) PingAt(botId string, botInstance int, cfg *ConfigT) error

func (*BotClientT) Start

func (s *BotClientT) Start(botId string, botInstance int, cmdline string, cfg *ConfigT, debugLevel int) error

func (*BotClientT) Stop

func (svc *BotClientT) Stop(botId string, cfg *ConfigT, botInstance int) error

type BotClientsT

type BotClientsT map[string]BotClientPtr

func (*BotClientsT) Start

func (bc *BotClientsT) Start(config *ConfigT, cmdline string, debugLevel int)

func (*BotClientsT) UnmarshalJSON

func (bc *BotClientsT) UnmarshalJSON(buf []byte) error

type ConfigT

type ConfigT struct {
	Id               string            `json:"id"`
	Host             Hosts             `json:"host"`
	SysUser          string            `json:"sysuser"`
	WorkDir          string            `json:"workdir"`
	Listen           string            `json:"listen"`
	CrlListen        string            `json:"crllisten"`
	PageNotFoundPath string            `json:"pageNotFound"`
	Pem              string            `json:"pem"`
	BinDir           string            `json:"bindir"`
	BinName          string            `json:"binname"`
	ClientCert       tls.Certificate   `json:"-"`
	ClientCA         *x509.CertPool    `json:"-"`
	Bot              BotClientsT       `json:"bot,omitempty"`
	SshClientConfig  *ssh.ClientConfig `json:"-"`
	BotPingRate      string            `json:"botpingrate,omitempty"`
	BotCommTimeout   Timeout           `json:"botcommtimeout,omitempty"`
	HttpsPingClient  *http.Client      `json:"-"`
	HttpsStopClient  *http.Client      `json:"-"`
	Certkit          stonelizard.AuthT `json:"-"`
	Transport        *http.Transport   `rset:"-"`
}

func ReadConfig

func ReadConfig(cfgReader io.Reader) ([]byte, *ConfigT, error)

func (ConfigT) CRLListenAddress

func (cfg ConfigT) CRLListenAddress() string

func (ConfigT) CertKit

func (cfg ConfigT) CertKit() stonelizard.AuthT

func (ConfigT) GetHost

func (cfg ConfigT) GetHost() []Host

func (ConfigT) HttpsClient

func (cfg ConfigT) HttpsClient(tmout time.Duration) *http.Client

func (ConfigT) ListenAddress

func (cfg ConfigT) ListenAddress() string

func (*ConfigT) LoadClientCert

func (cfg *ConfigT) LoadClientCert() error

func (*ConfigT) NewSshClientConfig

func (cfg *ConfigT) NewSshClientConfig(privKeyPath string) error

func (ConfigT) PageNotFound

func (cfg ConfigT) PageNotFound() []byte

func (*ConfigT) PingAt

func (cfg *ConfigT) PingAt() error

func (*ConfigT) Start

func (cfg *ConfigT) Start(cmdline string, dbgLevel int) error

func (ConfigT) Stop

func (cfg ConfigT) Stop() error

type Host

type Host struct {
	Name string `json:"name"`
	Port string `json:"port"` // Used when the SSH port is non standard
	StatusT
}

type Hosts

type Hosts []Host

type MasterbotG

type MasterbotG struct {
	StartStop goose.Alert
	Ping      goose.Alert
	ClientCfg goose.Alert
}
var Goose MasterbotG

type ServiceT

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

func New

func New(botId string, appcfg *ConfigT, onStop func()) *ServiceT

func (ServiceT) GetConfig

func (svc ServiceT) GetConfig() (stonelizard.Shaper, error)

func (ServiceT) Stop

func (svc ServiceT) Stop() stonelizard.Response

type StatusT

type StatusT struct {
	Status       string             `json:"status"`
	OnStatUpdate func(string) error `json:"-"`
}

type Timeout

type Timeout time.Duration

func (Timeout) MarshalJSON

func (t Timeout) MarshalJSON() ([]byte, error)

func (*Timeout) Set

func (t *Timeout) Set(val string)

func (Timeout) String

func (t Timeout) String() string

func (*Timeout) UnmarshalJSON

func (t *Timeout) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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