Documentation ¶
Index ¶
- Variables
- func AuthorizeMiddleware() gin.HandlerFunc
- func Hostname(flagValue string)
- func LoadServers() error
- func NextAvailablePort() int
- func ServersWebView(playerName string) map[string]WebView
- func ServersWithPlayer(playerName string) map[string]Server
- type Op
- type Permission
- type Permissions
- type Properties
- type Server
- func (s *Server) AddOpOffline(opName, uuid string, force bool) error
- func (s *Server) AddOpOnline(opName string) error
- func (s *Server) AddWhitelistOffline(playerName, uuid string, force bool) error
- func (s *Server) AddWhitelistOnline(playerName string) error
- func (s *Server) Backup(message string) error
- func (s *Server) Day() error
- func (s *Server) Delete() error
- func (s *Server) DownloadJar() error
- func (s *Server) IsOp(player string) bool
- func (s *Server) IsOwner(player string) bool
- func (s *Server) IsRunning() bool
- func (s *Server) LoadOps() ([]Op, error)
- func (s *Server) LoadWhitelist() ([]WLPlayer, error)
- func (s *Server) Ops() []Op
- func (s *Server) PlayerIsOp(playerName string) bool
- func (s *Server) PlayerIsWhitelisted(playerName string) bool
- func (s *Server) PlayerPerms(playerName string) Permissions
- func (s *Server) Players() []string
- func (s *Server) RefreshProperties() error
- func (s *Server) Regen() error
- func (s *Server) Save() error
- func (s *Server) SaveManagedJSON() error
- func (s *Server) SaveOps(ops []Op) error
- func (s *Server) SaveProps() error
- func (s *Server) SaveWhitelist(wlps []WLPlayer) error
- func (s *Server) ServerDir() string
- func (s Server) Start() error
- func (s *Server) Stop(delay int) error
- func (s *Server) Upgrade() error
- func (s *Server) WeatherClear() error
- func (s *Server) WebView(playerName string) WebView
- func (s *Server) Whitelist() string
- func (s *Server) WhitelistEnabled() bool
- type WLPlayer
- type WebView
Constants ¶
This section is empty.
Variables ¶
var ( Java8 string Java16 string )
Java version commands
var DEFAULTSERVERPROPERTIES = `` /* 1004-byte string literal not displayed */
DEFAULTSERVERPROPERTIES is the default server properties file
var HOSTNAME = "localhost"
HOSTNAME is where we store the flag value
var Servers = make(map[string]Server)
Servers is the global list of managed servers
Functions ¶
func AuthorizeMiddleware ¶
func AuthorizeMiddleware() gin.HandlerFunc
AuthorizeMiddleware middleware
func Hostname ¶
func Hostname(flagValue string)
Hostname takes the flag value and calculates the best attempt at a hostname
func NextAvailablePort ¶
func NextAvailablePort() int
NextAvailablePort will return the next available server port one should loadServers() before this to ensure accurate data
func ServersWebView ¶
ServersWebView is a web view of a list of servers
func ServersWithPlayer ¶
ServersWithPlayer returns a list of servers the Op owns or is an op on
Types ¶
type Op ¶
type Op struct { UUID string `json:"uuid"` Name string `json:"name"` Level int8 `json:"level"` BypassPlayerLimit bool `json:"bypassesPlayerLimit"` }
Op is the structure of an op within the ops.json file
type Permission ¶
type Permissions ¶
type Permissions map[string]Permission
func PermissionsOp ¶
func PermissionsOp() Permissions
func PermissionsOwner ¶
func PermissionsOwner() Permissions
func PermissionsPlayer ¶
func PermissionsPlayer() Permissions
type Properties ¶
Properties is a hash of key:value pairs contained in the server.properties file
type Server ¶
type Server struct { AutoStart bool `json:"autostart"` Deleted bool `json:"deleted"` Flavor string `json:"flavor"` MaxMem string `json:"maxmem"` MinMem string `json:"minmem"` Name string `json:"name"` Owner string `json:"owner"` Props Properties `json:"properties"` Release string `json:"release"` UUID string `json:"uuid"` }
Server is an instance of a server, tracked during runtime
func LoadServer ¶
LoadServer creates a new instance of Server from an existing serverdir
func (*Server) AddOpOffline ¶
AddOpOffline will add a user as an op the force option is to ignore errors from loading the ops.json file like happens when one doesn't exist.
func (*Server) AddOpOnline ¶
AddOpOnline will add a user as an op using rcon
func (*Server) AddWhitelistOffline ¶
AddWhitelistOffline will instruct the server to whitelist a player
func (*Server) AddWhitelistOnline ¶
AddWhitelistOnline will instruct the server to whitelist a player
func (*Server) DownloadJar ¶
DownloadJar downloads the server jar
func (*Server) IsRunning ¶
IsRunning attempts to determine if the server is running by checking rcon connect
func (*Server) LoadWhitelist ¶
LoadWhitelist will read in the contents of the server's ops.json file
func (*Server) Ops ¶
Ops will return a list of ops contained in the server's ops.json file (a zero-error equivalent of LoadOps)
func (*Server) PlayerIsOp ¶
PlayerIsOp checks if the given player name is in the lits of ops
func (*Server) PlayerIsWhitelisted ¶
PlayerIsWhitelisted checks if the given player name is in the lits of ops
func (*Server) PlayerPerms ¶
func (s *Server) PlayerPerms(playerName string) Permissions
PlayerPerms returns the server permissions of the given player name
func (*Server) RefreshProperties ¶
RefreshProperties reads in the server.properties values
func (*Server) SaveManagedJSON ¶
SaveManagedJSON writes the server config to disk
func (*Server) SaveOps ¶
SaveOps will save the provided ops to the server's ops.json (overwrites the contents)
func (*Server) SaveWhitelist ¶
SaveWhitelist will save the provided ops to the server's ops.json (overwrites the contents)
func (*Server) WeatherClear ¶
WeatherClear will instruct the server to perform a save-all operation
func (*Server) WhitelistEnabled ¶
WhitelistEnabled will instruct the server to whitelist a player
type WebView ¶
type WebView struct { AutoStart bool `json:"autostart"` Flavor string `json:"flavor"` GameMode string `json:"gamemode"` Hardcore string `json:"hardcore"` MOTD string `json:"motd"` Name string `json:"name"` Ops string `json:"ops"` Owner string `json:"owner"` Permissions Permissions `json:"perms"` Players []string `json:"players"` Port string `json:"port"` PVP string `json:"pvp"` Release string `json:"release"` Running bool `json:"running"` Seed string `json:"seed"` UUID string `json:"uuid"` WhiteList string `json:"whitelist"` WhiteListEnabled bool `json:"whitelistenabled"` WorldType string `json:"worldtype"` }
WebView web view of a server instance