pufferpanel

package module
v3.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

README

PufferPanel Release Downloads Build

PufferPanel logo

Website | Discord | Documentation | Translations

What is PufferPanel?

PufferPanel is a web-based Game Server Management System. PufferPanel allows you to manage multiple different game servers all from one central location. You can give other users their own servers or allow them to access to your servers.

Installation

Please follow the installation guide for PufferPanel located here.

What's different about PufferPanel?

In addition to being a free and open source project, PufferPanel provides an easy-to-use interface for everyone from individual users to large networks. We strive to create a friendly community, and we would love for you to join us.

Having issues or want to help?

If you need help with PufferPanel, or you'd like to help out, you can contact us on Discord. Check out our Documentation for guides on how to install, update, and manage PufferPanel.

Some Javascript and CSS used within the panel is licensed under a MIT, Apache 2.0, or GPL license. Please check their header files for information.

Some images used within PufferPanel are Copyright (c) their respective owners.

Water Provided By

Development tools provided by JetBrains

Repositories hosted by packagecloud

Documentation

Index

Constants

View Source
const MaxRecursivePath = 256

Variables

View Source
var (
	ScopeAdmin       = registerNonServerScope("admin")
	ScopeLogin       = registerNonServerScope("login")        //can you log in
	ScopeOAuth2Auth  = registerNonServerScope("oauth2.auth")  //can you validate user credentials over OAuth2
	ScopeNodesView   = registerNonServerScope("nodes.view")   //can you globally view nodes
	ScopeNodesCreate = registerNonServerScope("nodes.create") //can you create nodes
	ScopeNodesEdit   = registerNonServerScope("nodes.edit")   //can you edit an existing node
	ScopeNodesDelete = registerNonServerScope("nodes.delete") //can you delete a node
	ScopeNodesDeploy = registerNonServerScope("nodes.deploy") //can you deploy the node (this has secret info, which is why it's special)
	ScopeSelfEdit    = registerNonServerScope("self.edit")    //can you manage your own account
	ScopeSelfClients = registerNonServerScope("self.clients") //can the user create and manage OAuth2 clients for their own account

	ScopeServerCreate         = registerNonServerScope("server.create")
	ScopeServerView           = registerServerScope("server.view")
	ScopeServerAdmin          = registerServerScope("server.admin")
	ScopeServerDelete         = registerServerScope("server.delete")
	ScopeServerEditDefinition = registerServerScope("server.definition.edit")
	ScopeServerEditData       = registerServerScope("server.data.edit")
	ScopeServerEditFlags      = registerServerScope("server.flags.edit")
	ScopeServerEditName       = registerServerScope("server.name.edit")
	ScopeServerViewDefinition = registerServerScope("server.definition.view")
	ScopeServerViewData       = registerServerScope("server.data.view")
	ScopeServerViewFlags      = registerServerScope("server.flags.view")

	ScopeServerClientView   = registerServerScope("server.clients.view")
	ScopeServerClientEdit   = registerServerScope("server.clients.edit")
	ScopeServerClientCreate = registerServerScope("server.clients.create")
	ScopeServerClientDelete = registerServerScope("server.clients.delete")
	ScopeServerUserView     = registerServerScope("server.users.view")
	ScopeServerUserCreate   = registerServerScope("server.users.create")
	ScopeServerUserEdit     = registerServerScope("server.users.edit")
	ScopeServerUserDelete   = registerServerScope("server.users.delete")
	ScopeServerTaskView     = registerServerScope("server.tasks.view")
	ScopeServerTaskRun      = registerServerScope("server.tasks.run")
	ScopeServerTaskCreate   = registerServerScope("server.tasks.create")
	ScopeServerTaskDelete   = registerServerScope("server.tasks.delete")
	ScopeServerTaskEdit     = registerServerScope("server.tasks.edit")
	ScopeServerReload       = registerServerScope("server.reload")
	ScopeServerStart        = registerServerScope("server.start")
	ScopeServerStop         = registerServerScope("server.stop")
	ScopeServerKill         = registerServerScope("server.kill")
	ScopeServerInstall      = registerServerScope("server.install")
	ScopeServerFileView     = registerServerScope("server.files.view")
	ScopeServerFileEdit     = registerServerScope("server.files.edit")
	ScopeServerSftp         = registerServerScope("server.sftp")
	ScopeServerConsole      = registerServerScope("server.console")
	ScopeServerSendCommand  = registerServerScope("server.console.send")
	ScopeServerStats        = registerServerScope("server.stats")
	ScopeServerStatus       = registerServerScope("server.status")

	ScopeSettingsEdit = registerNonServerScope("settings.edit")

	ScopeTemplatesView       = registerNonServerScope("templates.view")
	ScopeTemplatesLocalEdit  = registerNonServerScope("templates.local.edit")
	ScopeTemplatesRepoCreate = registerNonServerScope("templates.repo.create")
	ScopeTemplatesRepoDelete = registerNonServerScope("templates.repo.delete")

	ScopeUserInfoSearch = registerNonServerScope("users.info.search")
	ScopeUserInfoView   = registerNonServerScope("users.info.view")
	ScopeUserInfoEdit   = registerNonServerScope("users.info.edit")
	ScopeUserPermsView  = registerNonServerScope("users.perms.view")
	ScopeUserPermsEdit  = registerNonServerScope("users.perms.edit")

	ScopePanel = registerNonServerScope("panel")
)
View Source
var (
	Hash    = "unknown"
	Version = "nightly"
	Display string
)
View Source
var Engine *gin.Engine
View Source
var ErrCannotValidateToken = CreateError("could not validate access token", "ErrCannotValidateToken")
View Source
var ErrClientNotFound = CreateError("client not found", "ErrClientNotFound")
View Source
var ErrContainerRunning = CreateError("container already running", "ErrContainerRunning")
View Source
var ErrDatabaseNotAvailable = CreateError("database not available", "ErrDatabaseNotAvailable")
View Source
var ErrDockerNotSupported = CreateError("docker not supported", "ErrDockerNotSupported")
View Source
var ErrEmailNotConfigured = CreateError("email not configured", "ErrEmailNotConfigured")
View Source
var ErrEnvironmentNotSupported = CreateError("environment not supported", "ErrEnvironmentNotSupported")
View Source
var ErrFactoryError = func(operatorName string, err error) *Error {
	return CreateError("factory `${operatorName}` encountered an error: `${err}`", "ErrFactoryError").Metadata(map[string]interface{}{"operatorName": operatorName, "err": err.Error()})
}
View Source
var ErrFieldEqual = func(fieldName1, fieldName2 string) *Error {
	return CreateError("${field1} cannot be equal to ${field2}", "ErrFieldEqual").Metadata(map[string]interface{}{"field1": fieldName1, "field2": fieldName2})
}
View Source
var ErrFieldHasURICharacters = func(fieldName string) *Error {
	return CreateError("${field} must not contain characters which cannot be used in URIs", "ErrFieldHasURICharacters").Metadata(map[string]interface{}{"field": fieldName})
}
View Source
var ErrFieldIsInvalidHost = func(fieldName string) *Error {
	return CreateError("${field} must be a valid IP or FQDN", "ErrFieldIsInvalidHost").Metadata(map[string]interface{}{"field": fieldName})
}
View Source
var ErrFieldIsInvalidIP = func(fieldName string) *Error {
	return CreateError("${field} must be a valid IP", "ErrFieldIsInvalidIP").Metadata(map[string]interface{}{"field": fieldName})
}
View Source
var ErrFieldLength = func(fieldName string, min int, max int) *Error {
	return CreateError("${field} must be between ${min} and ${max} characters", "ErrFieldLength").Metadata(map[string]interface{}{"field": fieldName, "min": min, "max": max})
}
View Source
var ErrFieldMustBePrintable = func(fieldName string) *Error {
	return CreateError("${field} must be printable ascii characters", "ErrFieldMustBePrintable").Metadata(map[string]interface{}{"field": fieldName})
}
View Source
var ErrFieldNotBetween = func(fieldName string, min, max int64) *Error {
	return CreateError("${field} must be between ${min} and ${max}", "ErrFieldNotBetween").Metadata(map[string]interface{}{"field": fieldName, "min": min, "max": max})
}
View Source
var ErrFieldNotEmail = func(fieldName string) *Error {
	return CreateError("${field} is not a valid email", "ErrFieldNotEmail").Metadata(map[string]interface{}{"field": fieldName})
}
View Source
var ErrFieldNotEqual = func(fieldName1, fieldName2 string) *Error {
	return CreateError("${field1} is not equal to ${field2}", "ErrFieldNotEqual").Metadata(map[string]interface{}{"field1": fieldName1, "field2": fieldName2})
}
View Source
var ErrFieldRequired = func(fieldName string) *Error {
	return CreateError("${field} is required", "ErrFieldRequired").Metadata(map[string]interface{}{"field": fieldName})
}
View Source
var ErrFieldTooLarge = func(fieldName string, value int64) *Error {
	return CreateError("${field} cannot be larger than ${max}", "ErrFieldTooLarge").Metadata(map[string]interface{}{"field": fieldName, "max": value})
}
View Source
var ErrFieldTooSmall = func(fieldName string, value int64) *Error {
	return CreateError("${field} cannot be smaller than ${min}", "ErrFieldTooSmall").Metadata(map[string]interface{}{"field": fieldName, "min": value})
}
View Source
var ErrFileExists = CreateError("file exists where there should be none", "ErrFileExists")
View Source
var ErrFileNotFound = CreateError("file not found", "ErrFileNotFound")
View Source
var ErrIllegalFileAccess = CreateError("invalid file access", "ErrIllegalFileAccess")
View Source
var ErrImageDownloading = CreateError("image downloading", "ErrImageDownloading")
View Source
var ErrInvalidCredentials = CreateError("invalid credentials", "ErrInvalidCredentials")
View Source
var ErrInvalidSession = CreateError("invalid session", "ErrInvalidSession")
View Source
var ErrInvalidTokenState = CreateError("invalid token state", "ErrInvalidTokenState")
View Source
var ErrInvalidUnixTime = CreateError("time provided is not a valid UNIX time", "ErrInvalidUnixTime")
View Source
var ErrKeyNotECDSA = CreateError("key is not ECDSA key", "ErrKeyNotECDSA")
View Source
var ErrKeyNotPEM = CreateError("key is not in PEM format", "ErrKeyNotPEM")
View Source
var ErrLoginNotPermitted = CreateError("login not permitted", "ErrLoginNotPermitted")
View Source
var ErrMissingAccessToken = CreateError("access token not provided", "ErrMissingAccessToken")
View Source
var ErrMissingBinary = func(expected string) *Error {
	return CreateError("missing binary: ${expected}", "ErrMissingBinary").Metadata(map[string]interface{}{"expected": expected})
}
View Source
var ErrMissingFactory = CreateError("missing factory", "ErrMissingFactory")
View Source
var ErrMissingScope = CreateError("missing scope", "ErrMissingScope")
View Source
var ErrNoCommand = CreateError("command could not be determined", "ErrNoCommand")
View Source
var ErrNoPermission = CreateError("no permission to perform action", "ErrNoPermission")
View Source
var ErrNoTemplate = func(template string) *Error {
	return CreateError("no template with name ${name}", "ErrNoTemplate").Metadata(map[string]interface{}{"template": template})
}
View Source
var ErrNodeHasServers = CreateError("node has servers associated", "ErrNodeHasServers")
View Source
var ErrNodeInvalid = CreateError("node is invalid", "ErrNodeInvalid")
View Source
var ErrNotBearerToken = CreateError("access token must be a Bearer token", "ErrNotBearerToken")
View Source
var ErrNotImplemented = CreateError("not implemented", "ErrNotImplemented")
View Source
var ErrPathNotAbs = func(path string) *Error {
	return CreateError("path not abs: ${path}", "ErrPathNotAbs").Metadata(map[string]interface{}{"path": path})
}
View Source
var ErrProcessRunning = CreateError("process already running", "ErrProcessRunning")
View Source
var ErrRepoExists = CreateError("repo already exists with given name", "ErrRepoExists")
View Source
var ErrServerAlreadyExists = CreateError("server already exists", "ErrServerAlreadyExists")
View Source
var ErrServerDisabled = CreateError("server is disabled", "ErrServerDisabled")
View Source
var ErrServerNotFound = CreateError("server not found", "ErrServerNotFound")
View Source
var ErrServerOffline = CreateError("server offline", "ErrServerOffline")
View Source
var ErrServerRunning = CreateError("server running", "ErrServerRunning")
View Source
var ErrServiceInvalidProvider = func(service, provider string) *Error {
	return CreateError("{service} does not support ${provider}", "ErrServiceInvalidProvider").Metadata(map[string]interface{}{"service": service, "provider": provider})
}
View Source
var ErrServiceNotAvailable = CreateError("service not available", "ErrServiceNotAvailable")
View Source
var ErrSessionExpired = CreateError("session expired", "ErrSessionExpired")
View Source
var ErrSettingNotConfigured = func(name string) *Error {
	return CreateError("${setting} is not configured", "ErrSettingNotConfigured").Metadata(map[string]interface{}{"setting": name})
}
View Source
var ErrTaskNotFound = CreateError("task not found", "ErrTaskNotFound")
View Source
var ErrTokenInvalid = CreateError("token is invalid", "ErrTokenInvalid")
View Source
var ErrUnknownError = CreateError("unknown error", "ErrUnknownError")
View Source
var ErrUnsupportedArch = func(actual, expected string) *Error {
	return CreateError("Architecture ${actual} not supported. Supported Architectures: ${expected}", "ErrUnsupportedArch").Metadata(map[string]interface{}{"actual": actual, "expected": expected})
}
View Source
var ErrUnsupportedOS = func(actual, expected string) *Error {
	return CreateError("OS (${actual}) not supported. Supported OS: ${expected}", "ErrUnsupportedOS").Metadata(map[string]interface{}{"actual": actual, "expected": expected})
}
View Source
var ErrUserNotFound = CreateError("user not found", "ErrUserNotFound")

