| 234 | } |
| 235 | |
| 236 | std::optional<HostPort> parseTarget(const std::string& ipPort) |
| 237 | { |
| 238 | size_t colon = ipPort.find(':'); |
| 239 | if (colon == std::string::npos) { |
| 240 | return std::nullopt; |
| 241 | } |
| 242 | std::string ip = ipPort.substr(0, colon); |
| 243 | int port = atoi(ipPort.substr(colon + 1).c_str()); |
| 244 | if (ip.empty() || port <= 0 || port > 65535) { |
| 245 | return std::nullopt; |
| 246 | } |
| 247 | return HostPort{std::move(ip), (uint16_t)port}; |
| 248 | } |
| 249 | |
| 250 | bool validPin(const std::string& pin) |
| 251 | { |
no test coverage detected