improve: 为 linux 添加可靠的网卡绑定

This commit is contained in:
Mmx233
2023-06-01 10:02:53 +08:00
parent bcb840560c
commit b0b0f2d6a7
8 changed files with 84 additions and 38 deletions

View File

@@ -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)
// 登录执行