mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 12:40:11 +00:00
fix some bugs
support ip limit for hy
This commit is contained in:
@@ -3,14 +3,13 @@ package node
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/Yuzuki616/V2bX/api/iprecoder"
|
||||
"github.com/Yuzuki616/V2bX/api/panel"
|
||||
"github.com/Yuzuki616/V2bX/common/task"
|
||||
"github.com/Yuzuki616/V2bX/conf"
|
||||
vCore "github.com/Yuzuki616/V2bX/core"
|
||||
"github.com/Yuzuki616/V2bX/limiter"
|
||||
"github.com/xtls/xray-core/common/task"
|
||||
"log"
|
||||
)
|
||||
|
||||
type Controller struct {
|
||||
@@ -20,11 +19,11 @@ type Controller struct {
|
||||
Tag string
|
||||
userList []panel.UserInfo
|
||||
ipRecorder iprecoder.IpRecorder
|
||||
nodeInfoMonitorPeriodic *task.Periodic
|
||||
userReportPeriodic *task.Periodic
|
||||
renewCertPeriodic *task.Periodic
|
||||
dynamicSpeedLimitPeriodic *task.Periodic
|
||||
onlineIpReportPeriodic *task.Periodic
|
||||
nodeInfoMonitorPeriodic *task.Task
|
||||
userReportPeriodic *task.Task
|
||||
renewCertPeriodic *task.Task
|
||||
dynamicSpeedLimitPeriodic *task.Task
|
||||
onlineIpReportPeriodic *task.Task
|
||||
*conf.ControllerConfig
|
||||
}
|
||||
|
||||
@@ -93,38 +92,23 @@ func (c *Controller) Start() error {
|
||||
func (c *Controller) Close() error {
|
||||
limiter.DeleteLimiter(c.Tag)
|
||||
if c.nodeInfoMonitorPeriodic != nil {
|
||||
err := c.nodeInfoMonitorPeriodic.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("node info periodic close error: %s", err)
|
||||
}
|
||||
c.nodeInfoMonitorPeriodic.Close()
|
||||
}
|
||||
if c.nodeInfoMonitorPeriodic != nil {
|
||||
err := c.userReportPeriodic.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("user report periodic close error: %s", err)
|
||||
}
|
||||
if c.userReportPeriodic != nil {
|
||||
c.userReportPeriodic.Close()
|
||||
}
|
||||
if c.renewCertPeriodic != nil {
|
||||
err := c.renewCertPeriodic.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("renew cert periodic close error: %s", err)
|
||||
}
|
||||
c.renewCertPeriodic.Close()
|
||||
}
|
||||
if c.dynamicSpeedLimitPeriodic != nil {
|
||||
err := c.dynamicSpeedLimitPeriodic.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("dynamic speed limit periodic close error: %s", err)
|
||||
}
|
||||
c.dynamicSpeedLimitPeriodic.Close()
|
||||
}
|
||||
if c.onlineIpReportPeriodic != nil {
|
||||
err := c.onlineIpReportPeriodic.Close()
|
||||
if err != nil {
|
||||
return fmt.Errorf("online ip report periodic close error: %s", err)
|
||||
}
|
||||
c.onlineIpReportPeriodic.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controller) buildNodeTag() string {
|
||||
return fmt.Sprintf("%s_%s_%d", c.nodeInfo.Type, c.ListenIP, c.nodeInfo.Id)
|
||||
return fmt.Sprintf("%s-%s-%d", c.apiClient.APIHost, c.nodeInfo.Type, c.nodeInfo.Id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user