流量汇报事件添加客户端ip和端口参数

This commit is contained in:
xiongziliang
2020-02-13 11:33:59 +08:00
parent ead8b5a89c
commit 7e25537957
11 changed files with 34 additions and 15 deletions

View File

@@ -269,13 +269,15 @@ void installWebHook(){
});
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastFlowReport,[](BroadcastFlowReportArgs){
if(!hook_enable || args._param_strs == hook_adminparams || hook_flowreport.empty()){
if(!hook_enable || args._param_strs == hook_adminparams || hook_flowreport.empty() || peerIP == "127.0.0.1"){
return;
}
auto body = make_json(args);
body["totalBytes"] = (Json::UInt64)totalBytes;
body["duration"] = (Json::UInt64)totalDuration;
body["player"] = isPlayer;
body["ip"] = peerIP;
body["port"] = peerPort;
//执行hook
do_http_hook(hook_flowreport,body, nullptr);
});