Functions

func Close

func Close(closer io.Closer)

func CloseResponse

func CloseResponse(response *http.Response)

func ContainsScope

func ContainsScope(arr []*Scope, value *Scope) bool

func Convert

func Convert(val interface{}, target interface{}) (interface{}, error)

Convert Converts the val parameter to the same type as the target

func CopyFile

func CopyFile(src, dest string) error

func DetermineKernelSupport

func DetermineKernelSupport()

func DownloadFile

func DownloadFile(url, fileName string, env Environment) error

func DownloadFileToCache

func DownloadFileToCache(url, fileName string) error

func DownloadViaMaven

func DownloadViaMaven(downloadUrl string, env Environment) (string, error)

func EnsureAccess

func EnsureAccess(source string, prefix string) bool

func ExtractFileFromZip

func ExtractFileFromZip(name, directory, targetFile string) error

func ExtractTar

func ExtractTar(stream io.Reader, directory string) error

func ExtractTarGz

func ExtractTarGz(gzipStream io.Reader, directory string) error

func ExtractZip

func ExtractZip(name, directory string) error

func ExtractZipIgnoreSingleDir

func ExtractZipIgnoreSingleDir(name, directory string) error

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

func GenerateValidationMessage

func GenerateValidationMessage(err error) error

func GetBooleanOrDefault

