MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ParseProxyString

Function ParseProxyString

src/qt/optionsmodel.cpp:314–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314static ProxySetting ParseProxyString(const QString& proxy)
315{
316 static const ProxySetting default_val = {false, DEFAULT_GUI_PROXY_HOST, QString("%1").arg(DEFAULT_GUI_PROXY_PORT)};
317 // Handle the case that the setting is not set at all
318 if (proxy.isEmpty()) {
319 return default_val;
320 }
321 uint16_t port{0};
322 std::string hostname;
323 if (SplitHostPort(proxy.toStdString(), port, hostname) && port != 0) {
324 // Valid and port within the valid range
325 // Check if the hostname contains a colon, indicating an IPv6 address
326 if (hostname.find(':') != std::string::npos) {
327 hostname = "[" + hostname + "]"; // Wrap IPv6 address in brackets
328 }
329 return {true, QString::fromStdString(hostname), QString::number(port)};
330 } else { // Invalid: return default
331 return default_val;
332 }
333}
334
335static ProxySetting ParseProxyString(const std::string& proxy)
336{

Callers 2

getOptionMethod · 0.85
checkAndMigrateMethod · 0.85

Calls 2

SplitHostPortFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected