first run on gui integration

This commit is contained in:
sehraf 2015-09-07 12:59:21 +02:00
parent ba74c04581
commit 0107f4e406
6 changed files with 137 additions and 35 deletions

View File

@ -101,7 +101,8 @@ const uint32_t RS_PEER_CONNECTSTATE_TRYING_UDP = 3;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4; const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5; const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6; const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 7; const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_I2P = 7;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 8;
/* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */ /* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */

View File

@ -435,8 +435,14 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
} }
else if (pcs.state & RS_PEER_S_CONNECTED) else if (pcs.state & RS_PEER_S_CONNECTED)
{ {
if(isProxyAddress(RS_HIDDEN_TYPE_TOR, pcs.connectaddr) || isProxyAddress(RS_HIDDEN_TYPE_I2P, pcs.connectaddr) || mPeerMgr->isHidden()) if(isProxyAddress(RS_HIDDEN_TYPE_TOR, pcs.connectaddr) || mPeerMgr->isHidden(RS_HIDDEN_TYPE_TOR))
{
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR; d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
}
else if (isProxyAddress(RS_HIDDEN_TYPE_I2P, pcs.connectaddr) || mPeerMgr->isHidden(RS_HIDDEN_TYPE_I2P))
{
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_I2P;
}
else if (pcs.connecttype == RS_NET_CONN_TCP_ALL) else if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
{ {
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TCP; d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TCP;

View File

@ -182,6 +182,10 @@ QString StatusDefs::connectStateString(RsPeerDetails &details)
stateString = qApp->translate("StatusDefs", "Connected: Tor"); stateString = qApp->translate("StatusDefs", "Connected: Tor");
isConnected = true; isConnected = true;
break; break;
case RS_PEER_CONNECTSTATE_CONNECTED_I2P:
stateString = qApp->translate("StatusDefs", "Connected: I2P");
isConnected = true;
break;
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN: case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString = qApp->translate("StatusDefs", "Connected: Unknown"); stateString = qApp->translate("StatusDefs", "Connected: Unknown");
isConnected = true; isConnected = true;
@ -231,6 +235,7 @@ QString StatusDefs::connectStateWithoutTransportTypeString(RsPeerDetails &detail
case RS_PEER_CONNECTSTATE_CONNECTED_TCP: case RS_PEER_CONNECTSTATE_CONNECTED_TCP:
case RS_PEER_CONNECTSTATE_CONNECTED_UDP: case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
case RS_PEER_CONNECTSTATE_CONNECTED_TOR: case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
case RS_PEER_CONNECTSTATE_CONNECTED_I2P:
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN: case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString = qApp->translate("StatusDefs", "Connected"); stateString = qApp->translate("StatusDefs", "Connected");
break; break;
@ -258,6 +263,9 @@ QString StatusDefs::connectStateIpString(RsPeerDetails &details)
case RS_PEER_CONNECTSTATE_CONNECTED_TOR: case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
stateString += QString(details.actAsServer ? qApp->translate("StatusDefs", "Tor-in") : qApp->translate("StatusDefs", "Tor-out")); stateString += QString(details.actAsServer ? qApp->translate("StatusDefs", "Tor-in") : qApp->translate("StatusDefs", "Tor-out"));
break; break;
case RS_PEER_CONNECTSTATE_CONNECTED_I2P:
stateString += QString(details.actAsServer ? qApp->translate("StatusDefs", "I2P-in") : qApp->translate("StatusDefs", "I2P-out"));
break;
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN: case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString += qApp->translate("StatusDefs", "unkown"); stateString += qApp->translate("StatusDefs", "unkown");
break; break;

View File

@ -306,9 +306,14 @@ void ServerPage::load()
std::string proxyaddr; std::string proxyaddr;
uint16_t proxyport; uint16_t proxyport;
uint32_t status ; uint32_t status ;
rsPeers->getProxyServer(proxyaddr, proxyport, status); // Tor
ui.torpage_proxyAddress -> setText(QString::fromStdString(proxyaddr)); rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, proxyaddr, proxyport, status);
ui.torpage_proxyPort -> setValue(proxyport); ui.hiddenpage_proxyAddress_tor -> setText(QString::fromStdString(proxyaddr));
ui.hiddenpage_proxyPort_tor -> setValue(proxyport);
// I2P
rsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, proxyaddr, proxyport, status);
ui.hiddenpage_proxyAddress_i2p -> setText(QString::fromStdString(proxyaddr));
ui.hiddenpage_proxyPort_i2p -> setValue(proxyport);
updateTorOutProxyIndicator(); updateTorOutProxyIndicator();
} }
@ -807,17 +812,29 @@ void ServerPage::saveAddresses()
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() ); rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
// HANDLE PROXY SERVER. // HANDLE PROXY SERVER.
std::string orig_proxyaddr; std::string orig_proxyaddr,new_proxyaddr;
uint16_t orig_proxyport; uint16_t orig_proxyport, new_proxyport;
uint32_t status ; uint32_t status ;
rsPeers->getProxyServer(orig_proxyaddr, orig_proxyport,status); // Tor
rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, orig_proxyaddr, orig_proxyport,status);
std::string new_proxyaddr = ui.torpage_proxyAddress -> text().toStdString(); new_proxyaddr = ui.hiddenpage_proxyAddress_tor -> text().toStdString();
uint16_t new_proxyport = ui.torpage_proxyPort -> value(); new_proxyport = ui.hiddenpage_proxyPort_tor -> value();
if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport)) if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
{ {
rsPeers->setProxyServer(new_proxyaddr, new_proxyport); rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, new_proxyaddr, new_proxyport);
}
// I2P
rsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, orig_proxyaddr, orig_proxyport,status);
new_proxyaddr = ui.hiddenpage_proxyAddress_i2p -> text().toStdString();
new_proxyport = ui.hiddenpage_proxyPort_i2p -> value();
if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
{
rsPeers->setProxyServer(RS_HIDDEN_TYPE_I2P, new_proxyaddr, new_proxyport);
} }
load(); load();
@ -935,9 +952,9 @@ void ServerPage::loadHiddenNode()
std::string proxyaddr; std::string proxyaddr;
uint16_t proxyport; uint16_t proxyport;
uint32_t proxy_state_flags; uint32_t proxy_state_flags;
rsPeers->getProxyServer(proxyaddr, proxyport, proxy_state_flags); rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, proxyaddr, proxyport, proxy_state_flags);
ui.torpage_proxyAddress -> setText(QString::fromStdString(proxyaddr)); ui.hiddenpage_proxyAddress_tor -> setText(QString::fromStdString(proxyaddr));
ui.torpage_proxyPort -> setValue(proxyport); ui.hiddenpage_proxyPort_tor -> setValue(proxyport);
updateTorOutProxyIndicator(); updateTorOutProxyIndicator();
@ -1053,14 +1070,14 @@ void ServerPage::saveAddressesHiddenNode()
std::string orig_proxyaddr; std::string orig_proxyaddr;
uint16_t orig_proxyport; uint16_t orig_proxyport;
uint32_t state_flags ; uint32_t state_flags ;
rsPeers->getProxyServer(orig_proxyaddr, orig_proxyport,state_flags); rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, orig_proxyaddr, orig_proxyport,state_flags);
std::string new_proxyaddr = ui.torpage_proxyAddress -> text().toStdString(); std::string new_proxyaddr = ui.hiddenpage_proxyAddress_tor -> text().toStdString();
uint16_t new_proxyport = ui.torpage_proxyPort -> value(); uint16_t new_proxyport = ui.hiddenpage_proxyPort_tor -> value();
if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport)) if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
{ {
rsPeers->setProxyServer(new_proxyaddr, new_proxyport); rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, new_proxyaddr, new_proxyport);
} }
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() ); rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
@ -1069,7 +1086,7 @@ void ServerPage::saveAddressesHiddenNode()
void ServerPage::updateTorOutProxyIndicator() void ServerPage::updateTorOutProxyIndicator()
{ {
QTcpSocket socket ; QTcpSocket socket ;
socket.connectToHost(ui.torpage_proxyAddress->text(),ui.torpage_proxyPort->text().toInt()); socket.connectToHost(ui.hiddenpage_proxyAddress_tor->text(),ui.hiddenpage_proxyPort_tor->text().toInt());
if(socket.waitForConnected(500)) if(socket.waitForConnected(500))
{ {
@ -1113,8 +1130,8 @@ void ServerPage::updateTorInProxyIndicator()
QNetworkProxy proxy ; QNetworkProxy proxy ;
proxy.setType(QNetworkProxy::Socks5Proxy); proxy.setType(QNetworkProxy::Socks5Proxy);
proxy.setHostName(ui.torpage_proxyAddress->text()); proxy.setHostName(ui.hiddenpage_proxyAddress_tor->text());
proxy.setPort(ui.torpage_proxyPort->text().toInt()); proxy.setPort(ui.hiddenpage_proxyPort_tor->text().toInt());
proxy.setCapabilities(QNetworkProxy::HostNameLookupCapability | proxy.capabilities()) ; proxy.setCapabilities(QNetworkProxy::HostNameLookupCapability | proxy.capabilities()) ;
//ui.iconlabel_tor_incoming->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ; //ui.iconlabel_tor_incoming->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
@ -1127,7 +1144,7 @@ void ServerPage::updateTorInProxyIndicator()
QUrl url("https://"+ui.torpage_onionAddress->text() + ":" + ui.torpage_onionPort->text()) ; QUrl url("https://"+ui.torpage_onionAddress->text() + ":" + ui.torpage_onionPort->text()) ;
std::cerr << "Setting proxy hostname+port to " << std::dec << ui.torpage_proxyAddress->text().toStdString() << ":" << ui.torpage_proxyPort->text().toInt() << std::endl; std::cerr << "Setting proxy hostname+port to " << std::dec << ui.hiddenpage_proxyAddress_tor->text().toStdString() << ":" << ui.hiddenpage_proxyPort_tor->text().toInt() << std::endl;
std::cerr << "Connecting to " << url.toString().toStdString() << std::endl; std::cerr << "Connecting to " << url.toString().toStdString() << std::endl;
connect(manager, SIGNAL(finished(QNetworkReply*)),this,SLOT(handleNetworkReply(QNetworkReply*))) ; connect(manager, SIGNAL(finished(QNetworkReply*)),this,SLOT(handleNetworkReply(QNetworkReply*))) ;

View File

@ -52,6 +52,7 @@ public slots:
void updateStatus(); void updateStatus();
private slots: private slots:
// ban list
void updateSelectedBlackListIP(int row, int, int, int); void updateSelectedBlackListIP(int row, int, int, int);
void updateSelectedWhiteListIP(int row,int,int,int); void updateSelectedWhiteListIP(int row,int,int,int);
void addIpRangeToBlackList(); void addIpRangeToBlackList();
@ -69,6 +70,8 @@ private slots:
void ipFilterContextMenu(const QPoint &); void ipFilterContextMenu(const QPoint &);
void ipWhiteListContextMenu(const QPoint &point); void ipWhiteListContextMenu(const QPoint &point);
void removeBannedIp(); void removeBannedIp();
// server
void saveAddresses(); void saveAddresses();
void toggleUPnP(); void toggleUPnP();
void toggleIpDetermination(bool) ; void toggleIpDetermination(bool) ;
@ -78,11 +81,12 @@ private slots:
void updateTorInProxyIndicator(); void updateTorInProxyIndicator();
private: private:
// ban list
// Alternative Versions for HiddenNode Mode.
void addPeerToIPTable(QTableWidget *table, int row, const BanListPeer &blp); void addPeerToIPTable(QTableWidget *table, int row, const BanListPeer &blp);
bool removeCurrentRowFromBlackList(sockaddr_storage& collected_addr,int& masked_bytes); bool removeCurrentRowFromBlackList(sockaddr_storage& collected_addr,int& masked_bytes);
bool removeCurrentRowFromWhiteList(sockaddr_storage &collected_addr, int &masked_bytes); bool removeCurrentRowFromWhiteList(sockaddr_storage &collected_addr, int &masked_bytes);
// Alternative Versions for HiddenNode Mode.
void loadHiddenNode(); void loadHiddenNode();
void updateStatusHiddenNode(); void updateStatusHiddenNode();
void saveAddressesHiddenNode(); void saveAddressesHiddenNode();

View File

@ -11,13 +11,22 @@
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin"> <property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -515,7 +524,7 @@ behind a firewall or a VPN.</string>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tabWidgetPage1" native="true"> <widget class="QWidget" name="tabWidgetPage1">
<attribute name="title"> <attribute name="title">
<string>IP blacklist</string> <string>IP blacklist</string>
</attribute> </attribute>
@ -756,15 +765,15 @@ behind a firewall or a VPN.</string>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="TorTAB"> <widget class="QWidget" name="HiddenTAB">
<attribute name="title"> <attribute name="title">
<string>Tor Configuration</string> <string>Hidden Service Configuration</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8">
<item> <item>
<widget class="QGroupBox" name="torpage_outgoing"> <widget class="QGroupBox" name="torpage_outgoing">
<property name="title"> <property name="title">
<string>Outgoing Tor Connections</string> <string>Outgoing Connections</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
@ -779,10 +788,10 @@ behind a firewall or a VPN.</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="torpage_proxyAddress"/> <widget class="QLineEdit" name="hiddenpage_proxyAddress_tor"/>
</item> </item>
<item> <item>
<widget class="QSpinBox" name="torpage_proxyPort"> <widget class="QSpinBox" name="hiddenpage_proxyPort_tor">
<property name="minimum"> <property name="minimum">
<number>10</number> <number>10</number>
</property> </property>
@ -822,12 +831,67 @@ behind a firewall or a VPN.</string>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>I2P Socks Proxy</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="hiddenpage_proxyAddress_i2p"/>
</item>
<item>
<widget class="QSpinBox" name="hiddenpage_proxyPort_i2p">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="iconlabel_i2p_outgoing">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>I2P outgoing Okay</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item> <item>
<widget class="QPlainTextEdit" name="plainTextEdit"> <widget class="QPlainTextEdit" name="plainTextEdit">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>100</height> <height>145</height>
</size> </size>
</property> </property>
<property name="verticalScrollBarPolicy"> <property name="verticalScrollBarPolicy">
@ -839,8 +903,10 @@ behind a firewall or a VPN.</string>
<property name="plainText"> <property name="plainText">
<string>Tor Socks Proxy default: 127.0.0.1:9050. Set in torrc config and update here. <string>Tor Socks Proxy default: 127.0.0.1:9050. Set in torrc config and update here.
I2P Socks Proxy: see http://127.0.0.1:7657/i2ptunnelmgr for setting up a client tunnel.
You can connect to Hidden Nodes, even if you You can connect to Hidden Nodes, even if you
are running a standard Node, so why not setup Tor? </string> are running a standard Node, so why not setup Tor and/or I2P? </string>
</property> </property>
</widget> </widget>
</item> </item>