feat: 重构配置层,添加 json 支持
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/Mmx233/BitSrunLoginGo/internal/global"
|
||||
"github.com/Mmx233/BitSrunLoginGo/internal/config"
|
||||
"time"
|
||||
|
||||
"github.com/Mmx233/BitSrunLoginGo/tools"
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
func Guardian() {
|
||||
log.Infoln("[以守护模式启动]")
|
||||
|
||||
GuardianDuration := time.Duration(global.Config.Settings.Guardian.Duration) * time.Second
|
||||
GuardianDuration := time.Duration(config.Settings.Guardian.Duration) * time.Second
|
||||
|
||||
var c = make(chan bool)
|
||||
for {
|
||||
@@ -20,13 +20,13 @@ func Guardian() {
|
||||
defer func() {
|
||||
_ = recover()
|
||||
}()
|
||||
if global.Config.Settings.Basic.Interfaces == "" { //单网卡
|
||||
if config.Settings.Basic.Interfaces == "" { //单网卡
|
||||
e := Login(nil, true)
|
||||
if e != nil {
|
||||
log.Errorln("登录出错: ", e)
|
||||
}
|
||||
} else { //多网卡
|
||||
interfaces, e := tools.GetInterfaceAddr(global.Config.Settings.Basic.Interfaces)
|
||||
interfaces, e := tools.GetInterfaceAddr(config.Settings.Basic.Interfaces)
|
||||
if e == nil {
|
||||
for _, eth := range interfaces {
|
||||
log.Debugf("使用 %s 网口登录 ", eth.Name)
|
||||
|
||||
Reference in New Issue
Block a user