1
This commit is contained in:
parent
af57c99077
commit
b9b0a4a199
@ -36,12 +36,11 @@ type RiskMgr struct {
|
|||||||
func (this* RiskMgr) Init() *RiskMgr {
|
func (this* RiskMgr) Init() *RiskMgr {
|
||||||
this.fixedBlockProvinceCityHashMutex.Lock()
|
this.fixedBlockProvinceCityHashMutex.Lock()
|
||||||
defer this.fixedBlockProvinceCityHashMutex.Unlock()
|
defer this.fixedBlockProvinceCityHashMutex.Unlock()
|
||||||
|
|
||||||
this.fixedBlockProvinceCityHash = make(map[string]int32)
|
this.fixedBlockProvinceCityHash = make(map[string]int32)
|
||||||
|
|
||||||
for _, val := range G.MetaMgr.GetFixedBlockProvinceCity().GetList() {
|
for _, val := range G.MetaMgr.GetFixedBlockProvinceCity().GetList() {
|
||||||
this.fixedBlockProvinceCityHash[val] = 1
|
this.fixedBlockProvinceCityHash[val] = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
this.accessKeyId = G.MetaMgr.GetAliKey().GetAccessKeyid()
|
this.accessKeyId = G.MetaMgr.GetAliKey().GetAccessKeyid()
|
||||||
this.accessSecret = G.MetaMgr.GetAliKey().GetAccessSecret()
|
this.accessSecret = G.MetaMgr.GetAliKey().GetAccessSecret()
|
||||||
this.clusterConf = G.MetaMgr.GetCurrServer()
|
this.clusterConf = G.MetaMgr.GetCurrServer()
|
||||||
@ -68,14 +67,6 @@ func (this* RiskMgr) OutputLog() {
|
|||||||
f5.SysLog().Info("blockobj %s", this.GetBlockObj().ToJsonStr())
|
f5.SysLog().Info("blockobj %s", this.GetBlockObj().ToJsonStr())
|
||||||
atomic.StoreInt64(&this.passTimes, 0)
|
atomic.StoreInt64(&this.passTimes, 0)
|
||||||
atomic.StoreInt64(&this.blockTimes, 0)
|
atomic.StoreInt64(&this.blockTimes, 0)
|
||||||
/*atomic.StoreInt64(&this.ipWhiteListPassTimes, 0)
|
|
||||||
atomic.StoreInt64(&this.launchWhiteListPassTimes, 0)
|
|
||||||
atomic.StoreInt64(&this.safeZonePassTimes, 0)
|
|
||||||
atomic.StoreInt64(&this.httpMethodBlockTimes, 0)
|
|
||||||
atomic.StoreInt64(&this.sessionErrBlockTimes, 0)
|
|
||||||
atomic.StoreInt64(&this.ipBlackListBlockTimes, 0)
|
|
||||||
atomic.StoreInt64(&this.launchBlackListBlockTimes, 0)
|
|
||||||
atomic.StoreInt64(&this.unSafeZoneBlockTimes, 0)*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* RiskMgr) GetSdkInfo(accessKeyId* string, accessSecret* string) {
|
func (this* RiskMgr) GetSdkInfo(accessKeyId* string, accessSecret* string) {
|
||||||
@ -119,6 +110,10 @@ func (this *RiskMgr) GetGameConf(gameId int32, channel int32) *GameConf {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RiskMgr) GetGameConfEx(gameId int32, channel int32) *GameConf {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) {
|
func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) {
|
||||||
var gameConf *GameConf
|
var gameConf *GameConf
|
||||||
responseStr := ""
|
responseStr := ""
|
||||||
@ -182,38 +177,14 @@ func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *RiskMgr) __opsDump(w* http.ResponseWriter, r *http.Request) {
|
func (this *RiskMgr) __opsDump(w* http.ResponseWriter, r *http.Request) {
|
||||||
/*this.ipWhiteListMutex.Lock()
|
gameId := q5.Request(r, "gameid").GetInt32()
|
||||||
this.ipBlackListMutex.Lock()
|
channel := q5.Request(r, "channel").GetInt32()
|
||||||
this.launchWhiteListMutex.Lock()
|
gameConf := this.GetGameConf(gameId, channel)
|
||||||
this.launchBlackListMutex.Lock()
|
if gameConf == nil {
|
||||||
this.blockProvinceCityHashMutex.Lock()
|
q5.ResponseErr(w, 1, "数据不存在")
|
||||||
this.fixedBlockProvinceCityHashMutex.Lock()
|
return
|
||||||
defer this.ipWhiteListMutex.Unlock()
|
|
||||||
defer this.ipBlackListMutex.Unlock()
|
|
||||||
defer this.launchWhiteListMutex.Unlock()
|
|
||||||
defer this.launchBlackListMutex.Unlock()
|
|
||||||
defer this.blockProvinceCityHashMutex.Unlock()
|
|
||||||
defer this.fixedBlockProvinceCityHashMutex.Unlock()
|
|
||||||
|
|
||||||
fillRespObj := func(respObj* q5.MutableXObject, attrName string, mapObj* map[string]int32) {
|
|
||||||
list := q5.NewMxoArray()
|
|
||||||
for key, _ := range *mapObj {
|
|
||||||
list.PushXValue(q5.NewXString(key))
|
|
||||||
}
|
}
|
||||||
respObj.SetXObject(attrName, list.AsXObject())
|
q5.Response(w, gameConf.Dump().ToJsonStr())
|
||||||
}
|
|
||||||
|
|
||||||
respObj := q5.NewMxoObject()
|
|
||||||
respObj.SetXValue("errcode", q5.NewXInt32(0))
|
|
||||||
respObj.SetXValue("errmsg", q5.NewXString(""))
|
|
||||||
fillRespObj(respObj, "ip_white_list", &this.ipWhiteList)
|
|
||||||
fillRespObj(respObj, "ip_black_list", &this.ipBlackList)
|
|
||||||
fillRespObj(respObj, "launch_white_list", &this.launchWhiteList)
|
|
||||||
fillRespObj(respObj, "launch_black_list", &this.launchBlackList)
|
|
||||||
fillRespObj(respObj, "block_province_city_list", &this.blockProvinceCityHash)
|
|
||||||
fillRespObj(respObj, "fixed_block_province_city_list", &this.fixedBlockProvinceCityHash)
|
|
||||||
q5.Response(w, respObj.ToJsonStr())
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *RiskMgr) __opsSyncConf(w* http.ResponseWriter, r *http.Request) {
|
func (this *RiskMgr) __opsSyncConf(w* http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -194,3 +194,37 @@ func (this* GameConf) IsSafeZone(ip string, response_str* string) bool {
|
|||||||
*response_str = q5.EncodeJson(response)
|
*response_str = q5.EncodeJson(response)
|
||||||
return !this.IsBlockZone(response.Country, response.Province, response.City)
|
return !this.IsBlockZone(response.Country, response.Province, response.City)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this* GameConf) Dump() *q5.MutableXObject {
|
||||||
|
this.ipWhiteListMutex.Lock()
|
||||||
|
this.ipBlackListMutex.Lock()
|
||||||
|
this.launchWhiteListMutex.Lock()
|
||||||
|
this.launchBlackListMutex.Lock()
|
||||||
|
this.blockProvinceCityHashMutex.Lock()
|
||||||
|
//this.fixedBlockProvinceCityHashMutex.Lock()
|
||||||
|
defer this.ipWhiteListMutex.Unlock()
|
||||||
|
defer this.ipBlackListMutex.Unlock()
|
||||||
|
defer this.launchWhiteListMutex.Unlock()
|
||||||
|
defer this.launchBlackListMutex.Unlock()
|
||||||
|
defer this.blockProvinceCityHashMutex.Unlock()
|
||||||
|
//defer this.fixedBlockProvinceCityHashMutex.Unlock()
|
||||||
|
|
||||||
|
fillRespObj := func(respObj* q5.MutableXObject, attrName string, mapObj* map[string]int32) {
|
||||||
|
list := q5.NewMxoArray()
|
||||||
|
for key, _ := range *mapObj {
|
||||||
|
list.PushXValue(q5.NewXString(key))
|
||||||
|
}
|
||||||
|
respObj.SetXObject(attrName, list.AsXObject())
|
||||||
|
}
|
||||||
|
|
||||||
|
respObj := q5.NewMxoObject()
|
||||||
|
respObj.SetXValue("errcode", q5.NewXInt32(0))
|
||||||
|
respObj.SetXValue("errmsg", q5.NewXString(""))
|
||||||
|
fillRespObj(respObj, "ip_white_list", &this.ipWhiteList)
|
||||||
|
fillRespObj(respObj, "ip_black_list", &this.ipBlackList)
|
||||||
|
fillRespObj(respObj, "launch_white_list", &this.launchWhiteList)
|
||||||
|
fillRespObj(respObj, "launch_black_list", &this.launchBlackList)
|
||||||
|
fillRespObj(respObj, "block_province_city_list", &this.blockProvinceCityHash)
|
||||||
|
//fillRespObj(respObj, "fixed_block_province_city_list", &this.fixedBlockProvinceCityHash)
|
||||||
|
return respObj
|
||||||
|
}
|
||||||
|
2
third_party/q5
vendored
2
third_party/q5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 1e70d9f8938d42dfff11538792c4aa5bf9045ba1
|
Subproject commit 56027b3c56267df69521b43612e2fab8650163a0
|
Loading…
x
Reference in New Issue
Block a user