API: Add user IPs and access times tracking#4360
Conversation
… IPs and access times.
…elated gRPC response.
…nd_grpc.pb.go. Added google timestamp.proto
|
应当把它放在 command 文件夹下面并把 metadata 改为 Xray 的,还有这个文件复制进来没有 license 问题吧 |
|
你改好后,这个 PR 我来合并(时机成熟时,现在 main 在搞 MMDF) |
|
Guys please don't copy protobuf code in project. |
|
@yuhan6665 I did that last time, but my PR was canceled: #4347 |
|
可以换成自定义的结构吗?不引用外部 proto |
|
Yes, i can do it. I'll just say it again, @yuhan6665 told me to use google protobuf, so that's what I did... |
|
Please don't define your own timestamp, use protobuf version, properly. |
|
@yuhan6665 like I did last time, right? #4347 |
|
我不太了解 proto 这里是怎么回事 那如果引用外部 proto,执行 |
|
@RPRX It turns out that it is... |
|
所以 google standard timestamp 有什么特别的好处吗?我们不是只需要 timestamp 的值而已? |
|
Initially, I just did the display in seconds, but I was told to use google timestamp. I did so, everything was accepted, but there was a rollback due to the lack of file data during execution: |
|
我想了解下 @yuhan6665 的看法,或许这里我们只是需要一个值? |
|
如果需要先拉下来外部 proto 就比较难受了,我经常 |
|
Using google protobuf is not rocket science, I'm sure we (whoever run into issue) can fix it. |
|
既然没有特别的需求,直接拿个 uint64 存 timestamp 吧 |
|
So I'm just returning the timestamp in uint64? |
|
timestamp轻松加愉快为什么要搞个这个东西进来 |
|
No no, I'll just return the timestamp (uint64), okey? |
|
|
@mr1cloud just uint64 |
…d update related code to use uint64 for IP timestamps.
|
Okay, I think that's it. Execute: Result: {
"ips": {
"192.168.1.2": 1738924438
},
"name": "user>>>user1>>>online"
}
|
|
改成 int64 吧,不用转换类型了 |
|
Does anyone know why I can't get user IPs and access times tracking? |
the result is the same, still can't get data from “statsonline” or “statsonlineiplist” |
|
@fluxx365 could you attach which version of the core you are using?
|
this one |
|
@fluxx365 If the client has not connected once since the core was launched, then it will be written that it was not found, this is a feature of the statistics service, it does not download the user until he is connected. |
|
And 127.0.0.1 will not count, I must use LAN IP during test((((( |
|
is there something wrong with my config? |
|
@fluxx365 Oh, you need to add example: "policy": {
"levels": {
"0": {
"statsUserDownlink": true,
"statsUserOnline": true,
"statsUserUplink": true
}
},
"system": {
"statsInboundDownlink": true,
"statsInboundUplink": true
}
} |
thank you very much, now it appears |
|
@mr1cloud thank you for the nice feature! Had the same issue |
Hmm, maybe yes, but all the other CLI functions don't provide this information. That is, I just matched the style of the other developers. Maybe I didn't quite understand what you mean. |




Added IpTimeMap method, GetStatsOnlineIpList RPC and CLI command for tracking client IPs and access times.
Execute:
Result:
{ "ips": { "192.168.1.2": { "seconds": "1738845962", "nanos": 572060848 } }, "name": "user>>>user1>>>online" }New PR after corrections from #4347