This commit is contained in:
aozhiwei 2021-01-07 15:36:38 +08:00
parent 4a4e11896c
commit 1978be72df

View File

@ -40,7 +40,6 @@ func (this* RiskMgr) Init() *RiskMgr {
this.clusterConf = G.MetaMgr.GetCurrServer()
G.HttpServer.RegisterHandle("Analyse", "isOpen", this._analyseIsOpen)
G.HttpServer.RegisterHandle("Ops", "dump", this._opsDump)
G.HttpServer.RegisterHandle("Ops", "syncConf", this._opsSyncConf)
G.HttpServer.RegisterHandle("Ops", "info", this._opsInfo)
f5.Timer().AddRepeatTimer(1000 * 60,
@ -96,6 +95,8 @@ func (this* RiskMgr) GetGlobalPassObj() *q5.XObject {
passObj := q5.NewMxoObject()
passObj.SetXValue("total", q5.NewXInt64(this.totalPassTimes))
passObj.SetXValue("curr", q5.NewXInt64(this.passTimes))
passObj.SetXValue("total_ip_whitelist", q5.NewXInt64(this.totalIpWhiteListPassTimes))
passObj.SetXValue("curr_ip_whitelist", q5.NewXInt64(this.ipWhiteListPassTimes))
return passObj.AsXObject()
}
@ -103,6 +104,8 @@ func (this* RiskMgr) GetGlobalBlockObj() *q5.XObject {
blockObj := q5.NewMxoObject()
blockObj.SetXValue("total", q5.NewXInt64(this.totalBlockTimes))
blockObj.SetXValue("curr", q5.NewXInt64(this.blockTimes))
blockObj.SetXValue("total_ip_blacklist", q5.NewXInt64(this.totalIpBlackListBlockTimes))
blockObj.SetXValue("curr_ip_blacklist", q5.NewXInt64(this.ipBlackListBlockTimes))
blockObj.SetXValue("total_methoderr", q5.NewXInt64(this.totalHttpMethodBlockTimes))
blockObj.SetXValue("curr_methoderr", q5.NewXInt64(this.httpMethodBlockTimes))
blockObj.SetXValue("total_sessonerr", q5.NewXInt64(this.totalSessionErrBlockTimes))
@ -222,18 +225,6 @@ func (this *RiskMgr) _analyseIsOpen(c *f5.Context) {
}
}
func (this *RiskMgr) _opsDump(c *f5.Context) {
gameId := c.Request("gameid").GetInt32()
channel := c.Request("channel").GetInt32()
gameConf := this.GetGameConf(gameId, channel)
if gameConf == nil {
c.ResponseErr(1, "数据不存在")
return
}
gameConf.Active()
//c.Response(gameConf.Dump().ToJsonStr())
}
func (this *RiskMgr) _opsSyncConf(c *f5.Context) {
gameId := c.Request("gameid").GetInt32()
channel := c.Request("channel").GetInt32()
@ -254,27 +245,8 @@ func (this *RiskMgr) _opsInfo(c *f5.Context) {
respObj := q5.NewMxoObject()
respObj.SetXValue("errcode", q5.NewXInt32(0))
respObj.SetXValue("errmsg", q5.NewXString(""))
{
passObj := q5.NewMxoObject()
passObj.SetXValue("total", q5.NewXInt64(this.totalPassTimes))
respObj.SetXValue("curr", q5.NewXInt64(this.passTimes))
respObj.SetXValue("total_ip_whitelist", q5.NewXInt64(this.totalIpWhiteListPassTimes))
respObj.SetXValue("curr_ip_whitelist", q5.NewXInt64(this.ipWhiteListPassTimes))
respObj.SetXObject("pass", passObj.AsXObject())
}
{
blockObj := q5.NewMxoObject()
respObj.SetXValue("total", q5.NewXInt64(this.totalBlockTimes))
respObj.SetXValue("curr", q5.NewXInt64(this.blockTimes))
respObj.SetXValue("total_ip_blacklist", q5.NewXInt64(this.totalIpBlackListBlockTimes))
respObj.SetXValue("curr_ip_blacklist", q5.NewXInt64(this.ipBlackListBlockTimes))
respObj.SetXValue("total_http_method", q5.NewXInt64(this.totalHttpMethodBlockTimes))
respObj.SetXValue("http_method", q5.NewXInt64(this.httpMethodBlockTimes))
respObj.SetXObject("block", blockObj.AsXObject())
}
respObj.SetXValue("errcode", q5.NewXInt64(this.totalSessionErrBlockTimes))
respObj.SetXValue("errcode", q5.NewXInt64(this.totalSessionErrBlockTimes))
respObj.SetXObject("global_pass", this.GetGlobalPassObj())
respObj.SetXObject("global_block", this.GetGlobalBlockObj())
gameList := q5.NewMxoArray()
for _, gameConf := range this.fetchGameConfList() {
gameConf.Active()