fix old, fix config tag

This commit is contained in:
yuzuki999 2023-06-02 23:26:02 +08:00
parent 85bde00ded
commit f034bbd39b
3 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ import (
func TestConf_LoadFromPath(t *testing.T) {
c := New()
t.Log(c.LoadFromPath("../example/config.yml.example"), c.NodesConfig[0].ControllerConfig.LimitConfig.IPLimit)
t.Log(c.LoadFromPath("../example/config.yml.example"), c.NodesConfig[0].ControllerConfig.EnableXtls)
}
func TestConf_Watch(t *testing.T) {

View File

@ -20,7 +20,7 @@ type ControllerConfig struct {
EnableDNS bool `yaml:"EnableDNS"`
DNSType string `yaml:"DNSType"`
EnableVless bool `yaml:"EnableVless"`
EnableXtls bool `json:"EnableXtls"`
EnableXtls bool `yaml:"EnableXtls"`
LimitConfig LimitConfig `yaml:"LimitConfig"`
DisableUploadTraffic bool `yaml:"DisableUploadTraffic"`
DisableGetRule bool `yaml:"DisableGetRule"`

View File

@ -48,7 +48,7 @@ func migrateOldConfig(c *Conf, old *OldConfig) {
break
}
// node option
if !old.NodesConfig[i].ApiConfig.EnableVless {
if old.NodesConfig[i].ApiConfig.EnableVless {
n.ControllerConfig.EnableVless = true
changed = true
}
@ -61,7 +61,7 @@ func migrateOldConfig(c *Conf, old *OldConfig) {
n.ControllerConfig.LimitConfig.IPLimit = old.NodesConfig[i].ApiConfig.DeviceLimit
changed = true
}
if !old.NodesConfig[i].ControllerConfig.EnableDynamicSpeedLimit {
if old.NodesConfig[i].ControllerConfig.EnableDynamicSpeedLimit {
n.ControllerConfig.LimitConfig.EnableDynamicSpeedLimit = true
changed = true
}
@ -70,7 +70,7 @@ func migrateOldConfig(c *Conf, old *OldConfig) {
old.NodesConfig[i].ControllerConfig.DynamicSpeedLimitConfig
changed = true
}
if !old.NodesConfig[i].ControllerConfig.EnableIpRecorder {
if old.NodesConfig[i].ControllerConfig.EnableIpRecorder {
n.ControllerConfig.LimitConfig.EnableIpRecorder = true
changed = true
}