1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-27 12:35:21 -05:00

stats counter for inbound traffic

This commit is contained in:
Darien Raymond
2018-04-12 00:10:14 +02:00
parent 3e8da9e540
commit c76d492c0f
12 changed files with 285 additions and 92 deletions

View File

@@ -395,10 +395,16 @@ func TestCommanderStats(t *testing.T) {
},
},
},
System: &policy.SystemPolicy{
Stats: &policy.SystemPolicy_Stats{
InboundUplink: true,
},
},
}),
},
Inbound: []*core.InboundHandlerConfig{
{
Tag: "vmess",
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
PortRange: net.SinglePortRange(serverPort),
Listen: net.NewIPOrDomain(net.LocalHostIP),
@@ -521,5 +527,12 @@ func TestCommanderStats(t *testing.T) {
assert(sresp.Stat.Name, Equals, name)
assert(sresp.Stat.Value, Equals, int64(0))
sresp, err = sClient.GetStats(context.Background(), &statscmd.GetStatsRequest{
Name: "inbound>>>vmess>>>traffic>>>uplink",
Reset_: true,
})
assert(err, IsNil)
assert(sresp.Stat.Value, Equals, int64(10240*1024))
CloseAllServers(servers)
}