Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - Variables
 - type EncryptType
 - type Packet
 - type Request
 - type RequestParams
 - type RequestType
 - type Response
 - type TCPClient
 - func (t *TCPClient) Close()
 - func (t *TCPClient) Connect(addr string) error
 - func (t *TCPClient) PlannedDisconnect(f func(*TCPClient))
 - func (t *TCPClient) ReadBytes(l int) ([]byte, error)
 - func (t *TCPClient) ReadInt32() (int32, error)
 - func (t *TCPClient) UnexpectedDisconnect(f func(*TCPClient, error))
 - func (t *TCPClient) Write(buf []byte) error
 
- type Transport
 
Constants ¶
      View Source
      
  
const ( RequestTypeLogin = 0x0A RequestTypeSimple = 0x0B RequestTypeNT = 0x0C )
Variables ¶
      View Source
      
  
    var ( ErrSessionExpired = errors.New("session expired") ErrAuthenticationFailed = errors.New("authentication failed") ErrPacketDropped = errors.New("packet dropped") ErrInvalidPacketType = errors.New("invalid packet type") )
      View Source
      
  
var ErrConnectionClosed = errors.New("connection closed")
    Functions ¶
This section is empty.
Types ¶
type EncryptType ¶
type EncryptType uint32
const ( EncryptTypeNoEncrypt EncryptType = iota // 0x00 EncryptTypeD2Key // 0x01 EncryptTypeEmptyKey // 0x02 )
type Packet ¶
type Packet struct {
	SequenceID  uint32
	CommandName string
	Payload     []byte
	Params      RequestParams
}
    type RequestParams ¶
func (RequestParams) Bool ¶
func (p RequestParams) Bool(k string) bool
func (RequestParams) Int32 ¶
func (p RequestParams) Int32(k string) int32
type RequestType ¶
type RequestType uint32
type Response ¶
type Response struct {
	Type        RequestType
	EncryptType EncryptType // EncryptType 对应旧 SSOHeader.Flag
	SequenceID  int32       // SequenceID 对应旧 SSOPacket.Seq
	Uin         int64       // Uin 对应旧 SSOHeader.Uin
	CommandName string      // CommandName 对应旧 SSOPacket.Cmd
	Body        []byte      // Body 对应旧 SSOPacket.Data
	Message string // Message 对应旧 SSOPacket.Extra
}
    type TCPClient ¶
type TCPClient struct {
	// contains filtered or unexported fields
}
    func (*TCPClient) PlannedDisconnect ¶
PlannedDisconnect 预料中的断开连接 如调用 Close() Connect()
func (*TCPClient) UnexpectedDisconnect ¶
UnexpectedDisconnect 未预料的断开连接
type Transport ¶
Transport is a network transport.
func (*Transport) PackPacket ¶
PackPacket packs a packet.
 Click to show internal directories. 
   Click to hide internal directories.