func GetBooleanOrDefault(data map[string]interface{}, key string, def bool) bool

func GetMapOrNull

func GetMapOrNull(data map[string]interface{}, key string) map[string]interface{}

func GetObjectArrayOrNull

func GetObjectArrayOrNull(data map[string]interface{}, key string) []interface{}

func GetStringArrayOrNull

func GetStringArrayOrNull(data map[string]interface{}, key string) []string

func GetStringOrDefault

func GetStringOrDefault(data map[string]interface{}, key string, def string) string

func Http

func Http() *http.Client

func HttpGet

func HttpGet(url string) (*http.Response, error)

func HttpGetTarGz

func HttpGetTarGz(url, directory string) error

func HttpGetZip

func HttpGetZip(url, directory string) error

func JoinPath

func JoinPath(paths ...string) string

func Recover

func Recover()

func ReplaceTokens

func ReplaceTokens(msg string, mapping map[string]interface{}) string

func ReplaceTokensInArr

func ReplaceTokensInArr(msg []string, mapping map[string]interface{}) []string

func ReplaceTokensInMap

func ReplaceTokensInMap(msg map[string]string, mapping map[string]interface{}) map[string]string

func SplitArguments

func SplitArguments(source string) (cmd string, arguments []string)

func ToString

func ToString(v interface{}) string

