lib

package
v0.0.0-...-0e6f1c7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 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 ReadClients

func ReadClients(pconfig *Config) int64

func ReadRsaKeyFiles

func ReadRsaKeyFiles(pconfig *Config) bool

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 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 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 SendPingReq

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

func SendRegReq

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

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

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