| 208 | } |
| 209 | |
| 210 | std::optional<HostPort> parseTarget(const std::string& ipPort) |
| 211 | { |
| 212 | size_t colon = ipPort.find(':'); |
| 213 | if (colon == std::string::npos) { |
| 214 | return std::nullopt; |
| 215 | } |
| 216 | std::string ip = ipPort.substr(0, colon); |
| 217 | int port = atoi(ipPort.substr(colon + 1).c_str()); |
| 218 | if (ip.empty() || port <= 0 || port > 65535) { |
| 219 | return std::nullopt; |
| 220 | } |
| 221 | return HostPort{std::move(ip), (uint16_t)port}; |
| 222 | } |
| 223 | |
| 224 | bool validPin(const std::string& pin) |
| 225 | { |
no test coverage detected