isPortAvailable checks if a specific port is available on the system
(port uint32)
| 1135 | |
| 1136 | // isPortAvailable checks if a specific port is available on the system |
| 1137 | func isPortAvailable(port uint32) bool { |
| 1138 | listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) |
| 1139 | if err != nil { |
| 1140 | return false |
| 1141 | } |
| 1142 | defer listener.Close() |
| 1143 | return true |
| 1144 | } |
| 1145 | |
| 1146 | // EnsureAvailablePorts checks if the proxy and DNS ports are available. |
| 1147 | // If they are available, it returns them unchanged. |
no test coverage detected