MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / isPortAvailable

Method isPortAvailable

internal/auth/codex/oauth_server.go:297–307  ·  view source on GitHub ↗

isPortAvailable checks if the specified port is available. It attempts to listen on the port to determine availability. Returns: - bool: True if the port is available, false otherwise

()

Source from the content-addressed store, hash-verified

295// Returns:
296// - bool: True if the port is available, false otherwise
297func (s *OAuthServer) isPortAvailable() bool {
298 addr := fmt.Sprintf(":%d", s.port)
299 listener, err := net.Listen("tcp", addr)
300 if err != nil {
301 return false
302 }
303 defer func() {
304 _ = listener.Close()
305 }()
306 return true
307}
308
309// IsRunning returns whether the server is currently running.
310//

Callers 1

StartMethod · 0.95

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected