client_handler

package
v0.0.0-...-24f7258 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SALT         = "DH"
	DEFAULT_GSID = "game1"
)

Variables

View Source
var Code = map[string]int16{
	"heart_beat_req":         0,
	"heart_beat_ack":         1,
	"user_login_req":         10,
	"user_login_succeed_ack": 11,
	"user_login_faild_ack":   12,
	"client_error_ack":       13,
	"get_seed_req":           30,
	"get_seed_ack":           31,
	"proto_ping_req":         1001,
	"proto_ping_ack":         1002,
}
View Source
var Handlers map[int16]func(*Session, *packet.Packet) []byte
View Source
var RCode = map[int16]string{
	0:    "heart_beat_req",
	1:    "heart_beat_ack",
	10:   "user_login_req",
	11:   "user_login_succeed_ack",
	12:   "user_login_faild_ack",
	13:   "client_error_ack",
	30:   "get_seed_req",
	31:   "get_seed_ack",
	1001: "proto_ping_req",
	1002: "proto_ping_ack",
}

Functions

func P_get_seed_req

func P_get_seed_req(sess *Session, reader *packet.Packet) []byte

密钥交换 加密建立方式: DH+RC4 注意:完整的加密过程包括 RSA+DH+RC4 1. RSA用于鉴定服务器的真伪(这步省略) 2. DH用于在不安全的信道上协商安全的KEY 3. RC4用于流加密

func P_heart_beat_req

func P_heart_beat_req(sess *Session, reader *packet.Packet) []byte

心跳包

func P_user_login_req

func P_user_login_req(sess *Session, reader *packet.Packet) []byte

玩家登陆过程

Types

type S_auto_id

type S_auto_id struct {
	F_id int32
}

# 该文件规定客户端和服务之间的通信结构体模式.注释必须独占一行!!!!! # # 基本类型 : integer float string boolean # 格式如下所示.若要定义数组,查找array看看已有定义你懂得. # # 每一个定义以' # 紧接一行注释 #描述这个逻辑结构用来干啥. # 然后定义结构名字,以'='结束,这样可以grep '=' 出全部逻辑名字. # 之后每一行代表一个成员定义. # # 发布代码前请确保这些部分最新. # #公共结构, 用于只传id,或一个数字的结构

func PKT_auto_id

func PKT_auto_id(reader *packet.Packet) (tbl S_auto_id, err error)

func (S_auto_id) Pack

func (p S_auto_id) Pack(w *packet.Packet)

type S_error_info

type S_error_info struct {
	F_code int32
	F_msg  string
}

#一般性回复payload,0代表成功

func PKT_error_info

func PKT_error_info(reader *packet.Packet) (tbl S_error_info, err error)

func (S_error_info) Pack

func (p S_error_info) Pack(w *packet.Packet)

type S_seed_info

type S_seed_info struct {
	F_client_send_seed    int32
	F_client_receive_seed int32
}

#通信加密种子

func PKT_seed_info

func PKT_seed_info(reader *packet.Packet) (tbl S_seed_info, err error)

func (S_seed_info) Pack

func (p S_seed_info) Pack(w *packet.Packet)

type S_user_login_info

type S_user_login_info struct {
	F_login_way          int32
	F_open_udid          string
	F_client_certificate string
	F_client_version     int32
	F_user_lang          string
	F_app_id             string
	F_os_version         string
	F_device_name        string
	F_device_id          string
	F_device_id_type     int32
	F_login_ip           string
}

#用户登陆发包 1代表使用uuid登陆 2代表使用客户端证书登陆

func PKT_user_login_info

func PKT_user_login_info(reader *packet.Packet) (tbl S_user_login_info, err error)

func (S_user_login_info) Pack

func (p S_user_login_info) Pack(w *packet.Packet)

type S_user_snapshot

type S_user_snapshot struct {
	F_uid int32
}

#用户信息包

func PKT_user_snapshot

func PKT_user_snapshot(reader *packet.Packet) (tbl S_user_snapshot, err error)

func (S_user_snapshot) Pack

func (p S_user_snapshot) Pack(w *packet.Packet)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL