File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -169,10 +169,24 @@ void NodeModel::ConnectToNumConnectionsChangedSignal()
169
169
170
170
bool NodeModel::validateProxyAddress (QString address_port)
171
171
{
172
- return m_node.validateProxyAddress (address_port.toStdString ());
172
+ uint16_t port{0 };
173
+ std::string addr_port{address_port.toStdString ()};
174
+ std::string hostname;
175
+ // First, attempt to split the input address into hostname and port components.
176
+ // We call SplitHostPort to validate that a port is provided in addr_port.
177
+ // If either splitting fails or port is zero (not specified), return false.
178
+ if (!SplitHostPort (addr_port, port, hostname) || !port) return false ;
179
+
180
+ // Create a service endpoint (CService) from the address and port.
181
+ // If port is missing in addr_port, DEFAULT_PROXY_PORT is used as the fallback.
182
+ CService serv (LookupNumeric (addr_port, DEFAULT_PROXY_PORT));
183
+
184
+ // Construct the Proxy with the service endpoint and return if it's valid
185
+ Proxy addrProxy = Proxy (serv, true );
186
+ return addrProxy.IsValid ();
173
187
}
174
188
175
189
QString NodeModel::defaultProxyAddress ()
176
190
{
177
- return QString::fromStdString (m_node. defaultProxyAddress ( ));
191
+ return QString::fromStdString (std::string (DEFAULT_PROXY_HOST) + " : " + util::ToString (DEFAULT_PROXY_PORT ));
178
192
}
Original file line number Diff line number Diff line change 14
14
#include < QObject>
15
15
#include < QString>
16
16
17
+ const char DEFAULT_PROXY_HOST[] = " 127.0.0.1" ;
18
+ constexpr uint16_t DEFAULT_PROXY_PORT = 9050 ;
19
+
17
20
QT_BEGIN_NAMESPACE
18
21
class QTimerEvent ;
19
22
QT_END_NAMESPACE
You can’t perform that action at this time.
0 commit comments