func Union

func Union[T comparable](a, b []T) []T

func UnmarshalTo

func UnmarshalTo(source, target interface{}) error

func UseOpenat2

func UseOpenat2() bool

func UserInGroup

func UserInGroup(groups ...string) bool

Types

type BaseEnvironment

type BaseEnvironment struct {
	Environment
	Type              string               `json:"type"`
	RootDirectory     string               `json:"root,omitempty"`
	ConsoleBuffer     *MemoryCache         `json:"-"`
	Wait              *sync.WaitGroup      `json:"-"`
	ExecutionFunction ExecutionFunction    `json:"-"`
	ServerId          string               `json:"-"`
	LastExitCode      int                  `json:"-"`
	Wrapper           io.Writer            `json:"-"` //our proxy back to the main
	ConsoleTracker    *Tracker             `json:"-"`
	StatusTracker     *Tracker             `json:"-"`
	StatsTracker      *Tracker             `json:"-"`
	Installing        bool                 `json:"-"`
	IsRunningFunc     func() (bool, error) `json:"-"`
	KillFunc          func() error         `json:"-"`
	Console           Console              `json:"-"`
}

func (*BaseEnvironment) AddConsoleListener

func (e *BaseEnvironment) AddConsoleListener(ws *Socket)

func (*BaseEnvironment) AddStatsListener

func (e *BaseEnvironment) AddStatsListener(ws *Socket)

func (*BaseEnvironment) AddStatusListener

func (e *BaseEnvironment) AddStatusListener(ws *Socket)

func (*BaseEnvironment) Create

func (e *BaseEnvironment) Create() error

func (*BaseEnvironment) CreateConsoleStdinProxy

