mirror of
https://gitee.com/IrisVega/frp.git
synced 2024-11-01 22:31:29 +08:00
use go built-in min & max functions to replace lo.Min and lo.Max (#4007)
This commit is contained in:
parent
adb04e81e7
commit
b6361fb143
@ -224,7 +224,7 @@ func (mhr *MakeHoleRecords) ReportSuccess(mode int, index int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
score.Score += 2
|
score.Score += 2
|
||||||
score.Score = lo.Min([]int{score.Score, 10})
|
score.Score = min(score.Score, 10)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ func (c *Controller) analysis(session *Session) (*msg.NatHoleResp, *msg.NatHoleR
|
|||||||
session.cBehavior = cBehavior
|
session.cBehavior = cBehavior
|
||||||
session.vBehavior = vBehavior
|
session.vBehavior = vBehavior
|
||||||
|
|
||||||
timeoutMs := lo.Max([]int{cBehavior.SendDelayMs, vBehavior.SendDelayMs}) + 5000
|
timeoutMs := max(cBehavior.SendDelayMs, vBehavior.SendDelayMs) + 5000
|
||||||
if cBehavior.ListenRandomPorts > 0 || vBehavior.ListenRandomPorts > 0 {
|
if cBehavior.ListenRandomPorts > 0 || vBehavior.ListenRandomPorts > 0 {
|
||||||
timeoutMs += 30000
|
timeoutMs += 30000
|
||||||
}
|
}
|
||||||
@ -384,8 +384,8 @@ func getRangePorts(addrs []string, difference, maxNumber int) []msg.PortsRange {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ports = append(ports, msg.PortsRange{
|
ports = append(ports, msg.PortsRange{
|
||||||
From: lo.Max([]int{port - difference - 5, port - maxNumber, 1}),
|
From: max(port-difference-5, port-maxNumber, 1),
|
||||||
To: lo.Min([]int{port + difference + 5, port + maxNumber, 65535}),
|
To: min(port+difference+5, port+maxNumber, 65535),
|
||||||
})
|
})
|
||||||
return ports
|
return ports
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user