mirror of
https://github.com/InazumaV/Ratte.git
synced 2026-02-04 12:40:12 +00:00
fix: node name, report user
This commit is contained in:
@@ -53,6 +53,7 @@ func (h *Handler) PullNodeHandle(n *panel.NodeInfo) error {
|
|||||||
ni.Limit.IPLimit = number.SelectBigger(ni.Limit.IPLimit, h.Limit.IPLimit)
|
ni.Limit.IPLimit = number.SelectBigger(ni.Limit.IPLimit, h.Limit.IPLimit)
|
||||||
ni.Limit.SpeedLimit = number.SelectBigger(ni.Limit.SpeedLimit, uint64(h.Limit.SpeedLimit))
|
ni.Limit.SpeedLimit = number.SelectBigger(ni.Limit.SpeedLimit, uint64(h.Limit.SpeedLimit))
|
||||||
err := h.c.AddNode(&core.AddNodeParams{
|
err := h.c.AddNode(&core.AddNodeParams{
|
||||||
|
Name: h.nodeName,
|
||||||
NodeInfo: ni,
|
NodeInfo: ni,
|
||||||
TlsOptions: core.TlsOptions{
|
TlsOptions: core.TlsOptions{
|
||||||
CertPath: h.Cert.CertPath,
|
CertPath: h.Cert.CertPath,
|
||||||
|
|||||||
@@ -80,8 +80,20 @@ func (h *Handler) ReportUserHandle(id int) error {
|
|||||||
if rsp.Up == 0 && rsp.Down == 0 {
|
if rsp.Up == 0 && rsp.Down == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
users = append(users, panel.UserTrafficInfo{
|
||||||
|
Id: v.Id,
|
||||||
|
Name: v.Name,
|
||||||
|
Upload: rsp.Up,
|
||||||
|
Download: rsp.Down,
|
||||||
|
})
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("get user traffic error: %w", err)
|
||||||
|
}
|
||||||
|
if len(users) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
err = h.p.ReportUserTraffic(&panel.ReportUserTrafficParams{
|
err = h.p.ReportUserTraffic(&panel.ReportUserTrafficParams{
|
||||||
Id: id,
|
Id: id,
|
||||||
Users: users,
|
Users: users,
|
||||||
|
|||||||
Reference in New Issue
Block a user