Documentation
¶
Index ¶
- type Controller
- func (c Controller) FetchChallanges(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (c Controller) GetRouter() *httprouter.Router
- func (c Controller) InstallChallenge(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (c Controller) Ping(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (c Controller) PlayerJoin(w http.ResponseWriter, r *http.Request)
- func (c Controller) Register(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- type IConroller
- type IService
- type ResponseCreator
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implementation
func (Controller) FetchChallanges ¶
func (c Controller) FetchChallanges(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (Controller) GetRouter ¶
func (c Controller) GetRouter() *httprouter.Router
Creates a new router
func (Controller) InstallChallenge ¶
func (c Controller) InstallChallenge(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (Controller) Ping ¶
func (c Controller) Ping(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (Controller) PlayerJoin ¶
func (c Controller) PlayerJoin(w http.ResponseWriter, r *http.Request)
func (Controller) Register ¶
func (c Controller) Register(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
Handles /team/register request
type IConroller ¶
type IConroller interface { // Status endpoint Ping(http.ResponseWriter, *http.Request, httprouter.Params) // Endpoint for fetching currently available challenges FetchChallanges(w http.ResponseWriter, r *http.Request, _ httprouter.Params) // Endpoint for installing defense modules InstallChallenge(w http.ResponseWriter, r *http.Request, _ httprouter.Params) // Endpoint for registration Register(http.ResponseWriter, *http.Request, httprouter.Params) // Entry point for the websocket API PlayerJoin(w http.ResponseWriter, r *http.Request) // Boostrapping of the router GetRouter() *httprouter.Router }
Describes the interface of the engine controller
func NewController ¶
func NewController( bus bus.IBus, engineService IService, playerService player.IService, challengeService challenge.IService, scoreService scoreboard.IService, ) IConroller
Constructor for the engine controller
type IService ¶
type IService interface { // Handles join event for users Join(dto.JoinEvent, *websocket.Conn) error // Triggers all calculations for the end result of the game FinishGame() }
Describes an engine service interface
type ResponseCreator ¶
type ResponseCreator struct{}
Static pointer struct to provide functions for consistent responses
func (*ResponseCreator) BadRequest ¶
func (rc *ResponseCreator) BadRequest(w http.ResponseWriter, meta map[string]interface{})
Generic bad request
func (*ResponseCreator) Empty200 ¶
func (rc *ResponseCreator) Empty200(w http.ResponseWriter)
Describes an empty 200 response
func (*ResponseCreator) InternalServerError ¶
func (rc *ResponseCreator) InternalServerError(w http.ResponseWriter)
Generic 500
func (*ResponseCreator) OK ¶
func (rc *ResponseCreator) OK(w http.ResponseWriter, body interface{})
Describes a 200 with a given body
Click to show internal directories.
Click to hide internal directories.