Documentation
¶
Index ¶
- func CheckIfServerCorrect(server *Server) error
- func CheckServerPorts(server *Server) error
- func CopyAndMakeOld(path string) error
- func GetProcessPid(processPath string) (uint32, error)
- func IsProcessRunningWithPath(processPath string) (bool, error)
- func KillProcessUsingPid(pid uint32) error
- type Server
- func (s *Server) CheckAsaAPI() error
- func (s *Server) CreateArguments() []string
- func (s *Server) CreateServerCmd() *exec.Cmd
- func (s *Server) ForceStop() error
- func (s *Server) GetServerPlayerCount() (int, error)
- func (s *Server) Init()
- func (s *Server) IsServerRunning() bool
- func (s *Server) SaveWorld() error
- func (s *Server) Start() error
- func (s *Server) Stop() error
- func (s *Server) UpdateConfig() error
- type ServerController
- func (c *ServerController) CheckServerInstalled(id int) (bool, error)
- func (c *ServerController) CreateServer(saveToConfig bool) (Server, error)
- func (c *ServerController) DeleteProfile(id int) error
- func (c *ServerController) DeleteServerFiles(id int) error
- func (c *ServerController) ForceStopServer(id int) error
- func (c *ServerController) GetAllServers() (map[int]Server, error)
- func (c *ServerController) GetAllServersFromDir() (map[int]*Server, error)
- func (c *ServerController) GetConnectedPlayerCount(id int) (int, error)
- func (c *ServerController) GetGusAsMap(id int) (map[string]map[string][]string, error)
- func (c *ServerController) GetNetworkInterfacesIp() map[string]string
- func (c *ServerController) GetServer(id int) (Server, error)
- func (c *ServerController) GetServerConfigFile(id int) (string, error)
- func (c *ServerController) GetServerDir() string
- func (c *ServerController) GetServerStartupCommand(id int) (string, error)
- func (c *ServerController) GetServerStatus(id int) (bool, error)
- func (c *ServerController) GetValueFromGame(id int, sectionName string, keyName string) (string, error)
- func (c *ServerController) GetValueFromGus(id int, sectionName string, keyName string) (string, error)
- func (c *ServerController) InitAllServers()
- func (c *ServerController) SaveGusFromMap(id int, gusMap map[string]map[string][]string) error
- func (c *ServerController) SaveServer(server Server) error
- func (c *ServerController) SaveServerConfigFile(content string, id int) error
- func (c *ServerController) Shutdown()
- func (c *ServerController) StartServer(id int) error
- func (c *ServerController) StartServersWithApplication()
- func (c *ServerController) Startup(ctx context.Context)
- func (c *ServerController) StopServer(id int) error
- func (c *ServerController) UpdateValueInGame(id int, sectionName string, keyName string, value string) error
- func (c *ServerController) UpdateValueInGus(id int, sectionName string, keyName string, value string) error
- type Win32_Process
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckIfServerCorrect ¶
func CheckServerPorts ¶
CheckServerPorts validates the port numbers within a Server struct. It ensures that all port numbers are within the valid range (greater than 0 and less than or equal to 65535) and that there are no duplicate port numbers.
func CopyAndMakeOld ¶ added in v0.1.0
func GetProcessPid ¶ added in v0.1.1
func IsProcessRunningWithPath ¶ added in v0.1.1
func KillProcessUsingPid ¶ added in v0.1.1
Types ¶
type Server ¶
type Server struct { Command *exec.Cmd `json:"-"` DisableUpdateOnStart bool `json:"disableUpdateOnStart"` RestartOnServerQuit bool `json:"restartOnServerQuit"` UseIniConfig bool `json:"useIniConfig"` DiscordWebHook string `json:"discordWebHook"` DiscordWebHookEnabled bool `json:"discordWebHookEnabled"` UseAsaAPI bool `json:"useAsaAPI"` ExtraDashArgs string `json:"extraDashArgs"` ExtraQuestionmarkArguments string `json:"extraQuestionmarkArguments"` KickIdlePlayers bool `json:"kickIdlePlayers"` Mods string `json:"mods"` // Id is the id of the server Id int `json:"id"` // ServerAlias is the name of the config (an alias for the server) ServerAlias string `json:"serverAlias"` // ServerPath is the path where the server is installed/should be. ServerPath string `json:"serverPath"` //Server Name and Passwords ServerName string `json:"serverName"` ServerPassword string `json:"serverPassword"` AdminPassword string `json:"adminPassword"` SpectatorPassword string `json:"spectatorPassword"` //Server Networking IpAddress string `json:"ipAddress"` ServerPort int `json:"serverPort"` PeerPort int `json:"peerPort"` //TODO: find out if used QueryPort int `json:"queryPort"` RCONPort int `json:"rconPort"` ServerMap string `json:"serverMap"` MaxPlayers int `json:"maxPlayers"` StartWithApplication bool `json:"startWithApplication"` // contains filtered or unexported fields }
func (*Server) CheckAsaAPI ¶ added in v0.1.2
func (*Server) CreateArguments ¶
returns questionamrk arguments for the server and dash arguments for the server
func (*Server) CreateServerCmd ¶ added in v0.0.6
CreateServerCmd returns the command to start the server
func (*Server) GetServerPlayerCount ¶ added in v0.1.0
func (*Server) Init ¶ added in v0.2.0
func (s *Server) Init()
Init runs the code that needs to be run when the server is created/loaded like watching the config files
func (*Server) IsServerRunning ¶
GetServerStatus returns the status of the server.
func (*Server) UpdateConfig ¶
UpdateConfig updates the configuration files for the server e.g.: GameUserSettings.ini
type ServerController ¶
ServerController struct
func NewServerController ¶
func NewServerController(hc *helpers.HelpersController) *ServerController
NewServerController creates a new ServerController application struct
func (*ServerController) CheckServerInstalled ¶
func (c *ServerController) CheckServerInstalled(id int) (bool, error)
CheckServerInstalled Checks if the server dir exists.
func (*ServerController) CreateServer ¶
func (c *ServerController) CreateServer(saveToConfig bool) (Server, error)
CreateServer Creates a new server, returns it and adds it to the map. If it fails it returns an error which is catch-able in the Frontend.
func (*ServerController) DeleteProfile ¶ added in v0.0.3
func (c *ServerController) DeleteProfile(id int) error
DeleteProfile deletes the profile with the given id. If it fails it returns an error which is catch-able
func (*ServerController) DeleteServerFiles ¶ added in v0.0.3
func (c *ServerController) DeleteServerFiles(id int) error
DeleteServerFiles deletes the server files from the server with the given id. If it fails it returns an error which is catch-able
func (*ServerController) ForceStopServer ¶
func (c *ServerController) ForceStopServer(id int) error
func (*ServerController) GetAllServers ¶
func (c *ServerController) GetAllServers() (map[int]Server, error)
GetAllServers gets all servers and saves them to ServerController.Servers and also returns them, if it fails it returns nil and error. If they already exist in the map it will just get that.
func (*ServerController) GetAllServersFromDir ¶
func (c *ServerController) GetAllServersFromDir() (map[int]*Server, error)
GetAllServersFromDir gets all servers from dir and saves them to ServerController.Servers and also returns them, if it fails it returns nil and an error which is catch-able in the frontend. This will overwrite c.Servers!
func (*ServerController) GetConnectedPlayerCount ¶ added in v0.1.0
func (c *ServerController) GetConnectedPlayerCount(id int) (int, error)
GetConnectedPlayerCount returns the number of connected players
func (*ServerController) GetGusAsMap ¶ added in v0.2.0
func (*ServerController) GetNetworkInterfacesIp ¶
func (c *ServerController) GetNetworkInterfacesIp() map[string]string
func (*ServerController) GetServer ¶
func (c *ServerController) GetServer(id int) (Server, error)
GetServer returns the server with the given id if it does not exist it returns an empty server. This function checks the server dir too. If it does not exist in the map, and it does in the dir then it will add it to the map. It can error which is catch-able in the frontend
func (*ServerController) GetServerConfigFile ¶ added in v0.1.2
func (c *ServerController) GetServerConfigFile(id int) (string, error)
func (*ServerController) GetServerDir ¶
func (c *ServerController) GetServerDir() string
GetServerDir returns the server directory
func (*ServerController) GetServerStartupCommand ¶ added in v0.0.6
func (c *ServerController) GetServerStartupCommand(id int) (string, error)
func (*ServerController) GetServerStatus ¶
func (c *ServerController) GetServerStatus(id int) (bool, error)
func (*ServerController) GetValueFromGame ¶ added in v0.2.0
func (c *ServerController) GetValueFromGame(id int, sectionName string, keyName string) (string, error)
GetValueFromGame returns the value from the game with the given section and key name. If it fails it returns an error which is catch-able
func (*ServerController) GetValueFromGus ¶ added in v0.2.0
func (c *ServerController) GetValueFromGus(id int, sectionName string, keyName string) (string, error)
GetValueFromGus returns the value from the gus with the given section and key name. If it fails it returns an error which is catch-able
func (*ServerController) InitAllServers ¶ added in v0.2.0
func (c *ServerController) InitAllServers()
func (*ServerController) SaveGusFromMap ¶ added in v0.2.0
func (*ServerController) SaveServer ¶
func (c *ServerController) SaveServer(server Server) error
SaveServer saves the server with the given id, and returns bool if successful
func (*ServerController) SaveServerConfigFile ¶ added in v0.1.2
func (c *ServerController) SaveServerConfigFile(content string, id int) error
func (*ServerController) Shutdown ¶ added in v0.2.0
func (c *ServerController) Shutdown()
func (*ServerController) StartServer ¶
func (c *ServerController) StartServer(id int) error
StartServer starts the server. It will only start a server that exists in the map
func (*ServerController) StartServersWithApplication ¶ added in v0.1.0
func (c *ServerController) StartServersWithApplication()
region Backend Functions
func (*ServerController) Startup ¶
func (c *ServerController) Startup(ctx context.Context)
Startup is called when the app starts. The context is saved, so we can call the runtime methods
func (*ServerController) StopServer ¶ added in v0.1.0
func (c *ServerController) StopServer(id int) error