Documentation ¶
Index ¶
- Constants
- func UseLogger(l *zap.Logger)
- type Flag
- type Session
- func (s *Session) CheckRPMLimitViolation() bool
- func (s *Session) ClearFlagAuth() *Session
- func (s *Session) ClearFlagEncrypted() *Session
- func (s *Session) ClearFlagKeyExchanged() *Session
- func (s *Session) ClearFlagKicked() *Session
- func (s *Session) ErrorResponse(cmd int32, status int32, msg string) []byte
- func (s *Session) FetchLoop()
- func (s *Session) Flag() Flag
- func (s *Session) IsFlagAuthSet() bool
- func (s *Session) IsFlagEncryptedSet() bool
- func (s *Session) IsFlagKeyExchangedSet() bool
- func (s *Session) IsFlagKickedSet() bool
- func (s *Session) NextSeq() uint64
- func (s *Session) Response(cmd int32, body []byte) []byte
- func (s *Session) SetFlagAuth() *Session
- func (s *Session) SetFlagEncrypted() *Session
- func (s *Session) SetFlagKeyExchanged() *Session
- func (s *Session) SetFlagKicked() *Session
- func (s *Session) String() string
Constants ¶
const ( // FlagKeyExchanged indicates the key exchange process has completed FlagKeyExchanged = 0x1 // FlagEncrypted indicates the transmission of this session is encrypted FlagEncrypted = 0x2 // FlagKicked indicates the client has been kicked out FlagKicked = 0x4 // FlagAuth indicates the session has been authorized FlagAuth = 0x8 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Session ¶
type Session struct { UID uint64 // User id LastLogin uint64 // Timestamp of last time login Token string // Session token generate at http login Die chan struct{} // Session close signal, trigger by agent() IP net.IP // Client IP address Port string // Client Port Client *game.Client // Client in game server Encoder *rc4.Cipher // Encrypt Decoder *rc4.Cipher // Decrypt ClientSeq uint64 // incoming packet sequence ServerSeq uint64 // outgoing sequence Push chan []byte // Push channel for internal communication MQ chan pb.Frame // MQ queue for packets from game ConnectTime time.Time // Timestamp of TCP connection established LastPacketTime time.Time // Timestamp of last packet arrived PacketCount int // Total packets received PacketCountPerMin int // Packets received per minute RPMLimit int // Request per minute limit // contains filtered or unexported fields }
Session holds the context of a client having conversation with agent
func (*Session) CheckRPMLimitViolation ¶
CheckRPMLimitViolation returns true if session violates RPM limitation
func (*Session) ClearFlagAuth ¶
ClearFlagAuth clears the auth bit
func (*Session) ClearFlagEncrypted ¶
ClearFlagEncrypted clears the encrypted bit
func (*Session) ClearFlagKeyExchanged ¶
ClearFlagKeyExchanged clears the key exchanged bit
func (*Session) ClearFlagKicked ¶
ClearFlagKicked clears the kicked bit
func (*Session) ErrorResponse ¶
ErrorResponse create a S2CHeader and fill with error information, then return its marshaled data
func (*Session) FetchLoop ¶
func (s *Session) FetchLoop()
FetchLoop fetches streams from game service
func (*Session) IsFlagAuthSet ¶
IsFlagAuthSet returns true if the auth bit is set
func (*Session) IsFlagEncryptedSet ¶
IsFlagEncryptedSet returns true if the encrypted bit is set
func (*Session) IsFlagKeyExchangedSet ¶
IsFlagKeyExchangedSet return true if the key exchanged bit is set
func (*Session) IsFlagKickedSet ¶
IsFlagKickedSet returns true if the kicked bit is set
func (*Session) SetFlagAuth ¶
SetFlagAuth sets the auth bit
func (*Session) SetFlagEncrypted ¶
SetFlagEncrypted sets the encrypted bit
func (*Session) SetFlagKeyExchanged ¶
SetFlagKeyExchanged sets the key exchanged bit
func (*Session) SetFlagKicked ¶
SetFlagKicked sets the kicked bit