server

package
v0.0.0-...-17f718d Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLog

func InitLog()

func LoadConfig

func LoadConfig()

Types

type API

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

func NewApi

func NewApi() (*API, error)

func (*API) Run

func (a *API) Run() error

func (*API) SetEndpoints

func (a *API) SetEndpoints()

type APIConfig

type APIConfig struct {
	Version         string     `json:"apiVersion"`
	AllowGuestLogin bool       `json:"allowGuestLogin"`
	BannedIPs       []string   `json:"bannedIPs"`
	BaseRoute       string     `json:"baseRoute"`
	ServeAddress    string     `json:"serveAddress"`
	TLSConfig       *TLSConfig `json:"tlsConfig"`
}

type ChompConfig

type ChompConfig struct {
	Version   string         `json:"version"`
	APIConfig APIConfig      `json:"apiConfig"`
	DBConfig  DatabaseConfig `json:"dbConfig"`
}

type Database

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

The database holds information about the accounts, games and logins of the server

func NewDatabase

func NewDatabase() (Database, error)

func (*Database) AddAccount

func (d *Database) AddAccount(account auth.Account) error

func (*Database) GetAccount

func (d *Database) GetAccount(username string) (auth.Account, error)

func (*Database) GetSessionByToken

func (d *Database) GetSessionByToken(token string) (auth.Session, error)

func (*Database) IsLoggedIn

func (d *Database) IsLoggedIn(username string) (bool, error)

func (*Database) Login

func (d *Database) Login(username, password string) (auth.Session, error)

func (*Database) Logout

func (d *Database) Logout(session auth.Session) error

func (*Database) LogoutToken

func (d *Database) LogoutToken(token string) (auth.Session, error)

type DatabaseConfig

type DatabaseConfig struct {
	AccountDatabase string `json:"accountDatabase"`
}

type TLSConfig

type TLSConfig struct {
	HostWhitelist []string `json:"hostWhitelist"`
	DirCache      string   `json:"dirCache"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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