Documentation ¶
Index ¶
- Constants
- type Command
- type CommandProcessor
- type CommandProcessorImpl
- type Config
- type Core
- func (core *Core) APIKeyMatch(key string) bool
- func (core *Core) GetCommandProcessor() *CommandProcessorImpl
- func (core *Core) GetConfig() Config
- func (core *Core) GetLogger(name string) *logrus.Logger
- func (core *Core) GetModule(name string) *ModuleConfig
- func (core *Core) GetServer() *HttpServer
- func (core *Core) GetSupervisor() *Supervisor
- func (core *Core) GoWoxy(configPath string)
- func (core *Core) Hook(mc *ModuleConfig, r com.Route) error
- func (core *Core) HookAll(mc *ModuleConfig)
- func (core *Core) SaveModuleChanges(mc *ModuleConfig)
- func (core *Core) SearchModWithHash(hash string) *ModuleConfig
- func (core *Core) SetServer(s *HttpServer)
- func (core *Core) Setup(mc ModuleConfig, hook bool, modulePath string) (*ModuleConfig, error)
- type Entity
- type HttpServer
- type ModuleAuthConfig
- type ModuleCommand
- type ModuleConfig
- type ModuleExecConfig
- type ModuleLogConfig
- type Role
- type Supervisor
Constants ¶
const Version = "0.0.1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command interface { Run(core *Core, r *com.Request, m *ModuleConfig, args ...string) (string, error) Error() error GetResult() string GetName() string // contains filtered or unexported methods }
Command - Command interface
type CommandProcessor ¶
type CommandProcessor interface { Register(name string, run func(*Core, *com.Request, *ModuleConfig, ...string) (string, error)) bool Run(name string, r com.Request, m ModuleConfig, args ...string) Command }
CommandProcessor - CommandProcessor
type CommandProcessorImpl ¶
type CommandProcessorImpl struct {
// contains filtered or unexported fields
}
CommandProcessorImpl -
func (*CommandProcessorImpl) Init ¶
func (cp *CommandProcessorImpl) Init()
Init - Init CommandProcessorImpl with default commands
type Config ¶
type Config struct { ACCESSLOGFILE string MODULES map[string]ModuleConfig MOTD string NAME string SECRET string MODDIR string RESOURCEDIR string SERVER com.ServerConfig VERSION int }
Config - Global configuration
func (*Config) GetMotdFileContent ¶
GetMotdFileContent - Get motd file content from motd path
func (*Config) LoadConfig ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core - GO-WOXY Core Server
func (*Core) APIKeyMatch ¶
APIKeyMatch - Check if given key match api key hash
func (*Core) GetCommandProcessor ¶
func (core *Core) GetCommandProcessor() *CommandProcessorImpl
GetCommandProcessor - Get CommandProcessor
func (*Core) GetModule ¶
func (core *Core) GetModule(name string) *ModuleConfig
GetModule - Get module reference from core list module
func (*Core) GetSupervisor ¶
func (core *Core) GetSupervisor() *Supervisor
GetSupervisor - Get module supervisor
func (*Core) Hook ¶
func (core *Core) Hook(mc *ModuleConfig, r com.Route) error
Hook - Create a binding between module and router server
func (*Core) HookAll ¶
func (core *Core) HookAll(mc *ModuleConfig)
HookAll - Create all binding between module config address and router server
func (*Core) SaveModuleChanges ¶
func (core *Core) SaveModuleChanges(mc *ModuleConfig)
SaveModuleChanges - Thread safe way to edit Module state
func (*Core) SearchModWithHash ¶
func (core *Core) SearchModWithHash(hash string) *ModuleConfig
SearchModWithHash - Thread safe way to get module with his hash
func (*Core) Setup ¶
func (core *Core) Setup(mc ModuleConfig, hook bool, modulePath string) (*ModuleConfig, error)
Setup - Setup module from config
type HttpServer ¶
HttpServer -
func (*HttpServer) WaitShutdown ¶
func (s *HttpServer) WaitShutdown()
WaitShutdown - Wait server to shutdown correctly
type ModuleAuthConfig ¶
ModuleAuthConfig - ModuleConfig Auth configuration
type ModuleCommand ¶
type ModuleCommand struct {
// contains filtered or unexported fields
}
ModuleCommand - Command implementation
func (*ModuleCommand) Error ¶
func (mc *ModuleCommand) Error() error
Error - Get command execution error
func (*ModuleCommand) GetName ¶
func (mc *ModuleCommand) GetName() string
GetName - Get command name
func (*ModuleCommand) GetResult ¶
func (mc *ModuleCommand) GetResult() string
GetResult - Get command result
func (*ModuleCommand) Run ¶
func (mc *ModuleCommand) Run(core *Core, r *com.Request, m *ModuleConfig, args ...string) (string, error)
Run - Command
type ModuleConfig ¶
type ModuleConfig struct { API_KEY string AUTH ModuleAuthConfig BINDING com.ServerConfig COMMANDS []string EXE ModuleExecConfig NAME string PK string RESOURCEPATH string LOG ModuleLogConfig STATE com.ModuleState TYPES string VERSION int // contains filtered or unexported fields }
ModuleConfig - Module configuration
func (*ModuleConfig) Download ¶
func (mc *ModuleConfig) Download(moduleDir string)
Download - Download module from repository ( git clone )
func (*ModuleConfig) GetPerf ¶
func (mc *ModuleConfig) GetPerf() (float64, float32)
GetPerf - GetPerf from Module
func (*ModuleConfig) GetServer ¶
func (mc *ModuleConfig) GetServer(path string) com.Server
GetServer - Get Module Server configuration
func (*ModuleConfig) Start ¶
func (mc *ModuleConfig) Start()
Start - Start module with config args and auto args
type ModuleExecConfig ¶
type ModuleExecConfig struct { BIN string MAIN string REMOTE bool SRC string SUPERVISED bool LastPing time.Time }
ModuleExecConfig - Module exec file informations
type ModuleLogConfig ¶
type ModuleLogConfig struct { Enabled *bool `yaml:"enabled"` File string `yaml:"file"` Path string `yaml:"path"` }
ModuleLogConfig - Module Logging Configuration
func (*ModuleLogConfig) IsEnabled ¶
func (mlc *ModuleLogConfig) IsEnabled() bool