From acef759a586c38a314943555ee9e2949bbba90c5 Mon Sep 17 00:00:00 2001 From: sudden6 Date: Sun, 24 Feb 2019 21:57:51 +0100 Subject: [PATCH] feat: remove old boostrap nodes code This commit replaces the bootstrap node list in the qtox.ini file with the boostrapnodeupdater class. --- res.qrc | 1 - res/settings.ini | 150 ----------------------------------- src/core/core.cpp | 8 +- src/core/core.h | 2 - src/core/icoresettings.h | 5 -- src/persistence/settings.cpp | 71 ----------------- src/persistence/settings.h | 5 -- 7 files changed, 5 insertions(+), 237 deletions(-) delete mode 100644 res/settings.ini diff --git a/res.qrc b/res.qrc index e8ae975d7..1fec1b582 100644 --- a/res.qrc +++ b/res.qrc @@ -1,6 +1,5 @@ - res/settings.ini res/nodes.json diff --git a/res/settings.ini b/res/settings.ini deleted file mode 100644 index 5c956e0b4..000000000 --- a/res/settings.ini +++ /dev/null @@ -1,150 +0,0 @@ -[DHT%20Server] -dhtServerList\size=37 -dhtServerList\1\name=MAH69K -dhtServerList\1\userId=DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43 -dhtServerList\1\address=2a00:7a60:0:746b::3 -dhtServerList\1\port=33445 -dhtServerList\2\name=CeBe -dhtServerList\2\userId=6EE1FADE9F55CC7938234CC07C864081FC606D8FE7B751EDA217F268F1078A39 -dhtServerList\2\address=2a01:4f8:212:2459::a:1337 -dhtServerList\2\port=443 -dhtServerList\3\name=AnthonyBilinski -dhtServerList\3\userId=10C00EB250C3233E343E2AEBA07115A5C28920E9C8D29492F6D00B29049EDC7E -dhtServerList\3\address=tox.abilinski.com -dhtServerList\3\port=33445 -dhtServerList\4\name=pucetox -dhtServerList\4\userId=7AED21F94D82B05774F697B209628CD5A9AD17E0C073D9329076A4C28ED28147 -dhtServerList\4\address=217.182.143.254 -dhtServerList\4\port=2306 -dhtServerList\5\name=ru_maniac -dhtServerList\5\userId=0FB96EEBFB1650DDB52E70CF773DDFCABE25A95CC3BB50FC251082E4B63EF82A -dhtServerList\5\address=45.59.119.218 -dhtServerList\5\port=33445 -dhtServerList\6\name=velusip -dhtServerList\6\userId=7E5668E0EE09E19F320AD47902419331FFEE147BB3606769CFBE921A2A2FD34C -dhtServerList\6\address=149.56.140.5 -dhtServerList\6\port=33445 -dhtServerList\7\name=Pokemon -dhtServerList\7\userId=1B5A8AB25FFFB66620A531C4646B47F0F32B74C547B30AF8BD8266CA50A3AB59 -dhtServerList\7\address=2001:1af8:4700:a115:6::b -dhtServerList\7\port=33445 -dhtServerList\8\name=nrn -dhtServerList\8\userId=7467AFA626D3246343170B309BA5BDC975DF3924FC9D7A5917FBFA9F5CD5CD38 -dhtServerList\8\address=tmux.ru -dhtServerList\8\port=33445 -dhtServerList\9\name=initramfs -dhtServerList\9\userId=3F0A45A268367C1BEA652F258C85F4A66DA76BCAA667A49E770BCC4917AB6A25 -dhtServerList\9\address=tox.initramfs.io -dhtServerList\9\port=33445 -dhtServerList\10\name=Amin -dhtServerList\10\userId=5A59705F86B9FC0671FDF72ED9BB5E55015FF20B349985543DDD4B0656CA1C63 -dhtServerList\10\address=t0x-node1.weba.ru -dhtServerList\10\port=33445 -dhtServerList\11\name=LittleVulpix -dhtServerList\11\userId=2C289F9F37C20D09DA83565588BF496FAB3764853FA38141817A72E3F18ACA0B -dhtServerList\11\address=163.172.136.118 -dhtServerList\11\port=33445 -dhtServerList\12\name=Busindre -dhtServerList\12\userId=1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F -dhtServerList\12\address=2605:6400:1:fed5:22:45af:ec10:f329 -dhtServerList\12\port=33445 -dhtServerList\13\name=Manolis -dhtServerList\13\userId=461FA3776EF0FA655F1A05477DF1B3B614F7D6B124F7DB1DD4FE3C08B03B640F -dhtServerList\13\address=130.133.110.14 -dhtServerList\13\port=33445 -dhtServerList\14\name=warlomak -dhtServerList\14\userId=FFAC871E85B1E1487F87AE7C76726AE0E60318A85F6A1669E04C47EB8DC7C72D -dhtServerList\14\address=79.140.30.52 -dhtServerList\14\port=33445 -dhtServerList\15\name=CeBe -dhtServerList\15\userId=6EE1FADE9F55CC7938234CC07C864081FC606D8FE7B751EDA217F268F1078A39 -dhtServerList\15\address=136.243.141.187 -dhtServerList\15\port=443 -dhtServerList\16\name=fluke571 -dhtServerList\16\userId=3CEE1F054081E7A011234883BC4FC39F661A55B73637A5AC293DDF1251D9432B -dhtServerList\16\address=2001:1470:fbfe::109 -dhtServerList\16\port=33445 -dhtServerList\17\name=Skey -dhtServerList\17\userId=B71E91E2F5029B0A84D3B1136319CDD3D1DB6D3702B6CEFA66A4BEB25A635916 -dhtServerList\17\address=213.183.51.211 -dhtServerList\17\port=33445 -dhtServerList\18\name=nurupo -dhtServerList\18\userId=F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67 -dhtServerList\18\address=node.tox.biribiri.org -dhtServerList\18\port=33445 -dhtServerList\19\name=pucetox -dhtServerList\19\userId=7AED21F94D82B05774F697B209628CD5A9AD17E0C073D9329076A4C28ED28147 -dhtServerList\19\address=2001:41d0:302:1000::e111 -dhtServerList\19\port=2306 -dhtServerList\20\name=MAH69K -dhtServerList\20\userId=DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43 -dhtServerList\20\address=185.25.116.107 -dhtServerList\20\port=33445 -dhtServerList\21\name=Yani -dhtServerList\21\userId=E59A0E71ADA20D35BD1B0957059D7EF7E7792B3D680AE25C6F4DBBA09114D165 -dhtServerList\21\address=37.97.185.116 -dhtServerList\21\port=33445 -dhtServerList\22\name=Busindre -dhtServerList\22\userId=1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F -dhtServerList\22\address=198.98.51.198 -dhtServerList\22\port=33445 -dhtServerList\23\name=ray65536 -dhtServerList\23\userId=8E7D0B859922EF569298B4D261A8CCB5FEA14FB91ED412A7603A585A25698832 -dhtServerList\23\address=85.172.30.117 -dhtServerList\23\port=33445 -dhtServerList\24\name=Pokemon -dhtServerList\24\userId=1B5A8AB25FFFB66620A531C4646B47F0F32B74C547B30AF8BD8266CA50A3AB59 -dhtServerList\24\address=37.48.122.22 -dhtServerList\24\port=33445 -dhtServerList\25\name=LittleVulpix -dhtServerList\25\userId=2C289F9F37C20D09DA83565588BF496FAB3764853FA38141817A72E3F18ACA0B -dhtServerList\25\address=2001:bc8:4400:2100::13:41d -dhtServerList\25\port=33445 -dhtServerList\26\name=Sorunome -dhtServerList\26\userId=02807CF4F8BB8FB390CC3794BDF1E8449E9A8392C5D3F2200019DA9F1E812E46 -dhtServerList\26\address=78.46.73.141 -dhtServerList\26\port=33445 -dhtServerList\27\name=blind_oracle -dhtServerList\27\userId=D527E5847F8330D628DAB1814F0A422F6DC9D0A300E6C357634EE2DA88C35463 -dhtServerList\27\address=tox.novg.net -dhtServerList\27\port=33445 -dhtServerList\28\name=dvor -dhtServerList\28\userId=2555763C8C460495B14157D234DD56B86300A2395554BCAE4621AC345B8C1B1B -dhtServerList\28\address=185.14.30.213 -dhtServerList\28\port=443 -dhtServerList\29\name=dvor -dhtServerList\29\userId=2555763C8C460495B14157D234DD56B86300A2395554BCAE4621AC345B8C1B1B -dhtServerList\29\address=2a00:1ca8:a7::e8b -dhtServerList\29\port=443 -dhtServerList\30\name=Nolz -dhtServerList\30\userId=15E9C309CFCB79FDDF0EBA057DABB49FE15F3803B1BFF06536AE2E5BA5E4690E -dhtServerList\30\address=tox.ngc.zone -dhtServerList\30\port=33445 -dhtServerList\31\name=loskiq -dhtServerList\31\userId=88124F3C18C6CFA8778B7679B7329A333616BD27A4DFB562D476681315CF143D -dhtServerList\31\address=tox-node.loskiq.it -dhtServerList\31\port=33445 -dhtServerList\32\name=linxon -dhtServerList\32\userId=B38255EE4B054924F6D79A5E6E5889EC94B6ADF6FE9906F97A3D01E3D083223A -dhtServerList\32\address=80.87.193.193 -dhtServerList\32\port=33445 -dhtServerList\33\name=Sorunome -dhtServerList\33\userId=02807CF4F8BB8FB390CC3794BDF1E8449E9A8392C5D3F2200019DA9F1E812E46 -dhtServerList\33\address=2a01:4f8:120:4091::3 -dhtServerList\33\port=33445 -dhtServerList\34\name=a68366 -dhtServerList\34\userId=AEC204B9A4501412D5F0BB67D9C81B5DB3EE6ADA64122D32A3E9B093D544327D -dhtServerList\34\address=tox1.a68366.com -dhtServerList\34\port=33445 -dhtServerList\35\name=Skey -dhtServerList\35\userId=B71E91E2F5029B0A84D3B1136319CDD3D1DB6D3702B6CEFA66A4BEB25A635916 -dhtServerList\35\address=2a06:f901:1:100::98 -dhtServerList\35\port=33445 -dhtServerList\36\name=fluke571 -dhtServerList\36\userId=3CEE1F054081E7A011234883BC4FC39F661A55B73637A5AC293DDF1251D9432B -dhtServerList\36\address=194.249.212.109 -dhtServerList\36\port=33445 -dhtServerList\37\name=ky0uraku -dhtServerList\37\userId=257744DBF57BE3E117FE05D145B5F806089428D4DCE4E3D0D50616AA16D9417E -dhtServerList\37\address=95.31.18.227 -dhtServerList\37\port=33445 diff --git a/src/core/core.cpp b/src/core/core.cpp index 6d5b82254..9c06a18bb 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -21,12 +21,14 @@ #include "core.h" #include "corefile.h" #include "src/core/coreav.h" +#include "src/core/dhtserver.h" #include "src/core/icoresettings.h" #include "src/core/toxlogger.h" #include "src/core/toxoptions.h" #include "src/core/toxstring.h" #include "src/model/groupinvite.h" #include "src/nexus.h" +#include "src/net/bootstrapnodeupdater.h" #include "src/persistence/profile.h" #include "src/util/strongtype.h" @@ -279,9 +281,6 @@ ToxCorePtr Core::makeToxCore(const QByteArray& savedata, const ICoreSettings* co return {}; } - // provide a list of bootstrap nodes - core->bootstrapNodes = settings->getDhtServerList(); - // tox should be valid by now assert(core->tox != nullptr); @@ -423,6 +422,9 @@ bool Core::checkConnection() void Core::bootstrapDht() { ASSERT_CORE_THREAD; + + QList bootstrapNodes = BootstrapNodeUpdater::loadDefaultBootstrapNodes(); + int listSize = bootstrapNodes.size(); if (!listSize) { qWarning() << "no bootstrap list?!?"; diff --git a/src/core/core.h b/src/core/core.h index d2598463c..e23790ab0 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -24,7 +24,6 @@ #include "toxfile.h" #include "toxid.h" -#include "src/core/dhtserver.h" #include "src/util/strongtype.h" #include @@ -277,7 +276,6 @@ private: std::unique_ptr coreLoopLock = nullptr; std::unique_ptr coreThread = nullptr; - QList bootstrapNodes{}; friend class Audio; ///< Audio can access our calls directly to reduce latency friend class CoreFile; ///< CoreFile can access tox* and emit our signals diff --git a/src/core/icoresettings.h b/src/core/icoresettings.h index ac8adc092..66b9f03f5 100644 --- a/src/core/icoresettings.h +++ b/src/core/icoresettings.h @@ -2,7 +2,6 @@ #define I_CORE_SETTINGS_H #include "src/model/interface.h" -#include "src/core/dhtserver.h" #include #include @@ -36,9 +35,6 @@ public: virtual quint16 getProxyPort() const = 0; virtual void setProxyPort(quint16 port) = 0; - virtual const QList& getDhtServerList() const = 0; - virtual void setDhtServerList(const QList& servers) = 0; - virtual QNetworkProxy getProxy() const = 0; DECLARE_SIGNAL(enableIPv6Changed, bool enabled); @@ -47,7 +43,6 @@ public: DECLARE_SIGNAL(proxyTypeChanged, ICoreSettings::ProxyType type); DECLARE_SIGNAL(proxyAddressChanged, const QString& address); DECLARE_SIGNAL(proxyPortChanged, quint16 port); - DECLARE_SIGNAL(dhtServerListChanged, const QList& servers); }; #endif // I_CORE_SETTINGS_H diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index 0a6893cb3..5184894b0 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -141,28 +141,6 @@ void Settings::loadGlobal() } s.endGroup(); - s.beginGroup("DHT Server"); - { - if (s.value("useCustomList").toBool()) { - useCustomDhtList = true; - qDebug() << "Using custom bootstrap nodes list"; - int serverListSize = s.beginReadArray("dhtServerList"); - for (int i = 0; i < serverListSize; i++) { - s.setArrayIndex(i); - DhtServer server; - server.name = s.value("name").toString(); - server.userId = s.value("userId").toString(); - server.address = s.value("address").toString(); - server.port = static_cast(s.value("port").toUInt()); - dhtServerList << server; - } - s.endArray(); - } else { - useCustomDhtList = false; - } - } - s.endGroup(); - s.beginGroup("General"); { translation = s.value("translation", "en").toString(); @@ -291,25 +269,6 @@ void Settings::loadGlobal() } s.endGroup(); - // Read the embedded DHT bootstrap nodes list if needed - if (dhtServerList.isEmpty()) { - QSettings rcs(":/conf/settings.ini", QSettings::IniFormat); - rcs.setIniCodec("UTF-8"); - rcs.beginGroup("DHT Server"); - int serverListSize = rcs.beginReadArray("dhtServerList"); - for (int i = 0; i < serverListSize; i++) { - rcs.setArrayIndex(i); - DhtServer server; - server.name = rcs.value("name").toString(); - server.userId = rcs.value("userId").toString(); - server.address = rcs.value("address").toString(); - server.port = static_cast(rcs.value("port").toUInt()); - dhtServerList << server; - } - rcs.endArray(); - rcs.endGroup(); - } - loaded = true; } @@ -474,21 +433,6 @@ void Settings::saveGlobal() } s.endGroup(); - s.beginGroup("DHT Server"); - { - s.setValue("useCustomList", useCustomDhtList); - s.beginWriteArray("dhtServerList", dhtServerList.size()); - for (int i = 0; i < dhtServerList.size(); i++) { - s.setArrayIndex(i); - s.setValue("name", dhtServerList[i].name); - s.setValue("userId", dhtServerList[i].userId); - s.setValue("address", dhtServerList[i].address); - s.setValue("port", dhtServerList[i].port); - } - s.endArray(); - } - s.endGroup(); - s.beginGroup("General"); { s.setValue("translation", translation); @@ -813,21 +757,6 @@ QString Settings::getAppCacheDirPath() const #endif } -const QList& Settings::getDhtServerList() const -{ - QMutexLocker locker{&bigLock}; - return dhtServerList; -} - -void Settings::setDhtServerList(const QList& servers) -{ - QMutexLocker locker{&bigLock}; - - if (servers != dhtServerList) { - dhtServerList = servers; - emit dhtServerListChanged(dhtServerList); - } -} bool Settings::getEnableTestSound() const { QMutexLocker locker{&bigLock}; diff --git a/src/persistence/settings.h b/src/persistence/settings.h index 758fb6f52..33241210a 100644 --- a/src/persistence/settings.h +++ b/src/persistence/settings.h @@ -279,9 +279,6 @@ public: bool getAutoSaveEnabled() const; // ICoreSettings - const QList& getDhtServerList() const override; - void setDhtServerList(const QList& servers) override; - bool getEnableIPv6() const override; void setEnableIPv6(bool enabled) override; @@ -308,7 +305,6 @@ public: SIGNAL_IMPL(Settings, proxyTypeChanged, ICoreSettings::ProxyType type) SIGNAL_IMPL(Settings, proxyAddressChanged, const QString& address) SIGNAL_IMPL(Settings, proxyPortChanged, quint16 port) - SIGNAL_IMPL(Settings, dhtServerListChanged, const QList& servers) bool getEnableLogging() const; void setEnableLogging(bool newValue); @@ -587,7 +583,6 @@ private: bool loaded; bool useCustomDhtList; - QList dhtServerList; int dhtServerId; bool dontShowDhtDialog;