fix: ip变量类型问题

This commit is contained in:
Mmx
2021-12-03 20:22:41 +08:00
parent 7490e8c385
commit 4ade00cb54
2 changed files with 5 additions and 2 deletions

View File

@@ -61,7 +61,7 @@ Config.json说明
},
"settings": {
"timeout": 1, //检查网络超时时间(秒)
"interfaces": "",//网卡名称正则eth0\.[2-3]
"interfaces": "",//网卡名称正则注意JSON转义eth0\\.[2-3]
"demo_mode": false, //测试模式,报错更详细,且生成运行日志与错误日志
"guardian": { //守护模式
"enable": false,

View File

@@ -30,7 +30,10 @@ func GetInterfaceAddr() ([]srunModels.Eth, error) {
if strings.Contains(ip.String(), ".") {
result = append(result, srunModels.Eth{
Name: eth.Name,
Addr: ip,
Addr: func() *net.TCPAddr {
n, _ := net.ResolveTCPAddr("tcp", ip.String())
return n
}(),
})
break
}