mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-29 19:22:04 +08:00
feat: 增加端口检测 优化删除逻辑
This commit is contained in:
committed by
zhengkunwang223
parent
c3274af4cd
commit
000c475626
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user