Documentation ¶
Index ¶
- Constants
- func NewTokenCache(game *rp.Game) map[string]*rp.Player
- type Server
- func (s *Server) Auth(token string) (*rp.Player, error)
- func (s *Server) Close()
- func (s *Server) GameTime(c context.Context, req *rp.TokenMessage) (*rp.GameTimeResponse, error)
- func (s *Server) GetEnemy(c context.Context, req *rp.TokenMessage) (*rp.Units, error)
- func (s *Server) GetMap(c context.Context, req *rp.TokenMessage) (*rp.MapData, error)
- func (s *Server) GetUnits(c context.Context, req *rp.TokenMessage) (*rp.Units, error)
- func (s *Server) Login(c context.Context, req *rp.LoginMessage) (*rp.LoginResponse, error)
- func (s *Server) Save()
- func (s *Server) Serve()
- func (s *Server) Version(c context.Context, req *rp.EmptyMessage) (*rp.StringMessage, error)
Constants ¶
View Source
const ( DateTimeFormat = "Monday, 02-Jan-2006 15:04" DateFormat = "Monday, 02-Jan-2006" TimeFormat = "Monday, 15:04" )
Constants for use in the UI
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
Server object stores the whole game state
func NewServer ¶
func NewServer(log *logrus.Logger, version string, filename string, port int, web int) (*Server, error)
NewServer returns a new republique server
func (*Server) Auth ¶
Auth is a helper function in the server to validate a token and return the details of the player
func (*Server) GameTime ¶
func (s *Server) GameTime(c context.Context, req *rp.TokenMessage) (*rp.GameTimeResponse, error)
GameTime is an RPC that returns the current game time
func (*Server) Login ¶
func (s *Server) Login(c context.Context, req *rp.LoginMessage) (*rp.LoginResponse, error)
Login is an RPC that validates the given credentials, and returns a struct with the player data if success
func (*Server) Version ¶
func (s *Server) Version(c context.Context, req *rp.EmptyMessage) (*rp.StringMessage, error)
Version is an RPC handler for the version request
Source Files ¶
Click to show internal directories.
Click to hide internal directories.