server

package
v1.4.12 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoutes

func AddRoutes(r *chi.Mux, networkHandler *Handler) *chi.Mux

func NewRouter

func NewRouter(cfg http.RouterConfig) *chi.Mux

Types

type Config

type Config struct {
	Environment string
	Log         logger.Config
	Router      http.RouterConfig
	Server      http.ServerConfig
	Datastore   datastore.DatastoreConfig
	Network     NetworkOptions
}

func (Config) Str added in v1.3.0

func (c Config) Str() string

type CreateGameRequest

type CreateGameRequest struct {
	*networking.NetworkingCreateGameOptions
	Teams       int
	MoreOptions interface{}
}

type Handler

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

func NewHandler

func NewHandler(render *render.Render, network *networking.GameNetwork, gameStore datastore.GameStore) *Handler

func (*Handler) CreateGame

func (h *Handler) CreateGame(w http.ResponseWriter, r *http.Request)

func (*Handler) GetActiveGameIDs added in v1.3.7

func (h *Handler) GetActiveGameIDs(w http.ResponseWriter, r *http.Request)

func (*Handler) GetBGN

func (h *Handler) GetBGN(w http.ResponseWriter, r *http.Request)

func (*Handler) GetInfo added in v1.4.12

func (h *Handler) GetInfo(w http.ResponseWriter, r *http.Request)

func (*Handler) GetSnapshot added in v1.2.4

func (h *Handler) GetSnapshot(w http.ResponseWriter, r *http.Request)

func (*Handler) GetStats

func (h *Handler) GetStats(w http.ResponseWriter, r *http.Request)

func (*Handler) Health

func (h *Handler) Health(w http.ResponseWriter, r *http.Request)

func (*Handler) JoinGame

func (h *Handler) JoinGame(w http.ResponseWriter, r *http.Request)

func (*Handler) JoinSecureGame

func (h *Handler) JoinSecureGame(w http.ResponseWriter, r *http.Request)

func (*Handler) LoadGame

func (h *Handler) LoadGame(w http.ResponseWriter, r *http.Request)

type LoadGameRequest

type LoadGameRequest struct {
	*networking.NetworkingCreateGameOptions
	BGN string
}

type NetworkOptions

type NetworkOptions struct {
	Games      []string
	GameExpiry time.Duration
}

type Server

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

func NewServer

func NewServer(cfg Config) (*Server, error)

func (*Server) Shutdown

func (s *Server) Shutdown(errored bool)

func (*Server) Start

func (s *Server) Start()

type StatsResponse added in v1.1.1

type StatsResponse struct {
	GamesCreated  map[string]int
	GamesPlayed   map[string]int
	ActiveGames   map[string]int
	ActivePlayers map[string]int
}

Jump to

Keyboard shortcuts

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