From 668d59705c3582a8784a98642cc7faaa5f8d5620 Mon Sep 17 00:00:00 2001 From: enWILLYado Date: Mon, 26 Feb 2018 20:24:31 +0100 Subject: [PATCH] Update configuration Update configuration flags and fix default donate pool servers (cryptonight and cryptonight-little). --- src/Options.cpp | 59 ++++++++++++++++----------- src/Options.h | 1 + src/config.json | 13 +++--- src/donate.h | 5 ++- src/net/strategies/DonateStrategy.cpp | 4 +- 5 files changed, 50 insertions(+), 32 deletions(-) diff --git a/src/Options.cpp b/src/Options.cpp index ac619c79..5e887d01 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -113,7 +113,7 @@ static struct option const options[] = { "donate-level", 1, nullptr, 1003 }, { "dry-run", 0, nullptr, 5000 }, { "help", 0, nullptr, 'h' }, - { "keepalive", 0, nullptr , 'k' }, + { "keepalive", 0, nullptr, 'k' }, { "log-file", 1, nullptr, 'l' }, { "max-cpu-usage", 1, nullptr, 1004 }, { "nicehash", 0, nullptr, 1006 }, @@ -161,12 +161,13 @@ static struct option const config_options[] = static struct option const donate_options[] = { { "donate-url", required_argument, nullptr, 1391 }, - { "donate-user", required_argument, nullptr, 1392 }, - { "donate-pass", required_argument, nullptr, 1393 }, - { "donate-userpass", required_argument, nullptr, 1394 }, - { "donate-keepalive", 0, nullptr, 1395 }, - { "donate-nicehash", 0, nullptr, 1396 }, - { "donate-minutes", optional_argument, nullptr, 1397 }, + { "donate-url-little", required_argument, nullptr, 1392 }, + { "donate-user", required_argument, nullptr, 1393 }, + { "donate-pass", required_argument, nullptr, 1394 }, + { "donate-userpass", required_argument, nullptr, 1395 }, + { "donate-keepalive", no_argument, nullptr, 1396 }, + { "donate-nicehash", no_argument, nullptr, 1397 }, + { "donate-minutes", no_argument, nullptr, 1398 }, { 0, 0, 0, 0 } }; @@ -176,7 +177,7 @@ static struct option const pool_options[] = { "pass", 1, nullptr, 'p' }, { "user", 1, nullptr, 'u' }, { "userpass", 1, nullptr, 'O' }, - { "keepalive", 0, nullptr , 'k' }, + { "keepalive", 0, nullptr, 'k' }, { "nicehash", 0, nullptr, 1006 }, { 0, 0, 0, 0 } }; @@ -246,6 +247,7 @@ Options::Options(int argc, char** argv) : m_affinity(-1L) { m_donateOpt.m_url = kDonateUrl; + m_donateOpt.m_url_little = kDonateUrlLittle; m_donateOpt.m_user = kDonateUser; m_donateOpt.m_pass = kDonatePass; m_donateOpt.m_keepAlive = kDonateKeepAlive; @@ -446,22 +448,32 @@ bool Options::parseArg(int key, const std::string & arg) case 1391: //donate-url m_donateOpt.m_url = arg; break; - case 1392: //donate-user + case 1392: //donate-url-little + m_donateOpt.m_url_little = arg; + break; + case 1393: //donate-user m_donateOpt.m_user = arg; break; - case 1393: //donate-pass + case 1394: //donate-pass m_donateOpt.m_pass = arg; break; - case 1394: //donate-userpass - m_donateOpt.m_url = arg; - break; - case 1395: //donate-nicehash + case 1395: //donate-userpass + { + const size_t p = arg.find_first_of(':'); + if(p != std::string::npos) + { + m_donateOpt.m_user = arg.substr(0, p); + m_donateOpt.m_pass = arg.substr(p + 1); + } + } + break; + case 1396: //donate-nicehash parseBoolean(key, arg == "true"); break; - case 1396: //donate-keepalive + case 1397: //donate-keepalive parseBoolean(key, arg == "true"); break; - case 1397: //donate-minutes + case 1398: //donate-minutes parseArg(key, strtol(arg.c_str(), nullptr, 10)); break; @@ -565,7 +577,7 @@ bool Options::parseArg(int key, uint64_t arg) case 1396: //donate-nicehash break; - case 1397: //donate-minutes + case 1398: //donate-minutes m_donateOpt.m_minutesPh = (unsigned short)arg; break; @@ -656,11 +668,11 @@ bool Options::parseBoolean(int key, bool enable) m_colors = enable; break; - case 1395: //donate-keepalive + case 1396: //donate-keepalive m_donateOpt.m_keepAlive = enable; break; - case 1396: //donate-nicehash + case 1397: //donate-nicehash m_donateOpt.m_niceHash = enable; break; @@ -669,10 +681,11 @@ bool Options::parseBoolean(int key, bool enable) break; case 1391: //donate-url - case 1392: //donate-user - case 1393: //donate-pass - case 1394: //donate-userpass - case 1397: //donate-minutes + case 1392: //donate-url-little + case 1393: //donate-user + case 1394: //donate-pass + case 1395: //donate-userpass + case 1398: //donate-minutes default: break; } diff --git a/src/Options.h b/src/Options.h index d2f0e671..3107d029 100644 --- a/src/Options.h +++ b/src/Options.h @@ -59,6 +59,7 @@ public: { public: std::string m_url; + std::string m_url_little; std::string m_user; std::string m_pass; bool m_keepAlive; diff --git a/src/config.json b/src/config.json index 05f54efe..57e162fb 100644 --- a/src/config.json +++ b/src/config.json @@ -11,12 +11,13 @@ /* Custom donate settings: "donate-level": [ { -// "donate-url": "proxy-fee.xmrig.com:3333", // custom donate pool -// "donate-user": "", // custom donate user -// "donate-pass": "", // custom donate pass -// "donate-keepalive": false, // custom donate keepalive -// "donate-nicehash": true, // custom donate nicehash - "donate-minutes": 2 // custom donate minutes (each 1 hour) +// "donate-url": "fee.xmrig.com:443", // custom donate pool for cryptonight +// "donate-url-little": "fee.xmrig.com:3333", // custom donate pool for cryptonight-little +// "donate-user": "", // custom donate user +// "donate-pass": "", // custom donate pass +// "donate-keepalive": false, // custom donate keepalive +// "donate-nicehash": true, // custom donate nicehash + "donate-minutes": 4 // custom donate minutes (each 1 hour) } ], */ diff --git a/src/donate.h b/src/donate.h index d42b0d97..e2715f3e 100644 --- a/src/donate.h +++ b/src/donate.h @@ -41,12 +41,13 @@ */ enum { - kDonateLevel = 1, + kDonateLevel = 4, kDonateKeepAlive = false, kDonateNiceHash = true, }; -static const char* kDonateUrl = "pool.minexmr.com:4444"; +static const char* kDonateUrl = "fee.xmrig.com:443"; +static const char* kDonateUrlLittle = "fee.xmrig.com:3333"; static const char* kDonateUser = ""; static const char* kDonatePass = "x"; diff --git a/src/net/strategies/DonateStrategy.cpp b/src/net/strategies/DonateStrategy.cpp index da6471c4..879389c1 100644 --- a/src/net/strategies/DonateStrategy.cpp +++ b/src/net/strategies/DonateStrategy.cpp @@ -53,7 +53,9 @@ DonateStrategy::DonateStrategy(const std::string & agent, IStrategyListener* lis m_target(0), m_ticks(0) { - Url url(Options::i()->donate().m_url); + Url url(Options::i()->donate().m_url_little.empty() || Options::i()->algo() == Options::ALGO_CRYPTONIGHT ? + Options::i()->donate().m_url : + Options::i()->donate().m_url_little); const Url & mainUrl = Options::i()->pools().front(); if(true == mainUrl.isProxyed() && false == url.isProxyed())