MCPcopy Create free account
hub / github.com/PasarGuard/node / FindFreePort

Function FindFreePort

pkg/netutil/port.go:18–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16}
17
18func FindFreePort() int {
19 var apiPort int
20 for apiPort = rand.Intn(50000) + 10000; apiPort < 65536; apiPort++ {
21 if isPortFree(apiPort) {
22 break
23 }
24 }
25 return apiPort
26}

Callers 4

NewFunction · 0.92
DisconnectMethod · 0.92
TestXrayBackendFunction · 0.92

Calls 1

isPortFreeFunction · 0.85

Tested by 2

TestXrayBackendFunction · 0.74