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

Function parseTarget

common/transferprotocol.cpp:210–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

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