Added "donate-over-proxy" option.
This commit is contained in:
parent
55686c7d57
commit
0907d1eb0c
15 changed files with 229 additions and 141 deletions
|
@ -741,6 +741,11 @@ void xmrig::Client::parseExtensions(const rapidjson::Value &result)
|
|||
else if (strcmp(name, "keepalive") == 0) {
|
||||
setExtension(EXT_KEEPALIVE, true);
|
||||
}
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
else if (strcmp(name, "tls") == 0) {
|
||||
setExtension(EXT_TLS, true);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
EXT_ALGO,
|
||||
EXT_NICEHASH,
|
||||
EXT_CONNECT,
|
||||
EXT_TLS,
|
||||
EXT_KEEPALIVE,
|
||||
EXT_MAX
|
||||
};
|
||||
|
|
|
@ -27,12 +27,15 @@
|
|||
#include "base/net/stratum/strategies/FailoverStrategy.h"
|
||||
#include "base/net/stratum/strategies/SinglePoolStrategy.h"
|
||||
#include "common/log/Log.h"
|
||||
#include "donate.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
xmrig::Pools::Pools() :
|
||||
m_donateLevel(kDefaultDonateLevel),
|
||||
m_retries(5),
|
||||
m_retryPause(5)
|
||||
m_retryPause(5),
|
||||
m_proxyDonate(PROXY_DONATE_AUTO)
|
||||
{
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
m_retries = 2;
|
||||
|
@ -191,6 +194,25 @@ void xmrig::Pools::print() const
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Pools::setDonateLevel(int level)
|
||||
{
|
||||
if (level >= kMinimumDonateLevel && level <= 99) {
|
||||
m_donateLevel = level;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pools::setProxyDonate(int value)
|
||||
{
|
||||
switch (value) {
|
||||
case PROXY_DONATE_NONE:
|
||||
case PROXY_DONATE_AUTO:
|
||||
case PROXY_DONATE_ALWAYS:
|
||||
m_proxyDonate = static_cast<ProxyDonate>(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pools::setRetries(int retries)
|
||||
{
|
||||
if (retries > 0 && retries <= 1000) {
|
||||
|
|
|
@ -42,12 +42,20 @@ class IStrategyListener;
|
|||
class Pools
|
||||
{
|
||||
public:
|
||||
enum ProxyDonate {
|
||||
PROXY_DONATE_NONE,
|
||||
PROXY_DONATE_AUTO,
|
||||
PROXY_DONATE_ALWAYS
|
||||
};
|
||||
|
||||
Pools();
|
||||
|
||||
inline bool setUserpass(const char *userpass) { return current().setUserpass(userpass); }
|
||||
inline const std::vector<Pool> &data() const { return m_data; }
|
||||
inline int donateLevel() const { return m_donateLevel; }
|
||||
inline int retries() const { return m_retries; }
|
||||
inline int retryPause() const { return m_retryPause; }
|
||||
inline ProxyDonate proxyDonate() const { return m_proxyDonate; }
|
||||
inline void setFingerprint(const char *fingerprint) { current().setFingerprint(fingerprint); }
|
||||
inline void setKeepAlive(bool enable) { current().setKeepAlive(enable); }
|
||||
inline void setKeepAlive(int keepAlive) { current().setKeepAlive(keepAlive); }
|
||||
|
@ -70,14 +78,18 @@ public:
|
|||
void adjust(const Algorithm &algorithm);
|
||||
void load(const rapidjson::Value &pools);
|
||||
void print() const;
|
||||
void setDonateLevel(int level);
|
||||
void setProxyDonate(int value);
|
||||
void setRetries(int retries);
|
||||
void setRetryPause(int retryPause);
|
||||
|
||||
private:
|
||||
Pool ¤t();
|
||||
|
||||
int m_donateLevel;
|
||||
int m_retries;
|
||||
int m_retryPause;
|
||||
ProxyDonate m_proxyDonate;
|
||||
std::vector<Pool> m_data;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue