Documentation
¶
Overview ¶
*
- @file pool.go
- @brief pool of goroutined *
- Contains Task and Pool types and methods to work with Pool
*
- @file telnet.go
- @brief Telnet protocol *
- Contains specific for this protocol methods
*
- @file user.go
- @brief Users and Sessions *
- Contains User and Session types,
- Methods to login new user
Index ¶
Constants ¶
View Source
const ( ConnKey key = 0 + iota ServerKey ChanKey )
View Source
const ( BC_ALL = 1 << iota ///< All users in this session accept message BC_SELF ///< Only sender accept message BC_OTHER ///< All users in this session without sender accept message )
* @brief enum BroadcastFlags * * Specified, who will have broadcastins message
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
*
- @class Pool
- @brief Pool of goroutines *
- It contains concurrency goroutines and send new task into tasksChan,
- when task is done, goroutine send result into resultsChan
func NewPool ¶
*
- @brief Create new Pool object
- @param[in] concurrency Number of goroutines in pool
- @return Pointer to created Pool
type Server ¶
type Server struct {
Timeout time.Duration ///< Timeout in seconds of waiting user play (default 30)
TimeoutForLogin time.Duration ///< Timeout in seconds of waiting user login (default 300)
Deadline time.Duration ///< Deadline for connection (in milliseconds) (default 1000)
Pool Pool ///< Pool of goroutines
MaxUsernameLength int ///< Maximum length of user name
Sessions []Session ///< Array of active sessions
Users map[string]int ///< Map of logins in each sessionID
Signals chan os.Signal ///< Channel of system signals like SIGINT and SIGKILL
WaitTime time.Duration
SystemLogin string
// contains filtered or unexported fields
}
*
- @class Server
- @brief Telnet game server core *
- Main class, provides telnet-server,
- which contributes sessions, users, games, scores and other
func New ¶
func New(cfg conf.ServerConf) Server
*
- @brief Constructor of class Server
- @param[in] cfg Server configuration
- @return server Pointer to new Server object *
- Make light and eazy fast initialisation of server directly
type Session ¶
type Session struct {
Users []User ///< Array of users in this session
Game *game.Game ///< Game object
}
*
- @class Session
- @brief Class, provides information about Session *
- Session is a thing which aggregate users in one game
Click to show internal directories.
Click to hide internal directories.