mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-25 11:55:54 +00:00
37 lines
No EOL
1 KiB
C++
37 lines
No EOL
1 KiB
C++
// SPDX-License-Identifier: BSD-3-Clause
|
|
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
|
|
|
|
#include "NetworkManager.h"
|
|
|
|
#include <QCoreApplication>
|
|
#include <QNetworkProxy>
|
|
|
|
QNetworkAccessManager *g_networkManagerTor = nullptr;
|
|
QNetworkAccessManager *g_networkManagerClearnet = nullptr;
|
|
|
|
QNetworkAccessManager* getNetworkTor()
|
|
{
|
|
if (!g_networkManagerTor) {
|
|
g_networkManagerTor = new QNetworkAccessManager(QCoreApplication::instance());
|
|
QNetworkProxy proxy;
|
|
proxy.setType(QNetworkProxy::Socks5Proxy);
|
|
proxy.setHostName("127.0.0.1");
|
|
proxy.setPort(9050);
|
|
g_networkManagerTor->setProxy(proxy);
|
|
}
|
|
return g_networkManagerTor;
|
|
}
|
|
|
|
QNetworkAccessManager* getNetworkClearnet()
|
|
{
|
|
if (!g_networkManagerClearnet) {
|
|
g_networkManagerClearnet = new QNetworkAccessManager(QCoreApplication::instance());
|
|
}
|
|
return g_networkManagerClearnet;
|
|
}
|
|
|
|
//void setTorProxy(const QNetworkProxy &proxy)
|
|
//{
|
|
// QNetworkAccessManager *network = getNetworkTor();
|
|
// network->setProxy(proxy);
|
|
//}
|