mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
gui: Fix proxy details display in Options Dialog
- Ensured that the proxy IP is displayed correctly in the UI when using an IPv6 address. No functionality impact; changes only affect UI display.
This commit is contained in:
parent
0c4ff18ee9
commit
fee4cba484
1 changed files with 9 additions and 4 deletions
|
@ -320,10 +320,15 @@ static ProxySetting ParseProxyString(const QString& proxy)
|
||||||
if (proxy.isEmpty()) {
|
if (proxy.isEmpty()) {
|
||||||
return default_val;
|
return default_val;
|
||||||
}
|
}
|
||||||
// contains IP at index 0 and port at index 1
|
uint16_t port{0};
|
||||||
QStringList ip_port = GUIUtil::SplitSkipEmptyParts(proxy, ":");
|
std::string hostname;
|
||||||
if (ip_port.size() == 2) {
|
if (SplitHostPort(proxy.toStdString(), port, hostname) && port != 0) {
|
||||||
return {true, ip_port.at(0), ip_port.at(1)};
|
// Valid and port within the valid range
|
||||||
|
// Check if the hostname contains a colon, indicating an IPv6 address
|
||||||
|
if (hostname.find(':') != std::string::npos) {
|
||||||
|
hostname = "[" + hostname + "]"; // Wrap IPv6 address in brackets
|
||||||
|
}
|
||||||
|
return {true, QString::fromStdString(hostname), QString::number(port)};
|
||||||
} else { // Invalid: return default
|
} else { // Invalid: return default
|
||||||
return default_val;
|
return default_val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue