mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-28 19:40:31 -05:00
removed RETROTOR #ifdef and started using RsAccounts::isTorAuto() instead. Unfinished yet.
This commit is contained in:
parent
0f758902cd
commit
d1a375cbd0
13 changed files with 294 additions and 270 deletions
|
|
@ -195,10 +195,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
|||
ui.nodeType_CB->setCurrentIndex(1);
|
||||
ui.nodeType_CB->setEnabled(false);
|
||||
#endif
|
||||
#ifdef RETROTOR
|
||||
ui.adv_checkbox->setChecked(false);
|
||||
ui.adv_checkbox->setVisible(true);
|
||||
#endif
|
||||
//#ifdef RETROTOR
|
||||
// ui.adv_checkbox->setChecked(false);
|
||||
// ui.adv_checkbox->setVisible(true);
|
||||
//#endif
|
||||
|
||||
initKeyList();
|
||||
setupState();
|
||||
|
|
@ -258,12 +258,7 @@ void GenCertDialog::mouseMoveEvent(QMouseEvent *e)
|
|||
void GenCertDialog::setupState()
|
||||
{
|
||||
bool adv_state = ui.adv_checkbox->isChecked();
|
||||
|
||||
#ifdef RETROTOR
|
||||
bool retrotor = true ;
|
||||
#else
|
||||
bool retrotor = false ;
|
||||
#endif
|
||||
|
||||
if(!adv_state)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,12 +84,13 @@
|
|||
#include "statusbar/ToasterDisable.h"
|
||||
#include "statusbar/SysTrayStatus.h"
|
||||
#include "statusbar/torstatus.h"
|
||||
#include <retroshare/rsstatus.h>
|
||||
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include "retroshare/rsstatus.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "retroshare/rsnotify.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
#include "gui/gxschannels/GxsChannelDialog.h"
|
||||
#include "gui/gxsforums/GxsForumsDialog.h"
|
||||
|
|
@ -250,14 +251,15 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
|||
|
||||
if(hiddenmode)
|
||||
{
|
||||
#ifdef RETROTOR
|
||||
torstatus = new TorStatus();
|
||||
torstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowTor", QVariant(true)).toBool());
|
||||
statusBar()->addWidget(torstatus);
|
||||
torstatus->getTorStatus();
|
||||
#else
|
||||
torstatus = NULL ;
|
||||
#endif
|
||||
if(RsAccounts::isHiddenNode())
|
||||
{
|
||||
torstatus = new TorStatus();
|
||||
torstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowTor", QVariant(true)).toBool());
|
||||
statusBar()->addWidget(torstatus);
|
||||
torstatus->getTorStatus();
|
||||
}
|
||||
else
|
||||
torstatus = NULL ;
|
||||
|
||||
natstatus = NULL ;
|
||||
dhtstatus = NULL ;
|
||||
|
|
|
|||
|
|
@ -29,11 +29,12 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <retroshare/rsbanlist.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
#include <retroshare/rsdht.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include "retroshare/rsbanlist.h"
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "retroshare/rsdht.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsturtle.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QMovie>
|
||||
|
|
@ -62,15 +63,6 @@
|
|||
///
|
||||
|
||||
// Tabs numbers *after* non relevant tabs are removed. So do not use them to add/remove tabs!!
|
||||
#ifdef RETROTOR
|
||||
static const uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0;
|
||||
static const uint32_t TAB_HIDDEN_SERVICE_INCOMING = 1;
|
||||
|
||||
static const uint32_t TAB_NETWORK = 0;
|
||||
static const uint32_t TAB_HIDDEN_SERVICE = 1;
|
||||
static const uint32_t TAB_IP_FILTERS = 99; // This is a trick: these tabs do not exist, so enabling/disabling them has no effect
|
||||
static const uint32_t TAB_RELAYS = 99;
|
||||
#else
|
||||
const static uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0;
|
||||
const static uint32_t TAB_HIDDEN_SERVICE_INCOMING = 2;
|
||||
|
||||
|
|
@ -78,7 +70,6 @@ const static uint32_t TAB_NETWORK = 0;
|
|||
const static uint32_t TAB_IP_FILTERS = 1;
|
||||
const static uint32_t TAB_HIDDEN_SERVICE = 2;
|
||||
const static uint32_t TAB_RELAYS = 3;
|
||||
#endif
|
||||
|
||||
//#define SERVER_DEBUG 1
|
||||
|
||||
|
|
@ -90,7 +81,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
|
||||
manager = NULL ;
|
||||
|
||||
#ifdef RETROTOR
|
||||
if(RsAccounts::isTorAuto())
|
||||
{
|
||||
// Here we use absolute numbers instead of consts defined above, because the consts correspond to the tab number *after* this tab removal.
|
||||
|
||||
ui.tabWidget->removeTab(3) ; // remove relays. Not useful in Tor mode.
|
||||
|
|
@ -109,7 +101,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
|
||||
ui.hiddenpage_outHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ;
|
||||
ui.hiddenpage_inHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_RANGE,new QTableWidgetItem(tr("IP Range"))) ;
|
||||
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_STATUS,new QTableWidgetItem(tr("Status"))) ;
|
||||
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_ORIGIN,new QTableWidgetItem(tr("Origin"))) ;
|
||||
|
|
|
|||
|
|
@ -187,9 +187,7 @@ public:
|
|||
/** Sets whether the bandwidth graph is always on top. */
|
||||
void setBWGraphAlwaysOnTop(bool alwaysOnTop);
|
||||
|
||||
#ifdef RETROTOR
|
||||
void setHiddenServiceKey() ;
|
||||
#endif
|
||||
|
||||
uint getNewsFeedFlags();
|
||||
void setNewsFeedFlags(uint flags);
|
||||
|
|
|
|||
|
|
@ -26,12 +26,11 @@
|
|||
#include <QPixmap>
|
||||
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
#ifdef RETROTOR
|
||||
#include "TorControl/TorManager.h"
|
||||
#include "TorControl/TorControl.h"
|
||||
#endif
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
|
|
@ -86,53 +85,56 @@ void TorStatus::getTorStatus()
|
|||
|
||||
int S = QFontMetricsF(torstatusLabel->font()).height();
|
||||
|
||||
#ifdef RETROTOR
|
||||
// get Tor status
|
||||
int tor_control_status = Tor::TorManager::instance()->control()->status();
|
||||
int torstatus = Tor::TorManager::instance()->control()->torStatus();
|
||||
|
||||
QString tor_control_status_str,torstatus_str ;
|
||||
bool tor_control_ok ;
|
||||
|
||||
switch(tor_control_status)
|
||||
if(RsAccounts::isTorAuto())
|
||||
{
|
||||
default:
|
||||
case Tor::TorControl::Error : tor_control_ok = false ; tor_control_status_str = "Error" ; break ;
|
||||
case Tor::TorControl::NotConnected: tor_control_ok = false ; tor_control_status_str = "Not connected" ; break ;
|
||||
case Tor::TorControl::Connecting: tor_control_ok = false ; tor_control_status_str = "Connecting" ; break ;
|
||||
case Tor::TorControl::Authenticating: tor_control_ok = false ; tor_control_status_str = "Authenticating" ; break ;
|
||||
case Tor::TorControl::Connected: tor_control_ok = true ; tor_control_status_str = "Connected" ; break ;
|
||||
}
|
||||
// get Tor status
|
||||
int tor_control_status = Tor::TorManager::instance()->control()->status();
|
||||
int torstatus = Tor::TorManager::instance()->control()->torStatus();
|
||||
|
||||
switch(torstatus)
|
||||
{
|
||||
default:
|
||||
case Tor::TorControl::TorUnknown: torstatus_str = "Unknown" ; break ;
|
||||
case Tor::TorControl::TorOffline: torstatus_str = "Tor offline" ; break ;
|
||||
case Tor::TorControl::TorReady: torstatus_str = "Tor ready" ; break ;
|
||||
}
|
||||
QString tor_control_status_str,torstatus_str ;
|
||||
bool tor_control_ok ;
|
||||
|
||||
switch(tor_control_status)
|
||||
{
|
||||
default:
|
||||
case Tor::TorControl::Error : tor_control_ok = false ; tor_control_status_str = "Error" ; break ;
|
||||
case Tor::TorControl::NotConnected: tor_control_ok = false ; tor_control_status_str = "Not connected" ; break ;
|
||||
case Tor::TorControl::Connecting: tor_control_ok = false ; tor_control_status_str = "Connecting" ; break ;
|
||||
case Tor::TorControl::Authenticating: tor_control_ok = false ; tor_control_status_str = "Authenticating" ; break ;
|
||||
case Tor::TorControl::Connected: tor_control_ok = true ; tor_control_status_str = "Connected" ; break ;
|
||||
}
|
||||
|
||||
switch(torstatus)
|
||||
{
|
||||
default:
|
||||
case Tor::TorControl::TorUnknown: torstatus_str = "Unknown" ; break ;
|
||||
case Tor::TorControl::TorOffline: torstatus_str = "Tor offline" ; break ;
|
||||
case Tor::TorControl::TorReady: torstatus_str = "Tor ready" ; break ;
|
||||
}
|
||||
|
||||
#define MIN_RS_NET_SIZE 10
|
||||
|
||||
if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok)
|
||||
if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok)
|
||||
{
|
||||
// RED - some issue.
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setToolTip( text + tr("Tor is currently offline"));
|
||||
}
|
||||
else if(torstatus == Tor::TorControl::TorReady && online && tor_control_ok)
|
||||
{
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/tor-on.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setToolTip( text + tr("Tor is OK"));
|
||||
}
|
||||
else // torstatus == Tor::TorControl::TorUnknown
|
||||
{
|
||||
// GRAY.
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/no-tor.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setToolTip( text + tr("No tor configuration"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// RED - some issue.
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setToolTip( text + tr("Tor is currently offline"));
|
||||
}
|
||||
else if(torstatus == Tor::TorControl::TorReady && online && tor_control_ok)
|
||||
{
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/tor-on.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setToolTip( text + tr("Tor is OK"));
|
||||
}
|
||||
else // torstatus == Tor::TorControl::TorUnknown
|
||||
{
|
||||
// GRAY.
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/no-tor.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setToolTip( text + tr("No tor configuration"));
|
||||
}
|
||||
#else
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setToolTip( text + tr("Tor is currently offline"));
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,10 +51,8 @@
|
|||
# include "gui/settings/WebuiPage.h"
|
||||
#endif
|
||||
|
||||
#ifdef RETROTOR
|
||||
# include "TorControl/TorManager.h"
|
||||
# include "TorControl/TorControlWindow.h"
|
||||
#endif
|
||||
#include "TorControl/TorManager.h"
|
||||
#include "TorControl/TorControlWindow.h"
|
||||
|
||||
#include "retroshare/rsidentity.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
|
|
@ -355,8 +353,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||
|
||||
RsAccounts::getCurrentAccountOptions(is_hidden_node,is_auto_tor,is_first_time);
|
||||
|
||||
#ifdef UNFINISHED
|
||||
if(RsAccounts::AccountType() == RS_ACCOUNT_TYPE_HIDDEN_TOR_AUTO)
|
||||
if(is_auto_tor)
|
||||
{
|
||||
// Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service
|
||||
|
||||
|
|
@ -402,7 +399,6 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/);
|
||||
|
||||
|
|
@ -418,33 +414,35 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef RETROTOR
|
||||
// Tor works with viable hidden service. Let's use it!
|
||||
if(is_auto_tor)
|
||||
{
|
||||
// Tor works with viable hidden service. Let's use it!
|
||||
|
||||
QString service_id ;
|
||||
QString onion_address ;
|
||||
uint16_t service_port ;
|
||||
uint16_t service_target_port ;
|
||||
uint16_t proxy_server_port ;
|
||||
QHostAddress service_target_address ;
|
||||
QHostAddress proxy_server_address ;
|
||||
QString service_id ;
|
||||
QString onion_address ;
|
||||
uint16_t service_port ;
|
||||
uint16_t service_target_port ;
|
||||
uint16_t proxy_server_port ;
|
||||
QHostAddress service_target_address ;
|
||||
QHostAddress proxy_server_address ;
|
||||
|
||||
torManager->getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port);
|
||||
torManager->getProxyServerInfo(proxy_server_address,proxy_server_port) ;
|
||||
Tor::TorManager *torManager = Tor::TorManager::instance();
|
||||
torManager->getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port);
|
||||
torManager->getProxyServerInfo(proxy_server_address,proxy_server_port) ;
|
||||
|
||||
std::cerr << "Got hidden service info: " << std::endl;
|
||||
std::cerr << " onion address : " << onion_address.toStdString() << std::endl;
|
||||
std::cerr << " service_id : " << service_id.toStdString() << std::endl;
|
||||
std::cerr << " service port : " << service_port << std::endl;
|
||||
std::cerr << " target port : " << service_target_port << std::endl;
|
||||
std::cerr << " target address : " << service_target_address.toString().toStdString() << std::endl;
|
||||
std::cerr << "Got hidden service info: " << std::endl;
|
||||
std::cerr << " onion address : " << onion_address.toStdString() << std::endl;
|
||||
std::cerr << " service_id : " << service_id.toStdString() << std::endl;
|
||||
std::cerr << " service port : " << service_port << std::endl;
|
||||
std::cerr << " target port : " << service_target_port << std::endl;
|
||||
std::cerr << " target address : " << service_target_address.toString().toStdString() << std::endl;
|
||||
|
||||
std::cerr << "Setting proxy server to " << service_target_address.toString().toStdString() << ":" << service_target_port << std::endl;
|
||||
std::cerr << "Setting proxy server to " << service_target_address.toString().toStdString() << ":" << service_target_port << std::endl;
|
||||
|
||||
rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address.toString().toStdString(), service_target_port);
|
||||
rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address.toStdString(), service_port);
|
||||
rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address.toString().toStdString(),proxy_server_port) ;
|
||||
#endif
|
||||
rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address.toString().toStdString(), service_target_port);
|
||||
rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address.toStdString(), service_port);
|
||||
rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address.toString().toStdString(),proxy_server_port) ;
|
||||
}
|
||||
|
||||
Rshare::initPlugins();
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,9 @@ libresapihttpserver {
|
|||
|
||||
!include("../../libretroshare/src/use_libretroshare.pri"):error("Including")
|
||||
|
||||
retrotor {
|
||||
FORMS += TorControl/TorControlWindow.ui
|
||||
SOURCES += TorControl/TorControlWindow.cpp
|
||||
HEADERS += TorControl/TorControlWindow.h
|
||||
}
|
||||
FORMS += TorControl/TorControlWindow.ui
|
||||
SOURCES += TorControl/TorControlWindow.cpp
|
||||
HEADERS += TorControl/TorControlWindow.h
|
||||
|
||||
#QMAKE_CFLAGS += -fmudflap
|
||||
#LIBS *= /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflap.a /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflapth.a
|
||||
|
|
@ -285,7 +283,8 @@ wikipoos {
|
|||
LIBS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
|
||||
}
|
||||
|
||||
retrotor {
|
||||
# Tor controller
|
||||
|
||||
HEADERS += TorControl/AddOnionCommand.h \
|
||||
TorControl/AuthenticateCommand.h \
|
||||
TorControl/GetConfCommand.h \
|
||||
|
|
@ -324,7 +323,6 @@ SOURCES += TorControl/AddOnionCommand.cpp \
|
|||
TorControl/SecureRNG.cpp \
|
||||
TorControl/Settings.cpp \
|
||||
TorControl/StrUtil.cpp
|
||||
}
|
||||
|
||||
# Input
|
||||
HEADERS += rshare.h \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue