lib

package
v0.0.0-...-4345fab Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

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

func CloseClient(pconfig *Config, client_key int64) bool

server close connection positively

func CommSet

func CommSet(pconfig *Config) bool

Comm Config Setting

func GetClientKey

func GetClientKey(pconfig *Config, uid int64) int64

Get ClientKey By Uid @Return:0 not exist; else ClientKey

func GetClientUid

func GetClientUid(pconfig *Config, c_key int64) int64

Get Uid By ClientKey @Return:0 not exist; else ClientKey

func HandleClientPkg

func HandleClientPkg(pconfig *Config, pclient *comm.ClientPkg)

C-->S Decode and Handle Msg

func HandleReportCmd

func HandleReportCmd(pconfig *Config, pmsg *comm.ReportMsg)

func LocalSet

func LocalSet(pconfig *Config) bool

Local Proc Setting

func NotifyLoad

func NotifyLoad(arg interface{})

ratio = int(valid_conn/max_conn * 100); if ratio<=30 load=0; if ratio>30 load=ratio

func ReadClients

func ReadClients(pconfig *Config) int64

func ReadRsaKeyFiles

func ReadRsaKeyFiles(pconfig *Config) bool

read rsa key files if enc_type==NET_ENCRYPPT_RSA

func RecvApplyGroupNotify

func RecvApplyGroupNotify(pconfig *Config, pnotify *ss.MsgApplyGroupNotify)

func RecvApplyGroupRsp

func RecvApplyGroupRsp(pconfig *Config, prsp *ss.MsgApplyGroupRsp)

func RecvChgGroupAttrRsp

func RecvChgGroupAttrRsp(pconfig *Config, prsp *ss.MsgChgGroupAttrRsp)

func RecvCommonNotify

func RecvCommonNotify(pconfig *Config, pnotify *ss.MsgCommonNotify)

func RecvCreateGroupRsp

func RecvCreateGroupRsp(pconfig *Config, prsp *ss.MsgCreateGrpRsp)

func RecvExitGroupRsp

func RecvExitGroupRsp(pconfig *Config, prsp *ss.MsgExitGroupRsp)

func RecvFetchUserProfileRsp

func RecvFetchUserProfileRsp(pconfig *Config, prsp *ss.MsgFetchUserProfileRsp)

func RecvGroupGroundRsp

func RecvGroupGroundRsp(pconfig *Config, prsp *ss.MsgGroupGroudRsp)

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 RecvMsg

func RecvMsg(pconfig *Config) int64

func RecvPingRsp

func RecvPingRsp(pconfig *Config, prsp *ss.MsgPingRsp)

func RecvRegRsp

func RecvRegRsp(pconfig *Config, prsp *ss.MsgRegRsp)

func RecvReportCmd

func RecvReportCmd(arg interface{})

func RecvSendChatRsp

func RecvSendChatRsp(pconfig *Config, prsp *ss.MsgSendChatRsp)

func RecvSyncChatList

func RecvSyncChatList(pconfig *Config, prsp *ss.MsgSyncChatList)

func RecvSyncGroupInfo

func RecvSyncGroupInfo(pconfig *Config, pinfo *ss.MsgSyncGroupInfo)

func RecvUpdateChatRsp

func RecvUpdateChatRsp(pconfig *Config, prsp *ss.MsgUpdateChatRsp)

func RecvUpdateUserRsp

func RecvUpdateUserRsp(pconfig *Config, prsp *ss.MsgUpdateUserRsp)

func ReportSyncServer

func ReportSyncServer(arg interface{})

func SendApplyGroupAudit

func SendApplyGroupAudit(pconfig *Config, uid int64, paudit *cs.CSApplyGroupAudit)

func SendApplyGroupReq

func SendApplyGroupReq(pconfig *Config, uid int64, preq *cs.CSApplyGroupReq) bool

Apply Group

func SendChgGroupAttrReq

func SendChgGroupAttrReq(pconfig *Config, uid int64, pchg *cs.CSChgGroupAttrReq)

func SendCommonQuery

func SendCommonQuery(pconfig *Config, uid int64, pquery *cs.CSCommonQuery)

func SendCreateGroupReq

func SendCreateGroupReq(pconfig *Config, uid int64, preq *cs.CSCreateGroupReq) bool

func SendExitGroupReq

func SendExitGroupReq(pconfig *Config, uid int64, pexit *cs.CSExitGroupReq)

func SendFetchChatHistroyReq

func SendFetchChatHistroyReq(pconfig *Config, uid int64, pfetch *cs.CSChatHistoryReq)

func SendFetchUserProfileReq

func SendFetchUserProfileReq(pconfig *Config, uid int64, pfetch *cs.CSFetchUserProfileReq)

func SendGroupGroundReq

func SendGroupGroundReq(pconfig *Config, uid int64, pcs *cs.CSGroupGroundReq)

func SendHeartBeatMsg

func SendHeartBeatMsg(arg interface{})

func SendKickGroupReq

func SendKickGroupReq(pconfig *Config, uid int64, pkick *cs.CSKickGroupReq)

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 SendPingReq

func SendPingReq(pconfig *Config, client_key int64, pmsg *cs.CSPingReq)

func SendQueryGroupReq

func SendQueryGroupReq(pconfig *Config, uid int64, pquery *cs.CSQueryGroupReq)

func SendRegReq

func SendRegReq(pconfig *Config, client_key int64, preq *cs.CSRegReq)

func SendSendChatReq

func SendSendChatReq(pconfig *Config, uid int64, psend *cs.CSSendChatReq)

func SendToClient

func SendToClient(pconfig *Config, client_key int64, proto int, pmsg interface{}) bool

Encode And Send to Client * @proto: cs proto * @pmsg : msg from cs.Proto2Msg

func SendToLogic

func SendToLogic(pconfig *Config, pss_msg *ss.SSMsg) bool

send to logic server

func SendToServ

func SendToServ(pconfig *Config, target_serv int, pss_msg *ss.SSMsg) bool

func SendUpdateChatReq

func SendUpdateChatReq(pconfig *Config, uid int64, pcs *cs.CSUpdateChatReq)

func SendUpdateUserReq

func SendUpdateUserReq(pconfig *Config, uid int64, pupdate *cs.CSUpdateUserReq)

func ServerExit

func ServerExit(pconfig *Config)

func ServerStart

func ServerStart(pconfig *Config)

Main Proc

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_public_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
}

type Msg

type Msg struct {
	// contains filtered or unexported fields
}

type PkgBuff

type PkgBuff struct {
	// contains filtered or unexported fields
}

type ZlibEnv

type ZlibEnv struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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