This commit is contained in:
aozhiwei 2020-11-03 19:23:21 +08:00
parent 84bf1a5669
commit a1345b6af1

View File

@ -2,6 +2,7 @@ package main
import ( import (
"net/http" "net/http"
"fmt"
"sync" "sync"
"sync/atomic" "sync/atomic"
"github.com/aliyun/alibaba-cloud-sdk-go/services/geoip" "github.com/aliyun/alibaba-cloud-sdk-go/services/geoip"
@ -296,13 +297,27 @@ func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) {
if isPass() { if isPass() {
atomic.AddInt64(&this.totalPassTimes, 1) atomic.AddInt64(&this.totalPassTimes, 1)
atomic.AddInt64(&this.passTimes, 1) atomic.AddInt64(&this.passTimes, 1)
if this.clusterConf.GetTesting() == 1 {
data := fmt.Sprintf(`{"errcode":0, "errmsg":"", "is_open":%d, "data":%s}`,
1,
response_str)
q5.Response(w, data)
} else {
q5.ResponseInt32Ok(w, "is_open", 1) q5.ResponseInt32Ok(w, "is_open", 1)
}
} else { } else {
atomic.AddInt64(&this.totalBlockTimes, 1) atomic.AddInt64(&this.totalBlockTimes, 1)
atomic.AddInt64(&this.blockTimes, 1) atomic.AddInt64(&this.blockTimes, 1)
if this.clusterConf.GetTesting() == 1 {
data := fmt.Sprintf(`{"errcode":0, "errmsg":"", "is_open":%d, "data":%s}`,
0,
response_str)
q5.Response(w, data)
} else {
q5.ResponseInt32Ok(w, "is_open", 0) q5.ResponseInt32Ok(w, "is_open", 0)
} }
} }
}
func (this *RiskMgr) __opsDump(w* http.ResponseWriter, r *http.Request) { func (this *RiskMgr) __opsDump(w* http.ResponseWriter, r *http.Request) {
this.ipWhiteListMutex.Lock() this.ipWhiteListMutex.Lock()