improve: 为 linux 添加可靠的网卡绑定
This commit is contained in:
@@ -38,7 +38,7 @@ func Guardian() {
|
||||
if e == nil {
|
||||
for _, eth := range interfaces {
|
||||
log.Debugf("使用 %s 网口登录 ", eth.Name)
|
||||
e = Login(eth.Addr, true)
|
||||
e = Login(ð, true)
|
||||
if e != nil {
|
||||
log.Errorln("网口 ", eth.Name+" 登录出错: ", e)
|
||||
}
|
||||
|
||||
@@ -6,15 +6,14 @@ import (
|
||||
"github.com/Mmx233/BitSrunLoginGo/pkg/srun"
|
||||
"github.com/Mmx233/BitSrunLoginGo/tools"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Login 登录逻辑
|
||||
func Login(localAddr net.Addr, debugOutput bool) error {
|
||||
func Login(eth *tools.Eth, debugOutput bool) error {
|
||||
// 登录状态检查
|
||||
|
||||
httpClient := tools.HttpPackSelect(localAddr).Client
|
||||
httpClient := tools.HttpPackSelect(eth).Client
|
||||
conf := &srun.Conf{
|
||||
Https: global.Config.Settings.Basic.Https,
|
||||
LoginInfo: srun.LoginInfo{
|
||||
@@ -38,12 +37,6 @@ func Login(localAddr net.Addr, debugOutput bool) error {
|
||||
return e
|
||||
}
|
||||
|
||||
if localAddr != nil && global.Config.Settings.Basic.UseDhcpIP {
|
||||
ip = localAddr.(*net.TCPAddr).IP.String()
|
||||
} else if global.Flags.ClientIP != "" {
|
||||
ip = global.Flags.ClientIP
|
||||
}
|
||||
|
||||
log.Debugln("认证客户端 ip: ", ip)
|
||||
|
||||
// 登录执行
|
||||
|
||||
Reference in New Issue
Block a user