func (e *BaseEnvironment) CreateConsoleStdinProxy(config StdinConsoleConfiguration, base io.WriteCloser)

func (*BaseEnvironment) CreateWrapper

func (e *BaseEnvironment) CreateWrapper() io.Writer

func (*BaseEnvironment) Delete

func (e *BaseEnvironment) Delete() (err error)

func (*BaseEnvironment) DisplayToConsole

func (e *BaseEnvironment) DisplayToConsole(daemon bool, msg string, data ...interface{})

func (*BaseEnvironment) Execute

func (e *BaseEnvironment) Execute(steps ExecutionData) error

func (*BaseEnvironment) ExecuteAsync

func (e *BaseEnvironment) ExecuteAsync(steps ExecutionData) (err error)

func (*BaseEnvironment) ExecuteInMainProcess

func (e *BaseEnvironment) ExecuteInMainProcess(cmd string) (err error)

func (*BaseEnvironment) GetBase

func (e *BaseEnvironment) GetBase() *BaseEnvironment

func (*BaseEnvironment) GetConsole

func (e *BaseEnvironment) GetConsole() (console []byte, epoch int64)

func (*BaseEnvironment) GetConsoleFrom

func (e *BaseEnvironment) GetConsoleFrom(time int64) (console []byte, epoch int64)

func (*BaseEnvironment) GetLastExitCode

func (e *BaseEnvironment) GetLastExitCode() int

func (*BaseEnvironment) GetRootDirectory

func (e *BaseEnvironment) GetRootDirectory() string

func (*BaseEnvironment) GetStatsTracker

func (e *BaseEnvironment) GetStatsTracker() *Tracker

func (*BaseEnvironment) GetWrapper

func (e *BaseEnvironment) GetWrapper() io.Writer

func (*BaseEnvironment) IsInstalling

func (e *BaseEnvironment) IsInstalling() bool

func (*BaseEnvironment) IsRunning

func (e *BaseEnvironment) IsRunning() (isRunning bool, err error)

func (*BaseEnvironment) Kill

func (e *BaseEnvironment) Kill() error

func (*BaseEnvironment) Log

func (e *BaseEnvironment) Log(l *log.Logger, format string, obj ...interface{})

func (*BaseEnvironment) SetInstalling

func (e *BaseEnvironment) SetInstalling(flag bool)

func (*BaseEnvironment) Update

func (e *BaseEnvironment) Update() error

func (*BaseEnvironment) WaitForMainProcess

func (e *BaseEnvironment) WaitForMainProcess() error

func (*BaseEnvironment) WaitForMainProcessFor

func (e *BaseEnvironment) WaitForMainProcessFor(timeout time.Duration) (err error)

type Command

type Command struct {
	If      string                    `json:"if,omitempty"`
	Command string                    `json:"command"`
	StdIn   StdinConsoleConfiguration `json:"stdin"`

} //@name Command

type ConditionalMetadataType

type ConditionalMetadataType struct {
	If string `json:"if,omitempty"`
	MetadataType

} //@name MetadataWithIf

func (*ConditionalMetadataType) MarshalJSON

func (t *ConditionalMetadataType) MarshalJSON() ([]byte, error)

func (*ConditionalMetadataType) ParseMetadata

func (t *ConditionalMetadataType) ParseMetadata(target interface{}) error

ParseMetadata Parses the metadata into the target interface

func (*ConditionalMetadataType) UnmarshalJSON

func (t *ConditionalMetadataType) UnmarshalJSON(bs []byte) error

UnmarshalJSON parses a type with this declaration, storing what it needs into metadata and type

type Console

type Console interface {
	io.WriteCloser
	Start()
}

type CreateOperation

type CreateOperation struct {
	OperationArgs        map[string]interface{}
	EnvironmentVariables map[string]string
	DataMap              map[string]interface{}
}

type DaemonRunning

type DaemonRunning struct {
	Message string `json:"message"`

} //@name DaemonRunning

type Environment

type Environment interface {
	// Execute Executes a command within the environment.
	Execute(steps ExecutionData) error

	// ExecuteAsync Executes a command within the environment and immediately return
	ExecuteAsync(steps ExecutionData) error

	// ExecuteInMainProcess Sends a string to the StdIn of the main program process
	ExecuteInMainProcess(cmd string) error

	// Kill Kills the main process, but leaves the environment running.
	Kill() error

	// Create Creates the environment setting needed to run programs.
	Create() error

	// Delete Deletes the environment.
	Delete() error

	Update() error

	IsRunning() (isRunning bool, err error)

	IsInstalling() bool

	SetInstalling(bool)

	WaitForMainProcess() error

	WaitForMainProcessFor(timeout time.Duration) error

	GetRootDirectory() string

	GetConsole() (console []byte, epoch int64)

	GetConsoleFrom(time int64) (console []byte, epoch int64)

	AddConsoleListener(ws *Socket)

	AddStatusListener(ws *Socket)

	AddStatsListener(ws *Socket)

	GetStats() (*ServerStats, error)

	DisplayToConsole(prefix bool, msg string, data ...interface{})

	SendCode(code int) error

	GetBase() *BaseEnvironment

	GetLastExitCode() int

	GetWrapper() io.Writer

	GetStatsTracker() *Tracker
}

