mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
commit
8167dad5ee
@ -16,7 +16,7 @@ func NewCore(c *conf.CoreConfig) (Core, error) {
|
||||
if types := strings.Split(c.Type, " "); len(types) > 1 {
|
||||
var cs []Core
|
||||
for _, t := range types {
|
||||
f, ok := cores[strings.ToLower(c.Type)]
|
||||
f, ok := cores[strings.ToLower(t)]
|
||||
if !ok {
|
||||
return nil, errors.New("unknown core type: " + t)
|
||||
}
|
||||
|
@ -3,12 +3,11 @@ package hy
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"github.com/Yuzuki616/hysteria/core/utils"
|
||||
rdns "github.com/folbricht/routedns"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/Yuzuki616/hysteria/core/utils"
|
||||
rdns "github.com/folbricht/routedns"
|
||||
)
|
||||
|
||||
var errInvalidSyntax = errors.New("invalid syntax")
|
||||
|
@ -80,6 +80,9 @@ func buildInbound(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, tag s
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("marshal reality dest error: %s", err)
|
||||
}
|
||||
if len(config.CertConfig.RealityConfig.ShortIds) == 0 {
|
||||
config.CertConfig.RealityConfig.ShortIds = []string{""}
|
||||
}
|
||||
in.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{
|
||||
Dest: d,
|
||||
Xver: config.CertConfig.RealityConfig.Xver,
|
||||
@ -99,6 +102,9 @@ func buildInbound(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, tag s
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("marshal reality dest error: %s", err)
|
||||
}
|
||||
if len(rc.ShortIds) == 0 {
|
||||
rc.ShortIds = []string{""}
|
||||
}
|
||||
Xver, _ := strconv.ParseUint(rc.Xver, 10, 64)
|
||||
MaxTimeDiff, _ := strconv.ParseUint(rc.Xver, 10, 64)
|
||||
in.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{
|
||||
|
@ -28,6 +28,7 @@ func (c *Controller) requestCert() error {
|
||||
if c.CertConfig.CertFile == "" || c.CertConfig.KeyFile == "" {
|
||||
return fmt.Errorf("cert file path or key file path not exist")
|
||||
}
|
||||
return nil
|
||||
case "dns", "http":
|
||||
if c.CertConfig.CertFile == "" || c.CertConfig.KeyFile == "" {
|
||||
return fmt.Errorf("cert file path or key file path not exist")
|
||||
|
@ -41,9 +41,9 @@ func (c *Controller) startTasks(node *panel.NodeInfo) {
|
||||
}
|
||||
if c.LimitConfig.EnableDynamicSpeedLimit {
|
||||
c.traffic = make(map[string]int64)
|
||||
c.renewCertPeriodic = &task.Task{
|
||||
Interval: time.Duration(c.LimitConfig.DynamicSpeedLimitConfig.Periodic) * time.Minute,
|
||||
Execute: c.reportUserTrafficTask,
|
||||
c.dynamicSpeedLimitPeriodic = &task.Task{
|
||||
Interval: time.Duration(c.LimitConfig.DynamicSpeedLimitConfig.Periodic) * time.Second,
|
||||
Execute: c.SpeedChecker,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controller) SpeedChecker() {
|
||||
func (c *Controller) SpeedChecker() error {
|
||||
for u, t := range c.traffic {
|
||||
if t >= c.LimitConfig.DynamicSpeedLimitConfig.Traffic {
|
||||
err := c.limiter.UpdateDynamicSpeedLimit(c.tag, u,
|
||||
@ -214,4 +214,5 @@ func (c *Controller) SpeedChecker() {
|
||||
delete(c.traffic, u)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user