Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PasarGuard/node
/ isPortFree
Function
isPortFree
pkg/netutil/port.go:9–16 ·
view source on GitHub ↗
(port int)
Source
from the content-addressed store, hash-verified
7
)
8
9
func
isPortFree(port int) bool {
10
ln, err := net.Listen(
"tcp"
, fmt.Sprintf(
":%d"
, port))
11
if
err != nil {
12
return
false
13
}
14
_ = ln.Close()
15
return
true
16
}
17
18
func
FindFreePort() int {
19
var
apiPort int
Callers
1
FindFreePort
Function · 0.85
Calls
1
Close
Method · 0.65
Tested by
no test coverage detected