Documentation
¶
Overview ¶
Package http contain the http server.
Index ¶
- func Btoi(bs []byte) int
- type CDb
- func (cdb *CDb) BackupHandleFunc(w http.ResponseWriter, req *http.Request)
- func (cdb *CDb) Close() error
- func (cdb *CDb) GetID(id int) (client *Client, isFound bool, err error)
- func (cdb *CDb) GetName(name string) (client *Client, isFound bool, err error)
- func (cdb *CDb) UpdDisable(id int, isDisable bool) (name string, isUpd bool, err error)
- func (cdb *CDb) UpdInsert(inClient *Client) (updClient *Client, isUpd bool, err error)
- type Client
- type Clients
- func (clients *Clients) AddNew(name string, pwTxt string) (status login.Status, sid string, err error)
- func (clients *Clients) CancelGameServer() (err error)
- func (clients *Clients) Close() (err error)
- func (clients *Clients) IsGameServerDown() bool
- func (clients *Clients) JoinGameServer(name string, sid string, ws *websocket.Conn, errCh chan<- error, ...) (ok, isJoined bool)
- func (clients *Clients) LogIn(name string, pw string) (status login.Status, sid string, err error)
- func (clients *Clients) LogOut(name string)
- func (clients *Clients) SetGameServer(games *games.Server) (oldGames *games.Server)
- func (clients *Clients) UpdateDisable(id int, isDisable bool) (err error)
- func (clients *Clients) VerifySid(name, sid string) (ok, isDown bool)
- type ErrServer
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CDb ¶
type CDb struct {
// contains filtered or unexported fields
}
CDb a client database.
func (*CDb) BackupHandleFunc ¶
func (cdb *CDb) BackupHandleFunc(w http.ResponseWriter, req *http.Request)
BackupHandleFunc handles http back up requests.
func (*CDb) UpdDisable ¶
UpdDisable update a clients disable field.
type Client ¶
type Client struct { Name string ID int Pw []byte IsDisable bool // contains filtered or unexported fields }
Client the login object. Hold information of the user including loged-in information.
type Clients ¶
type Clients struct {
// contains filtered or unexported fields
}
Clients the clients list.
func NewClients ¶
NewClients creates new clients.
func (*Clients) AddNew ¶
func (clients *Clients) AddNew(name string, pwTxt string) (status login.Status, sid string, err error)
AddNew create and log-in a new client.
func (*Clients) CancelGameServer ¶
CancelGameServer cancels the game server.
func (*Clients) IsGameServerDown ¶
IsGameServerDown checks if the game server is down.
func (*Clients) JoinGameServer ¶
func (clients *Clients) JoinGameServer(name string, sid string, ws *websocket.Conn, errCh chan<- error, joinedCh chan<- *games.Player) (ok, isJoined bool)
JoinGameServer add a client to the game server. ok: True: if request succeded the player is returned on the joined channel when ready. isJoined: True: if the client is already loged-in.
func (*Clients) SetGameServer ¶
SetGameServer set the game server. The old game server is return, if set to nil all http server will return game server down. lock is used.
func (*Clients) UpdateDisable ¶
UpdateDisable disable/enable a client.
type ErrServer ¶
type ErrServer struct {
// contains filtered or unexported fields
}
ErrServer handles while the servers are running. All errors are send here so the error server can deside what to to do. Errors during close down does not need to be send here.
func NewErrServer ¶
NewErrServer creates a new error server
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server a http server.
func New ¶
func New(port, backupPort string, archPokePort int, archAddr, rootDir string) (s *Server, err error)
New creates a new Server.