Files
BitSrunLoginGo/cmd/bitsrun/main.go

37 lines
1016 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"github.com/Mmx233/BitSrunLoginGo/internal/config"
"github.com/Mmx233/BitSrunLoginGo/internal/controllers"
"github.com/Mmx233/BitSrunLoginGo/tools"
)
func main() {
if config.Settings.Guardian.Enable {
//进入守护模式
controllers.Guardian()
} else {
//登录流程
var err error
logger := config.Logger
if config.Settings.Basic.Interfaces == "" { //单网卡
if err = controllers.Login(nil, false); err != nil {
logger.Errorln("登录出错: ", err)
if !config.Settings.Log.DebugLevel {
logger.Infoln("开启调试日志debug_level获取详细信息")
}
return
}
} else { //多网卡
logger.Infoln("多网卡模式")
interfaces, _ := tools.GetInterfaceAddr(logger, config.Settings.Basic.Interfaces)
for _, eth := range interfaces {
logger.Infoln("使用网卡: ", eth.Name)
if err = controllers.Login(&eth, false); err != nil {
config.Logger.Errorf("网卡 %s 登录出错: %v", eth.Name, err)
}
}
}
}
}