API: Add user IPs and access times tracking#4347
Conversation
|
could you add a method to get all online users by one single request, |
|
@ImMohammad20000 yes, I will make this functionality, but first I would like to see if this request is accepted from me. |
yuhan6665
left a comment
There was a problem hiding this comment.
Thanks for your PR, please take a look at the comment
app/stats/online_map.go
Outdated
| return list | ||
| } | ||
|
|
||
| func (c *OnlineMap) IpTimeMap() map[string]int64 { |
There was a problem hiding this comment.
I think you should just return the ipList map[string]time.Time
then convert the time.Time to standard google.protobuf.Timestamp
There was a problem hiding this comment.
Hmm, that is, to return not seconds, but a timestamp from the last online session without reference to 20 seconds of cleaning?
There was a problem hiding this comment.
Right just return raw values, caller can do convert as they need
…elated gRPC response.
|
@yuhan6665 check it please, thanks. |
|
Looks good! Thanks again |
|
@yuhan6665 I love doing this for this project and the community! |
|
合并这个 PR 后 且 protoc 和 protoc-gen-go 应与 main 一致,4582930 会被我 force 掉,请重开一个 PR |
|
@RPRX Could you tell me if I understood correctly, I need to place google/protobuf/timestamp.proto in the project and then everything will be fine? |
|
@mr1cloud 应该是这样 |
|
@mr1cloud 或者你直接把内容复制进现有 proto |
|
@RPRX thank you! I'll fix it now. |
Added IpTimeMap method, GetStatsOnlineIpList RPC and CLI command for tracking client IPs and access times.
Execute:
Result:
{ "ips": { "192.168.1.2": 13 }, "name": "user>>>user1>>>online" }Maybe this functionality will come in handy.