diff --git a/pkg/nathole/analysis.go b/pkg/nathole/analysis.go index 75f9a55c..eb44d6d9 100644 --- a/pkg/nathole/analysis.go +++ b/pkg/nathole/analysis.go @@ -224,7 +224,7 @@ func (mhr *MakeHoleRecords) ReportSuccess(mode int, index int) { } score.Score += 2 - score.Score = lo.Min([]int{score.Score, 10}) + score.Score = min(score.Score, 10) return } } diff --git a/pkg/nathole/controller.go b/pkg/nathole/controller.go index dd134abe..03c05b35 100644 --- a/pkg/nathole/controller.go +++ b/pkg/nathole/controller.go @@ -317,7 +317,7 @@ func (c *Controller) analysis(session *Session) (*msg.NatHoleResp, *msg.NatHoleR session.cBehavior = cBehavior 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 { timeoutMs += 30000 } @@ -384,8 +384,8 @@ func getRangePorts(addrs []string, difference, maxNumber int) []msg.PortsRange { return nil } ports = append(ports, msg.PortsRange{ - From: lo.Max([]int{port - difference - 5, port - maxNumber, 1}), - To: lo.Min([]int{port + difference + 5, port + maxNumber, 65535}), + From: max(port-difference-5, port-maxNumber, 1), + To: min(port+difference+5, port+maxNumber, 65535), }) return ports }