Merge pull request #2451 from csoler/v0.6-TorNode

V0.6 tor node
This commit is contained in:
csoler 2021-10-06 19:36:49 +02:00 committed by GitHub
commit d9c91ea41d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,38 +235,42 @@ void ConnectProgressDialog::initDialog()
void ConnectProgressDialog::updateStatus() void ConnectProgressDialog::updateStatus()
{ {
if (time(NULL) > mInitTS + CONNECT_TIMEOUT_PERIOD) if (time(NULL) > mInitTS + CONNECT_TIMEOUT_PERIOD)
{ {
sayConnectTimeout(); sayConnectTimeout();
mState = CONNECT_STATE_FAILED; mState = CONNECT_STATE_FAILED;
} }
switch(mState) switch(mState)
{ {
case CONNECT_STATE_PROGRESS: case CONNECT_STATE_PROGRESS:
updateNetworkStatus(); updateNetworkStatus();
updateContactStatus(); updateContactStatus();
if(!mIsPeerHiddenNode && !mAmIHiddenNode)
{
#ifdef RS_USE_BITDHT #ifdef RS_USE_BITDHT
updateDhtStatus(); updateDhtStatus();
#endif #endif
updateLookupStatus(); updateLookupStatus();
updateUdpStatus(); updateUdpStatus();
}
return; return;
break; break;
default: default:
case CONNECT_STATE_CLOSED: case CONNECT_STATE_CLOSED:
case CONNECT_STATE_FAILED: case CONNECT_STATE_FAILED:
case CONNECT_STATE_DENIED: case CONNECT_STATE_DENIED:
case CONNECT_STATE_CONNECTED: case CONNECT_STATE_CONNECTED:
break; break;
} }
/* shutdown actions */ /* shutdown actions */
ui->progressFrame->setEnabled(false); ui->progressFrame->setEnabled(false);
mTimer->stop(); mTimer->stop();
} }
@ -282,42 +286,70 @@ void ConnectProgressDialog::stopAndClose()
void ConnectProgressDialog::updateNetworkStatus() void ConnectProgressDialog::updateNetworkStatus()
{ {
RsNetState netState = rsConfig->getNetState(); QLabel *label = ui->NetResult;
QLabel *label = ui->NetResult; if(mAmIHiddenNode || mIsPeerHiddenNode)
switch(netState) switch(rsConfig->getNetState())
{ {
case RsNetState::BAD_UNKNOWN: case RsNetState::BAD_UNKNOWN:
label->setText(tr("Unknown State")); label->setText(tr("Unknown State"));
break; break;
case RsNetState::BAD_OFFLINE: case RsNetState::BAD_OFFLINE:
label->setText(tr("Offline")); label->setText(tr("Offline"));
break; break;
case RsNetState::BAD_NATSYM: case RsNetState::BAD_NATSYM:
label->setText(tr("Behind Symmetric NAT")); label->setText(tr("Behind Symmetric NAT"));
break; break;
case RsNetState::BAD_NODHT_NAT: case RsNetState::WARNING_RESTART:
label->setText(tr("Behind NAT & No DHT")); label->setText(tr("NET Restart"));
break; break;
case RsNetState::WARNING_RESTART: case RsNetState::BAD_NODHT_NAT:
label->setText(tr("NET Restart")); case RsNetState::WARNING_NATTED:
break; label->setText(tr("Behind NAT"));
case RsNetState::WARNING_NATTED: break;
label->setText(tr("Behind NAT")); case RsNetState::WARNING_NODHT:
break; case RsNetState::GOOD:
case RsNetState::WARNING_NODHT: label->setText(tr("NET STATE GOOD!"));
label->setText(tr("No DHT")); break;
break; case RsNetState::ADV_DARK_FORWARD:
case RsNetState::GOOD: case RsNetState::ADV_FORWARD:
label->setText(tr("NET STATE GOOD!")); label->setText(tr("UNVERIFIABLE FORWARD!"));
break; break;
case RsNetState::ADV_FORWARD: }
label->setText(tr("UNVERIFIABLE FORWARD!")); else
break; switch(rsConfig->getNetState())
case RsNetState::ADV_DARK_FORWARD: {
label->setText(tr("UNVERIFIABLE FORWARD & NO DHT")); case RsNetState::BAD_UNKNOWN:
break; label->setText(tr("Unknown State"));
} break;
case RsNetState::BAD_OFFLINE:
label->setText(tr("Offline"));
break;
case RsNetState::BAD_NATSYM:
label->setText(tr("Behind Symmetric NAT"));
break;
case RsNetState::BAD_NODHT_NAT:
label->setText(tr("Behind NAT & No DHT"));
break;
case RsNetState::WARNING_RESTART:
label->setText(tr("NET Restart"));
break;
case RsNetState::WARNING_NATTED:
label->setText(tr("Behind NAT"));
break;
case RsNetState::WARNING_NODHT:
label->setText(tr("No DHT"));
break;
case RsNetState::GOOD:
label->setText(tr("NET STATE GOOD!"));
break;
case RsNetState::ADV_FORWARD:
label->setText(tr("UNVERIFIABLE FORWARD!"));
break;
case RsNetState::ADV_DARK_FORWARD:
label->setText(tr("UNVERIFIABLE FORWARD & NO DHT"));
break;
}
} }
void ConnectProgressDialog::updateContactStatus() void ConnectProgressDialog::updateContactStatus()
@ -454,13 +486,9 @@ void ConnectProgressDialog::updateLookupStatus()
mState = CONNECT_STATE_FAILED; mState = CONNECT_STATE_FAILED;
if (mLookupStatus == CONNECT_LOOKUP_NODHTCONFIG) if (mLookupStatus == CONNECT_LOOKUP_NODHTCONFIG)
{
sayPeerNoDhtConfig(); sayPeerNoDhtConfig();
}
else else
{
sayPeerOffline(); sayPeerOffline();
}
} }
case CONNECT_LOOKUP_FAIL: case CONNECT_LOOKUP_FAIL: