修改ip pool策略

This commit is contained in:
bjdgyc 2023-04-21 10:17:51 +08:00
parent 690b4460ad
commit cc5aff08ad
2 changed files with 8 additions and 5 deletions

View File

@ -168,7 +168,7 @@ func AcquireIp(username, macAddr string, uniqueMac bool) net.IP {
}
// 记录循环点
var loopMin = IpPool.IpLongMin
var loopCurIp = IpPool.IpLongMin
func loopIp(username, macAddr string, uniqueMac bool) net.IP {
var (
@ -176,15 +176,15 @@ func loopIp(username, macAddr string, uniqueMac bool) net.IP {
ip net.IP
)
i, ip = loopLong(loopMin, IpPool.IpLongMax, username, macAddr, uniqueMac)
i, ip = loopLong(loopCurIp, IpPool.IpLongMax, username, macAddr, uniqueMac)
if ip != nil {
loopMin = i + 1
loopCurIp = i
return ip
}
i, ip = loopLong(IpPool.IpLongMin, loopMin, username, macAddr, uniqueMac)
i, ip = loopLong(IpPool.IpLongMin, loopCurIp, username, macAddr, uniqueMac)
if ip != nil {
loopMin = i + 1
loopCurIp = i
return ip
}

View File

@ -11,5 +11,8 @@ Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/anylink-deploy/anylink --conf=/usr/local/anylink-deploy/conf/server.toml
StandardOutput=file:/usr/local/anylink-deploy/log/anylink.log
StandardError=file:/usr/local/anylink-deploy/log/anylink.log
[Install]
WantedBy=multi-user.target