diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index 335827c27..49d496c6e 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -84,7 +84,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags) ui.tabWidget->widget(2)->layout()->addItem(verticalSpacer) ; ui.tabWidget->widget(2)->layout()->update() ; - ui.torPort->setVisible(false); + ui.torpage_incoming->setVisible(false); + /* Hide platform specific features */ #ifdef Q_WS_WIN @@ -236,6 +237,13 @@ void ServerPage::load() ui.ipAddressList->clear(); for(std::list::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it) ui.ipAddressList->addItem(QString::fromStdString(*it)); + + /* TOR PAGE SETTINGS - only Proxy (outgoing) */ + std::string proxyaddr; + uint16_t proxyport; + rsPeers->getProxyServer(proxyaddr, proxyport); + ui.torpage_proxyAddress -> setText(QString::fromStdString(proxyaddr)); + ui.torpage_proxyPort -> setValue(proxyport); } void ServerPage::toggleTurtleRouting(bool b) @@ -412,6 +420,19 @@ void ServerPage::saveAddresses() rsPeers->setDynDNS(ownId, ui.dynDNS->text().toStdString()); rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() ); + // HANDLE PROXY SERVER. + std::string orig_proxyaddr; + uint16_t orig_proxyport; + rsPeers->getProxyServer(orig_proxyaddr, orig_proxyport); + + std::string new_proxyaddr = ui.torpage_proxyAddress -> text().toStdString(); + uint16_t new_proxyport = ui.torpage_proxyPort -> value(); + + if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport)) + { + rsPeers->setProxyServer(new_proxyaddr, new_proxyport); + } + load(); } @@ -476,9 +497,13 @@ void ServerPage::loadHiddenNode() // Addresses. ui.localAddress->setEnabled(false); - ui.localPort -> setEnabled(true); - ui.extAddress -> setEnabled(true); - ui.extPort -> setEnabled(true); + ui.localPort -> setEnabled(false); + ui.extAddress -> setEnabled(false); + ui.extPort -> setVisible(false); + ui.label_dynDNS->setVisible(false); + ui.dynDNS ->setVisible(false); + + ui.torpage_incoming->setVisible(true); /* Addresses must be set here - otherwise can't edit it */ /* set local address */ @@ -486,21 +511,7 @@ void ServerPage::loadHiddenNode() ui.localPort -> setValue(detail.localPort); /* set the server address */ - - ui.label_extAddress->setText(tr("TOR Onion Address")); - ui.extAddress->setText(QString::fromStdString(detail.hiddenNodeAddress)); - ui.extPort -> setValue(detail.hiddenNodePort); - - /* set DynDNS */ - ui.label_dynDNS -> setText("TOR Server Port"); - - std::string proxyaddr; - uint16_t proxyport; - rsPeers->getProxyServer(proxyaddr, proxyport); - - ui.dynDNS -> setText(QString::fromStdString(proxyaddr)); - ui.torPort -> setVisible(true); - ui.torPort -> setValue(proxyport); + ui.extAddress->setText(tr("Hidden - See TOR Config")); ui.showDiscStatusBar->setChecked(Settings->getStatusBarFlags() & STATUSBAR_DISC); @@ -519,6 +530,33 @@ void ServerPage::loadHiddenNode() ui.allowIpDeterminationCB->setChecked(false); ui.allowIpDeterminationCB->setEnabled(false); ui.IPServersLV->setEnabled(false); + + /* TOR PAGE SETTINGS */ + + /* set local address */ + ui.torpage_localAddress->setEnabled(false); + ui.torpage_localAddress->setText(QString::fromStdString(detail.localAddr)); + ui.torpage_localPort -> setValue(detail.localPort); + + /* set the server address */ + ui.torpage_onionAddress->setText(QString::fromStdString(detail.hiddenNodeAddress)); + ui.torpage_onionPort -> setValue(detail.hiddenNodePort); + + std::string proxyaddr; + uint16_t proxyport; + rsPeers->getProxyServer(proxyaddr, proxyport); + ui.torpage_proxyAddress -> setText(QString::fromStdString(proxyaddr)); + ui.torpage_proxyPort -> setValue(proxyport); + + QString expected = "HiddenServiceDir \n"; + expected += "HiddenServicePort "; + expected += QString::number(detail.hiddenNodePort); + expected += " "; + expected += QString::fromStdString(detail.localAddr); + expected += ":"; + expected += QString::number(detail.localPort); + + ui.torpage_configuration->setPlainText(expected); } /** Loads the settings for this page */ @@ -602,30 +640,26 @@ void ServerPage::saveAddressesHiddenNode() if ((vs_disc != detail.vs_disc) || (vs_dht != detail.vs_dht)) rsPeers->setVisState(ownId, vs_disc, vs_dht); - // Work out what we do with addresses! - //rsPeers->setExtAddress(ownId, ui.extAddress->text().toStdString(), ui.extPort->value()); - - if (detail.localPort != ui.localPort->value()) + if (detail.localPort != ui.torpage_localPort->value()) { // Set Local Address - force to 127.0.0.1 - rsPeers->setLocalAddress(ownId, "127.0.0.1", ui.localPort->value()); + rsPeers->setLocalAddress(ownId, "127.0.0.1", ui.torpage_localPort->value()); } - std::string hiddenAddr = ui.extAddress->text().toStdString(); - uint16_t hiddenPort = ui.extPort->value(); + std::string hiddenAddr = ui.torpage_onionAddress->text().toStdString(); + uint16_t hiddenPort = ui.torpage_onionPort->value(); if ((hiddenAddr != detail.hiddenNodeAddress) || (hiddenPort != detail.hiddenNodePort)) { rsPeers->setHiddenNode(ownId, hiddenAddr, hiddenPort); } - // HANDLE PROXY SERVER. std::string orig_proxyaddr; uint16_t orig_proxyport; rsPeers->getProxyServer(orig_proxyaddr, orig_proxyport); - std::string new_proxyaddr = ui.dynDNS -> text().toStdString(); - uint16_t new_proxyport = ui.torPort -> value(); + std::string new_proxyaddr = ui.torpage_proxyAddress -> text().toStdString(); + uint16_t new_proxyport = ui.torpage_proxyPort -> value(); if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport)) { diff --git a/retroshare-gui/src/gui/settings/ServerPage.ui b/retroshare-gui/src/gui/settings/ServerPage.ui index 00250ebf3..c75bb19ae 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.ui +++ b/retroshare-gui/src/gui/settings/ServerPage.ui @@ -6,18 +6,18 @@ 0 0 - 632 - 683 + 602 + 535 6 - + - 0 + 3 @@ -201,29 +201,6 @@ peers still need to trust each other to allow connection. - - - - The Port that TOR is listening to for outgoing connections. Normally 9100 or 9150 - - - 1024 - - - 65535 - - - 9100 - - - - - - - Port: - - - @@ -568,6 +545,270 @@ The default value is 20. + + + TOR Configuration + + + + + + Outgoing TOR Connections + + + + + + + + + + TOR Socks Proxy + + + + + + + + + + 10 + + + 65535 + + + + + + + + + + + + 16 + 16 + + + + + + + :/images/ledoff1.png + + + + + + + Outgoing Okay + + + + + + + + + + + + 16777215 + 100 + + + + Qt::ScrollBarAlwaysOff + + + true + + + TOR Socks Proxy default: 127.0.01:9050. Set in torrc config and update here. + +You can connect to Hidden Nodes, even if you +are running a standard Node, so why not setup TOR? + + + + + + + + + + + 0 + 0 + + + + Incoming TOR Connections + + + + + + + + Local Address + + + + + + + + + + 10 + + + 65535 + + + + + + + + + + 16 + 16 + + + + + + + :/images/ledoff1.png + + + + + + + Incoming Okay + + + + + + + + + Onion Address + + + + + + + + + + 10 + + + 65535 + + + + + + + + + + + Expected torrc Port Configuration: + + + + + + + + 0 + 0 + + + + + 0 + 10 + + + + + 16777215 + 50 + + + + Qt::ScrollBarAlwaysOff + + + true + + + HiddenServiceDir </your/path/to/hidden/directory/service> +HiddenServicePort 9191 127.0.0.1:9191 + + + + + + + + + + 0 + 0 + + + + + 16777215 + 100 + + + + true + + + To Receive Connections, you must first setup a TOR Hidden Service. +See TOR documentation for HOWTO details. + +Once this is done, paste the Onion Address in the box above. +This is your external address on the TOR network. +Finally make sure that the Ports match the TOR configuration. + +If you have issues connecting over TOR check the TOR logs too. + + + + + + + + + + Qt::Vertical + + + + 20 + 18 + + + + + + @@ -575,7 +816,6 @@ The default value is 20. netModeComboBox discComboBox - tabWidget localAddress localPort extAddress