type EnvironmentFactory

type EnvironmentFactory interface {
	Create(id string) Environment

	Key() string
}

type Error

type Error struct {
	Message string                 `json:"msg,omitempty"`
	Code    string                 `json:"code,omitempty"`
	Meta    map[string]interface{} `json:"metadata,omitempty"`

} //@name Error

func CreateErrMissingScope

func CreateErrMissingScope(scope Scope) *Error

func CreateError

func CreateError(msg, code string) *Error

func FromError

func FromError(err error) *Error

func (*Error) Error

func (ge *Error) Error() string

func (*Error) GetCode

func (ge *Error) GetCode() string

func (*Error) GetMessage

func (ge *Error) GetMessage() string

func (*Error) Is

func (ge *Error) Is(err *Error) bool

func (*Error) Metadata

func (ge *Error) Metadata(metadata map[string]interface{}) *Error

type ErrorResponse

type ErrorResponse struct {
	Error *Error `json:"error"`

} //@name ErrorResponse

type Execution

type Execution struct {
	Command                 interface{}               `json:"command"`
	StopCommand             string                    `json:"stop,omitempty"`
	StopCode                int                       `json:"stopCode,omitempty"`
	PreExecution            []ConditionalMetadataType `json:"pre,omitempty"`
	PostExecution           []ConditionalMetadataType `json:"post,omitempty"`
	EnvironmentVariables    map[string]string         `json:"environmentVars,omitempty"`
	WorkingDirectory        string                    `json:"workingDirectory,omitempty"`
	Stdin                   StdinConsoleConfiguration `json:"stdin,omitempty"`
	AutoStart               bool                      `json:"autostart"`
	AutoRestartFromCrash    bool                      `json:"autorecover"`
	AutoRestartFromGraceful bool                      `json:"autorestart"`
	ExpectedExitCode        int                       `json:"expectedExitCode,omitempty"`

} //@name Execution

type ExecutionData

type ExecutionData struct {
	Command          string
	Arguments        []string
	Environment      map[string]string
	WorkingDirectory string
	Variables        map[string]interface{}
	Callback         func(exitCode int)
	StdInConfig      StdinConsoleConfiguration
}

type ExecutionFunction

type ExecutionFunction func(steps ExecutionData) (err error)

type FileServer

type FileServer interface {
	fs.FS
	fs.ReadDirFS
	fs.StatFS

	Prefix() string

	Stat(name string) (fs.FileInfo, error)
	Mkdir(path string, mode os.FileMode) error
	MkdirAll(path string, mode os.FileMode) error
	OpenFile(path string, flags int, mode os.FileMode) (*os.File, error)
	Remove(path string) error
	Rename(source, target string) error
	RemoveAll(path string) error

	Close() error
}

func NewFileServer

func NewFileServer(prefix string) (FileServer, error)

type Filesystem

type Filesystem interface {
	fs.FS
	fs.ReadDirFS
	fs.ReadFileFS
}

type Group

type Group struct {
	If          string   `json:"if,omitempty"`
	Display     string   `json:"display"`
	Description string   `json:"description"`
	Variables   []string `json:"variables"`
	Order       int      `json:"order"`

} //@name Group

type MemoryCache

type MemoryCache struct {
	Buffer   []Message
	Capacity int
	Size     int
	Lock     sync.RWMutex
}

func CreateCache

func CreateCache() *MemoryCache

func (*MemoryCache) Read

func (c *MemoryCache) Read() (msg []byte, lastTime int64)

func (*MemoryCache) ReadFrom

func (c *MemoryCache) ReadFrom(startTime int64) (msg []byte, lastTime int64)

func (*MemoryCache) Write

func (c *MemoryCache) Write(b []byte) (n int, err error)

type MergedFS

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

func NewMergedFS

func NewMergedFS(a, b fs.FS) *MergedFS

func (*MergedFS) Open

func (m *MergedFS) Open(name string) (fs.File, error)

func (*MergedFS) ReadDir

func (m *MergedFS) ReadDir(name string) ([]fs.DirEntry, error)

func (*MergedFS) ReadFile

