Documentation ¶
Index ¶
- Constants
- Variables
- func AddChannel(dest *ChannelServer, src *ChannelInfo) bool
- func AddChannelRoom(room *Room, chlid uint8, chlsrvid uint8) bool
- func AddChannelServer(dest *ServerManager, src *ChannelServer) bool
- func AddRoomToManager(room *Room) bool
- func AddUserToDB(u *User) error
- func BuildChannelList(num uint8, channels []*ChannelInfo) []byte
- func BuildChannelServerList(chlsrv ChannelServer) []byte
- func ClearCount(client string)
- func CountFailLogin(client string)
- func CountTenMinutes(client string)
- func DelChannelRoom(roomid uint16, chlid uint8, chlsrvid uint8) bool
- func DelChannelRoomQuick(roomid uint16, chl *ChannelInfo) bool
- func DelRoomFromManager(roomid uint16) bool
- func DelUserWithConn(con net.Conn) bool
- func GetChannelServerWithID(id uint8) *ChannelServer
- func GetChannelWithID(id uint8, chlsrv *ChannelServer) *ChannelInfo
- func GetNewChannelID(chlsrv ChannelServer) uint8
- func GetNewChannelServerID() uint8
- func GetNewRoomID(chl ChannelInfo) uint16
- func GetNewRoomNumber(chl ChannelInfo) uint8
- func GetNewUserID() uint32
- func GetRoomFromID(chlsrvID uint8, chlID uint8, roomID uint16) *Room
- func GetUserByLogin(account string, passwd []byte) (*User, int)
- func GetUserFromConnection(client net.Conn) *User
- func GetUserFromDatabase(loginname string, passwd []byte) (*User, int)
- func GetUserFromID(id uint32) *User
- func GetUserFromIngameName(name []byte) *User
- func InitBloomFilter() bool
- func IsExistsIngameName(name []byte) bool
- func IsExistsUser(username []byte) bool
- func IsLoginTenth(client string) bool
- func NewChannelInfo(name []byte, chlsrv ChannelServer) ChannelInfo
- func NewChannelServer(name []byte) ChannelServer
- func NewMainServer() ServerManager
- func OnServerList(client net.Conn)
- func PathExists(path string) (bool, error)
- func SaveAllUsers() bool
- func UpdateUserToDB(u *User) error
- type RM
Constants ¶
View Source
const ( USER_LOGIN_SUCCESS = 0 USER_ALREADY_LOGIN = 1 USER_NOT_FOUND = 2 USER_PASSWD_ERROR = 3 USER_UNKOWN_ERROR = 4 )
Variables ¶
View Source
var ( BFusername *BloomFilter BFgamename *BloomFilter DB *sql.DB Dblock sync.Mutex DBPath string Redis redis.Conn )
View Source
var ( LoginCounter = map[string]int{} LoginCounterLock sync.Mutex )
View Source
var (
//MainServer 主服务器
MainServer = ServerManager{
0,
[]*ChannelServer{},
}
)
View Source
var ( RoomsManager = RM{ map[uint16]*Room{}, &rmlock, } )
Functions ¶
func AddChannelRoom ¶
添加房间,一次只能一个协程修改该频道
func AddChannelServer ¶
func AddChannelServer(dest *ServerManager, src *ChannelServer) bool
主服务器里加频道服务器,一次只能一个协程访问
func AddUserToDB ¶
func AddUserToDB(u *User) error
func BuildChannelList ¶
func ClearCount ¶ added in v0.3.9
func ClearCount(client string)
func CountFailLogin ¶ added in v0.3.9
func CountFailLogin(client string)
func CountTenMinutes ¶ added in v0.3.9
func CountTenMinutes(client string)
func DelChannelRoomQuick ¶ added in v0.3.15
快速删除频道房间,需预先取得锁
func DelUserWithConn ¶
func GetChannelWithID ¶
func GetChannelWithID(id uint8, chlsrv *ChannelServer) *ChannelInfo
通过ID获取频道
func GetNewRoomNumber ¶
func GetNewRoomNumber(chl ChannelInfo) uint8
getNewRoomNumber() 获取房间在某个频道下的标号
func GetNewUserID ¶
func GetNewUserID() uint32
func GetRoomFromID ¶
func GetUserByLogin ¶
getUserByLogin 假定nexonUsername是唯一
func GetUserFromDatabase ¶
从数据库中读取用户数据 如果是新用户则保存到数据库中
func GetUserFromIngameName ¶ added in v0.3.8
func GetUserFromIngameName(name []byte) *User
通过name获取用户
func InitBloomFilter ¶ added in v0.5.0
func InitBloomFilter() bool
func IsExistsIngameName ¶ added in v0.3.11
func IsExistsUser ¶
func IsLoginTenth ¶ added in v0.3.9
func NewChannelInfo ¶
func NewChannelInfo(name []byte, chlsrv ChannelServer) ChannelInfo
func PathExists ¶ added in v0.3.11
func SaveAllUsers ¶ added in v0.3.15
func SaveAllUsers() bool
func UpdateUserToDB ¶
func UpdateUserToDB(u *User) error
Types ¶
Click to show internal directories.
Click to hide internal directories.