| 183 | } |
| 184 | |
| 185 | std::optional<HostPort> parseTarget(const std::string& ipPort) |
| 186 | { |
| 187 | size_t colon = ipPort.find(':'); |
| 188 | if (colon == std::string::npos) { |
| 189 | return std::nullopt; |
| 190 | } |
| 191 | std::string ip = ipPort.substr(0, colon); |
| 192 | int port = atoi(ipPort.substr(colon + 1).c_str()); |
| 193 | if (ip.empty() || port <= 0 || port > 65535) { |
| 194 | return std::nullopt; |
| 195 | } |
| 196 | return HostPort{std::move(ip), (uint16_t)port}; |
| 197 | } |
| 198 | |
| 199 | bool validPin(const std::string& pin) |
| 200 | { |
no test coverage detected