MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / parseTarget

Function parseTarget

common/transferprotocol.cpp:236–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 4

parseTargetMethod · 0.85
startTransferSendMethod · 0.85
parseTargetMethod · 0.85
startTransferSendMethod · 0.85

Calls 2

findMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected