mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
support HTTP304 for get user list
This commit is contained in:
parent
aeb8554b13
commit
c48c9c65ab
13
node/task.go
13
node/task.go
@ -69,6 +69,9 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
}
|
}
|
||||||
if newNodeInfo != nil {
|
if newNodeInfo != nil {
|
||||||
// nodeInfo changed
|
// nodeInfo changed
|
||||||
|
if newUserInfo != nil {
|
||||||
|
c.userList = newUserInfo
|
||||||
|
}
|
||||||
c.traffic = make(map[string]int64)
|
c.traffic = make(map[string]int64)
|
||||||
// Remove old tag
|
// Remove old tag
|
||||||
log.WithField("tag", c.tag).Info("Node changed, reload")
|
log.WithField("tag", c.tag).Info("Node changed, reload")
|
||||||
@ -84,7 +87,7 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
limiter.DeleteLimiter(c.tag)
|
limiter.DeleteLimiter(c.tag)
|
||||||
// Add new Limiter
|
// Add new Limiter
|
||||||
c.tag = c.buildNodeTag(newNodeInfo)
|
c.tag = c.buildNodeTag(newNodeInfo)
|
||||||
l := limiter.AddLimiter(c.tag, &c.LimitConfig, newUserInfo)
|
l := limiter.AddLimiter(c.tag, &c.LimitConfig, c.userList)
|
||||||
// check cert
|
// check cert
|
||||||
if newNodeInfo.Tls || newNodeInfo.Type == "hysteria" {
|
if newNodeInfo.Tls || newNodeInfo.Type == "hysteria" {
|
||||||
err = c.requestCert()
|
err = c.requestCert()
|
||||||
@ -108,7 +111,7 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
_, err = c.server.AddUsers(&vCore.AddUsersParams{
|
_, err = c.server.AddUsers(&vCore.AddUsersParams{
|
||||||
Tag: c.tag,
|
Tag: c.tag,
|
||||||
Config: c.ControllerConfig,
|
Config: c.ControllerConfig,
|
||||||
UserInfo: newUserInfo,
|
UserInfo: c.userList,
|
||||||
NodeInfo: newNodeInfo,
|
NodeInfo: newNodeInfo,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -140,13 +143,15 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
c.userReportPeriodic.Close()
|
c.userReportPeriodic.Close()
|
||||||
_ = c.userReportPeriodic.Start(false)
|
_ = c.userReportPeriodic.Start(false)
|
||||||
}
|
}
|
||||||
c.userList = newUserInfo
|
log.WithField("tag", c.tag).Infof("Added %d new users", len(c.userList))
|
||||||
log.WithField("tag", c.tag).Infof("Added %d new users", len(newUserInfo))
|
|
||||||
// exit
|
// exit
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// node no changed, check users
|
// node no changed, check users
|
||||||
|
if len(newUserInfo) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
deleted, added := compareUserList(c.userList, newUserInfo)
|
deleted, added := compareUserList(c.userList, newUserInfo)
|
||||||
if len(deleted) > 0 {
|
if len(deleted) > 0 {
|
||||||
// have deleted users
|
// have deleted users
|
||||||
|
Loading…
Reference in New Issue
Block a user