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

Function parseTarget

common/transferprotocol.cpp:185–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

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