middle

package
v0.0.0-...-9a11bf0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ID = iota
	X
	Y
	ACT
	DIRECTION
)
View Source
const (
	READY byte = iota
	CREATE
	ASSIGN
	MOVE
	WRITE
)
View Source
const (
	LEFT = iota
	RIGHT
	UP
	DOWN
)

Directions

Variables

This section is empty.

Functions

func AddUsersToTestDb

func AddUsersToTestDb(users []models.User, db *dao.TestDB)

func AuthMiddleware

func AuthMiddleware(next http.Handler) http.Handler

func AuthenticateUser

func AuthenticateUser(u models.User, base dao.DBase) (token map[string]string, err error)

func CreateUser

func CreateUser(userIn models.User, db dao.DBase) (userOut models.User, err error)

func ExtractJWTToken

func ExtractJWTToken(req *http.Request, tokenType TokenType) (string, error)

func MakeToken

func MakeToken(u models.User) (map[string]string, error)

func NewClient

func NewClient(g *Game, conn *websocket.Conn)

func UserFromJson

func UserFromJson(data io.ReadCloser) (user models.User, err error)

func UserFromToken

func UserFromToken(token string, db dao.DBase) (user models.User, err error)

Types

type Client

type Client struct {
	Id byte
	// contains filtered or unexported fields
}

type Game

type Game struct {
	Db dao.DBase

	Map [][]int
	// contains filtered or unexported fields
}

func NewGame

func NewGame(db dao.DBase) *Game

func (*Game) Run

func (g *Game) Run()

type GameState

type GameState int8
const (
	Opening GameState = iota
	Full
	Empty
	Closing
)

type TokenType

type TokenType int
const (
	AUTHENTICATION TokenType = iota
	REFRESH
)

Jump to

Keyboard shortcuts

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