Documentation ¶
Index ¶
- Constants
- func AfterReLoadConfig(pconfig *Config, old_config *FileConfig, new_config *FileConfig)
- func CloseClient(pconfig *Config, client_key int64) bool
- func CommSet(pconfig *Config) bool
- func GetClientKey(pconfig *Config, uid int64) int64
- func GetClientUid(pconfig *Config, c_key int64) int64
- func HandleClientPkg(pconfig *Config, pclient *comm.ClientPkg)
- func HandleReportCmd(pconfig *Config, pmsg *comm.ReportMsg)
- func LocalSet(pconfig *Config) bool
- func ReadClients(pconfig *Config) int64
- func ReadRsaKeyFiles(pconfig *Config) bool
- func RecvHeartBeatReq(pconfig *Config, preq *ss.MsgHeartBeatReq, from int)
- func RecvLoginRsp(pconfig *Config, prsp *ss.MsgLoginRsp)
- func RecvLogoutRsp(pconfig *Config, prsp *ss.MsgLogoutRsp)
- func RecvMsg(pconfig *Config) int64
- func RecvPingRsp(pconfig *Config, prsp *ss.MsgPingRsp)
- func RecvRegRsp(pconfig *Config, prsp *ss.MsgRegRsp)
- func RecvReportCmd(arg interface{})
- func ReportSyncServer(arg interface{})
- func SendHeartBeatMsg(arg interface{})
- func SendLoginReq(pconfig *Config, client_key int64, plogin_req *cs.CSLoginReq)
- func SendLogoutReq(pconfig *Config, uid int64, reason ss.USER_LOGOUT_REASON)
- func SendPingReq(pconfig *Config, client_key int64, pmsg *cs.CSPingReq)
- func SendRegReq(pconfig *Config, client_key int64, preq *cs.CSRegReq)
- func SendToClient(pconfig *Config, client_key int64, proto int, pmsg interface{}) bool
- func SendToLogic(pconfig *Config, pss_msg *ss.SSMsg) bool
- func SendToServ(pconfig *Config, target_serv int, pss_msg *ss.SSMsg) bool
- func ServerExit(pconfig *Config)
- func ServerStart(pconfig *Config)
- type Config
- type FileConfig
- type Msg
- type PkgBuff
- type ZlibEnv
Constants ¶
View Source
const (
MESSAGE_LEN = ss.MAX_SS_MSG_SIZE //200k
)
View Source
const (
RECV_PKG_LEN = comm.MAX_PKG_PER_RECV
)
Variables ¶
This section is empty.
Functions ¶
func AfterReLoadConfig ¶
func AfterReLoadConfig(pconfig *Config, old_config *FileConfig, new_config *FileConfig)
After ReLoad Config If Need Handle
func CloseClient ¶
server close connection positively
func GetClientKey ¶
Get ClientKey By Uid @Return:0 not exist; else ClientKey
func GetClientUid ¶
Get Uid By ClientKey @Return:0 not exist; else ClientKey
func HandleClientPkg ¶
C-->S Decode and Handle Msg
func HandleReportCmd ¶
func ReadClients ¶
func ReadRsaKeyFiles ¶
read rsa key files if enc_type==NET_ENCRYPPT_RSA
func RecvHeartBeatReq ¶
func RecvHeartBeatReq(pconfig *Config, preq *ss.MsgHeartBeatReq, from int)
func RecvLoginRsp ¶
func RecvLoginRsp(pconfig *Config, prsp *ss.MsgLoginRsp)
func RecvLogoutRsp ¶
func RecvLogoutRsp(pconfig *Config, prsp *ss.MsgLogoutRsp)
func RecvPingRsp ¶
func RecvPingRsp(pconfig *Config, prsp *ss.MsgPingRsp)
func RecvRegRsp ¶
func RecvReportCmd ¶
func RecvReportCmd(arg interface{})
func ReportSyncServer ¶
func ReportSyncServer(arg interface{})
func SendHeartBeatMsg ¶
func SendHeartBeatMsg(arg interface{})
func SendLoginReq ¶
func SendLoginReq(pconfig *Config, client_key int64, plogin_req *cs.CSLoginReq)
func SendLogoutReq ¶
func SendLogoutReq(pconfig *Config, uid int64, reason ss.USER_LOGOUT_REASON)
func SendToClient ¶
Encode And Send to Client * @proto: cs proto * @pmsg : msg from cs.Proto2Msg
func ServerExit ¶
func ServerExit(pconfig *Config)
Types ¶
type Config ¶
type Config struct { //comm NameSpace string ProcId int ProcName string ConfigFile string Daemon bool FileConfig *FileConfig Comm *comm.CommConfig ReportCmd string //used for report cmd ReportCmdToken int64 ReportServ *comm.ReportServ //report to manger //local TcpServ *comm.TcpServ Ckey2Uid map[int64]int64 //client key to uid. used for search login user Uid2Ckey map[int64]int64 //uid to client key. used for login user RsaPubKey []byte RsaPriKey []byte }
type FileConfig ¶
type FileConfig struct { //ProcName string `json:"proc_name"` LogicServ int `json:"logic_serv"` LogFile string `json:"log_file"` MaxConn int `json:"max_conn"` ListenAddr string `json:"listen_addr"` ManageAddr []string `json:"manage_addr"` ZlibOn int `json:"zlib_on"` //json compessed by zlib ValidConn int8 `json:"valid_conn"` //valid connection by key EncType int8 `json:"enc_type"` //encrypt type 0:no 1:des-ecb 2:aes-cbc-128 3:rsa+des /* rsa private and public key files method: * create private_key: openssl genrsa -out rsa_private_key.pem 1024 * create public_key: openssl rsa -in rsa_private_key.pem -pubout -out rsa_pubblic_key.pem */ RsaPubFile string `json:"rsa_pub_key_file"` //rsa public key file if EncType=3 RsaPriFile string `json:"rsa_pri_key_file"` //rsa private key file if EncType=3 MonitorInv int `json:"monitor_inv"` //monitor interval seconds }
Click to show internal directories.
Click to hide internal directories.