func (m *MergedFS) ReadFile(name string) (data []byte, err error)

type Message

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

type Metadata

type Metadata struct {
	Paging *Paging `json:"paging"`

} //@name Metadata

type MetadataType

type MetadataType struct {
	Type     string                 `json:"type,omitempty"`
	Metadata map[string]interface{} `json:"-"`

} //@name Metadata

MetadataType designed to be overridden

func (*MetadataType) MarshalJSON

func (t *MetadataType) MarshalJSON() ([]byte, error)

func (*MetadataType) ParseMetadata

func (t *MetadataType) ParseMetadata(target interface{}) error

ParseMetadata Parses the metadata into the target interface

func (*MetadataType) UnmarshalJSON

func (t *MetadataType) UnmarshalJSON(bs []byte) error

UnmarshalJSON parses a type with this declaration, storing what it needs into metadata and type

type Name

type Name struct {
	Name string `json:"name"`

} //@name Name

type NoStartConsole

type NoStartConsole struct {
	Console
	Base io.WriteCloser
}

func (*NoStartConsole) Close

func (nsc *NoStartConsole) Close() error

func (*NoStartConsole) Start

func (nsc *NoStartConsole) Start()

func (*NoStartConsole) Write

func (nsc *NoStartConsole) Write(p []byte) (n int, err error)

type Operation

type Operation interface {
	Run(env Environment) OperationResult
}

type OperationFactory

type OperationFactory interface {
	Create(CreateOperation) (Operation, error)

	Key() string
}

type OperationResult

type OperationResult struct {
	Error             error
	VariableOverrides map[string]interface{}
}

type Paging

type Paging struct {
	Page    uint  `json:"page"`
	Size    uint  `json:"pageSize"`
	MaxSize uint  `json:"maxSize"`
	Total   int64 `json:"total"`

} //@name Paging

type RCONConnection

type RCONConnection struct {
	io.WriteCloser
	IP        string
	Port      string
	Password  string
	Reconnect bool
	// contains filtered or unexported fields
}

func (*RCONConnection) Close

func (tc *RCONConnection) Close() error

func (*RCONConnection) Start

func (tc *RCONConnection) Start()

func (*RCONConnection) Write

func (tc *RCONConnection) Write(p []byte) (n int, err error)

type RCONWSConnection

type RCONWSConnection struct {
	io.WriteCloser
	IP          string
	Port        string
	Password    string
	Reconnect   bool
	Environment Environment
	// contains filtered or unexported fields
}

func (*RCONWSConnection) Close

func (tc *RCONWSConnection) Close() error

func (*RCONWSConnection) Start

func (tc *RCONWSConnection) Start()

func (*RCONWSConnection) Write

func (tc *RCONWSConnection) Write(p []byte) (n int, err error)

type Requirements

type Requirements struct {
	OS       string   `json:"os,omitempty"`
	Arch     string   `json:"arch,omitempty"`
	Binaries []string `json:"binaries,omitempty"`

} //@name Requirements

func (Requirements) Test

func (r Requirements) Test(server Server) error

type SFTPAuthorization

type SFTPAuthorization interface {
	Validate(username, password string) (perms *ssh.Permissions, err error)
}

type Scope

type Scope struct {
	Value     string
	ForServer bool

} // @name Scopes

func AddScope

func AddScope(source []*Scope, addition *Scope) []*Scope

func GetScope

func GetScope(str string) *Scope

func RemoveScope

func RemoveScope(source []*Scope, removal *Scope) []*Scope

func UpdateScopesWhereGranted

func UpdateScopesWhereGranted(source, desired, changer []*Scope) []*Scope

func (*Scope) Is

func (s *Scope) Is(t any) bool

func (*Scope) MarshalJSON

func (s *Scope) MarshalJSON() ([]byte, error)

func (*Scope) String

func (s *Scope) String() string

func (*Scope) UnmarshalJSON

func (s *Scope) UnmarshalJSON(data []byte) error

type Server

type Server struct {
	Type
	Identifier            string                    `json:"id,omitempty"`
	Display               string                    `json:"display,omitempty"`
	Icon                  string                    `json:"icon,omitempty"`
	Variables             map[string]Variable       `json:"data,omitempty"`
	Groups                []Group                   `json:"groups,omitempty"`
	Installation          []ConditionalMetadataType `json:"install,omitempty"`
	Uninstallation        []ConditionalMetadataType `json:"uninstall,omitempty"`
	Execution             Execution                 `json:"run"`
	Environment           MetadataType              `json:"environment"`
	SupportedEnvironments []MetadataType            `json:"supportedEnvironments,omitempty"`
	Requirements          Requirements              `json:"requirements,omitempty"`

} //@name ServerDefinition

func (*Server) CopyFrom

func (s *Server) CopyFrom(replacement *Server)

func (*Server) DataToMap

func (s *Server) DataToMap() map[string]interface{}

type ServerData

type ServerData struct {
	Variables map[string]Variable `json:"data"`
	Groups    []Group             `json:"groups,omitempty"`

} //@name ServerData

type ServerDataAdmin

type ServerDataAdmin struct {
	*Server
}

type ServerFlags

type ServerFlags struct {
	AutoStart             *bool `json:"autoStart,omitempty"`
	AutoRestartOnCrash    *bool `json:"autoRestartOnCrash,omitempty"`
	AutoRestartOnGraceful *bool `json:"autoRestartOnGraceful,omitempty"`

} //@name ServerFlags

type ServerIdResponse

type ServerIdResponse struct {
	Id string `json:"id"`

} //@name ServerId

type ServerLogs

type ServerLogs struct {
	Epoch int64  `json:"epoch"`
	Logs  []byte `json:"logs"`

} //@name ServerLogs

type ServerRunning

type ServerRunning struct {
	Running    bool `json:"running"`
	Installing bool `json:"installing"`

} //@name ServerRunning

type ServerStats

type ServerStats struct {
	Cpu    float64 `json:"cpu"`
	Memory float64 `json:"memory"`

} //@name ServerStats

type ServerTask

type ServerTask struct {
	IsRunning bool `json:"isRunning"`
	Task

} //@name ServerTask

type ServerTasks

type ServerTasks struct {
	Tasks map[string]ServerTask

} //@name ServerTasks

type Socket

type Socket struct {
	io.WriteCloser
	// contains filtered or unexported fields
}

func Create

func Create(ws *websocket.Conn) *Socket

func (*Socket) Close

func (s *Socket) Close() error

func (*Socket) Write

func (s *Socket) Write(data []byte) (int, error)

func (*Socket) WriteJSON

func (s *Socket) WriteJSON(data interface{}) error

func (*Socket) WriteMessage

func (s *Socket) WriteMessage(msg messages.Message) error

type StdinConsoleConfiguration

type StdinConsoleConfiguration struct {
	Type     string `json:"type,omitempty"`
	IP       string `json:"ip,omitempty"`
	Port     string `json:"port,omitempty"`
	Password string `json:"password,omitempty"`

} //@name StdinConsoleConfiguration

func (*StdinConsoleConfiguration) Replace

func (c *StdinConsoleConfiguration) Replace(variables map[string]interface{}) StdinConsoleConfiguration

func (*StdinConsoleConfiguration) UnmarshalJSON

func (v *StdinConsoleConfiguration) UnmarshalJSON(data []byte) error

type Task

type Task struct {
	Name         string                    `json:"name"`
	CronSchedule string                    `json:"cronSchedule"`
	Description  string                    `json:"description,omitempty"`
	Operations   []ConditionalMetadataType `json:"operations" binding:"required"`

} //@name Task

type TelnetConnection

type TelnetConnection struct {
	io.WriteCloser
	IP        string
	Port      string
	Password  string
	Reconnect bool
	// contains filtered or unexported fields
}

func (*TelnetConnection) Close

func (tc *TelnetConnection) Close() error

func (*TelnetConnection) Start

func (tc *TelnetConnection) Start()

func (*TelnetConnection) Write

func (tc *TelnetConnection) Write(p []byte) (n int, err error)

type Tracker

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

func CreateTracker

func CreateTracker() *Tracker

func (*Tracker) Register

func (ws *Tracker) Register(conn *Socket)

func (*Tracker) Write

func (ws *Tracker) Write(source []byte) (n int, e error)

func (*Tracker) WriteMessage

func (ws *Tracker) WriteMessage(msg messages.Message) error

type Type

type Type struct {
	Type string `json:"type"`

} //@name Type

type Variable

type Variable struct {
	Type
	Value        interface{}      `json:"value"`
	Display      string           `json:"display,omitempty"`
	Description  string           `json:"desc,omitempty"`
	Required     bool             `json:"required"`
	Internal     bool             `json:"internal,omitempty"`
	UserEditable bool             `json:"userEdit"`
	Options      []VariableOption `json:"options,omitempty"`

} //@name Variable

func (*Variable) UnmarshalJSON

func (v *Variable) UnmarshalJSON(data []byte) (err error)

type VariableOption

type VariableOption struct {
	Value   interface{} `json:"value"`
	Display string      `json:"display"`

} //@name VariableOption

Directories

Path Synopsis
assets
client
operations
tty
tools
web
api
swagger
Package swagger GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package swagger GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag

Jump to

Keyboard shortcuts

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