feat: 增加端口检测 优化删除逻辑

This commit is contained in:
zhengkunwang223
2022-10-08 15:03:29 +08:00
committed by zhengkunwang223
parent c3274af4cd
commit 000c475626
13 changed files with 185 additions and 87 deletions
+11
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"io"
mathRand "math/rand"
"net"
"regexp"
"strconv"
"strings"
@@ -60,3 +61,13 @@ func RandStr(n int) string {
}
return string(b)
}
func ScanPort(port string) bool {
ln, err := net.Listen("tcp", ":"+port)
if err != nil {
return true
}
defer ln.Close()
return false
}