From 089502eb5283faf1d98d7b8ae70cf94db79fa517 Mon Sep 17 00:00:00 2001 From: 7TEN7 <7TEN7@qq.com> Date: Sat, 6 Mar 2021 01:13:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20-p=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=9C=A8=E6=9F=90=E4=BA=9B=E6=83=85=E5=86=B5=E4=B8=8B=E4=BB=A5?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E6=8C=87=E5=AE=9A=E7=AB=AF=E5=8F=A3=E6=97=B6?= =?UTF-8?q?(=E5=A6=82=20-p=208000-10000)=E8=A7=A3=E6=9E=90=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/ParsePort.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/common/ParsePort.go b/common/ParsePort.go index 10fc292..c8e4645 100644 --- a/common/ParsePort.go +++ b/common/ParsePort.go @@ -1,7 +1,6 @@ package common import ( - "sort" "strconv" "strings" ) @@ -17,9 +16,17 @@ func ParsePort(ports string) []int { if len(ranges) < 2 { continue } - sort.Strings(ranges) - port = ranges[0] - upper = ranges[1] + + startPort, _ := strconv.Atoi(ranges[0]) + endPort, _ := strconv.Atoi(ranges[1]) + if startPort < endPort { + port = ranges[0] + upper = ranges[1] + } else { + port = ranges[1] + upper = ranges[0] + } + } start, _ := strconv.Atoi(port) end, _ := strconv.Atoi(upper)