Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultServerJar = "server.jar" DefaultServerProperties = "server.properties" DefaultLog4JConf = "mcvisor_log4J.xml" JaveHomeEnvName = "JAVA_HOME" )
View Source
const ( Stopped Status = "stopped" Starting Status = "starting" Started Status = "started" Ready Status = "ready" Unreachable Status = "unreachable" Stopping Status = "stopping" StartTarget Target = "start" StopTarget Target = "stop" RestartTarget Target = "restart" ShutdownTarget Target = "shutdown" StatusCommand commands.Name = "status" StartCommand commands.Name = "start" StopCommand commands.Name = "stop" RestartCommand commands.Name = "restart" ShutdownCommand commands.Name = "shutdown" ConsoleCommand commands.Name = "console" )
View Source
const JavaCmd string = "bin/java"
View Source
const (
OnlineCommand commands.Name = "online"
)
Variables ¶
View Source
var ( ErrPingDisabled = errors.New("both query and status are disabled server-side") ErrPingNever = errors.New("status unknown") )
View Source
var ( ConsoleCommandTimeout = 5 * time.Second ErrStoppedServer = errors.New("server is stopped") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Server *ServerConfig `json:"server"`
Java *JavaConfig `json:"java"`
}
func (Config) WorkingDir ¶
type JavaConfig ¶
type JavaConfig struct {
Home string `json:"home,omitempty" validate:"dir"`
Options []string `json:"options"`
}
func (JavaConfig) AbsJavaCommand ¶
func (c JavaConfig) AbsJavaCommand() string
func (JavaConfig) Command ¶
func (c JavaConfig) Command() []string
type NetworkConfig ¶
type NetworkConfig struct {
Host string `json:"host,omitempty" validate:"omitempty,ip|hostname|fqdn"`
Port uint16 `json:"port,omitempty"`
PingPeriod time.Duration `json:"ping_interval"`
ConnectionTimeout time.Duration `json:"connection_timeout"`
ResponseTimeout time.Duration `json:"response_timeout"`
}
type PingFailed ¶
func (*PingFailed) Error ¶
func (p *PingFailed) Error() string
func (*PingFailed) Fields ¶
func (p *PingFailed) Fields() log.Fields
func (PingFailed) IsSuccess ¶
func (PingFailed) IsSuccess() bool
type PingSucceeded ¶
type PingSucceeded struct {
When time.Time
Latency time.Duration
MaxPlayers uint
OnlinePlayers uint
PlayerList []string
}
func (*PingSucceeded) Fields ¶
func (p *PingSucceeded) Fields() log.Fields
func (PingSucceeded) IsSuccess ¶
func (PingSucceeded) IsSuccess() bool
func (*PingSucceeded) String ¶
func (p *PingSucceeded) String() string
type Pinger ¶
type Pinger struct {
*ServerConfig
*events.Dispatcher
// contains filtered or unexported fields
}
func NewPinger ¶
func NewPinger(config *ServerConfig, statuser Statuser, dispatcher *events.Dispatcher) *Pinger
type PingerEvent ¶
type PingerEvent interface {
IsSuccess() bool
}
type ServerConfig ¶
type ServerConfig struct {
BaseDir string `json:"-"`
WorkingDir string `json:"working_dir,omitempty"`
Jar string `json:"jar,omitempty"`
Properties string `json:"properties,omitempty"`
Log4JConf string `json:"log4jxml,omitempty"`
Options []string `json:"options"`
Network *NetworkConfig `json:"network"`
}
func (ServerConfig) AbsLog4JConf ¶
func (c ServerConfig) AbsLog4JConf() string
func (ServerConfig) AbsServerProperties ¶
func (c ServerConfig) AbsServerProperties() string
func (ServerConfig) AbsWorkingDir ¶
func (c ServerConfig) AbsWorkingDir() string
func (ServerConfig) Command ¶
func (c ServerConfig) Command() []string
type ServerOutput ¶
type ServerOutput string
Click to show internal directories.
Click to hide internal directories.