Cleanup and added integrated tls config params parsing
This commit is contained in:
parent
16fff2fd51
commit
be293d72cd
16 changed files with 72 additions and 40 deletions
|
@ -268,8 +268,8 @@ void Client::connect()
|
|||
m_net->read_cb = Client::onRead;
|
||||
m_net->error_cb = Client::onError;
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
if (m_url.isTls()) {
|
||||
#ifndef XMRIG_NO_TLS
|
||||
if (m_url.useTls()) {
|
||||
tls_ctx* tls_ctx = tls_ctx_new();
|
||||
net_set_tls(m_net, tls_ctx);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ extern "C"
|
|||
{
|
||||
#include "net.h"
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
#include "tls.h"
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ Network::Network(const Options *options) :
|
|||
|
||||
const std::vector<Url*> &pools = options->pools();
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
ssl_init();
|
||||
#endif
|
||||
|
||||
|
@ -80,7 +80,7 @@ Network::Network(const Options *options) :
|
|||
|
||||
Network::~Network()
|
||||
{
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
ssl_destroy();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ Url::Url() :
|
|||
* @param url
|
||||
*/
|
||||
Url::Url(const char *url) :
|
||||
m_tls(false),
|
||||
m_useTls(false),
|
||||
m_keepAlive(false),
|
||||
m_nicehash(false),
|
||||
m_host(nullptr),
|
||||
|
@ -70,8 +70,8 @@ Url::Url(const char *url) :
|
|||
}
|
||||
|
||||
|
||||
Url::Url(const char *host, uint16_t port, const char *user, const char *password, bool tls, bool keepAlive, bool nicehash) :
|
||||
m_tls(tls),
|
||||
Url::Url(const char *host, uint16_t port, const char *user, const char *password, bool useTls, bool keepAlive, bool nicehash) :
|
||||
m_useTls(useTls),
|
||||
m_keepAlive(keepAlive),
|
||||
m_nicehash(nicehash),
|
||||
m_password(password ? strdup(password) : nullptr),
|
||||
|
@ -182,7 +182,7 @@ void Url::setUser(const char *user)
|
|||
|
||||
Url &Url::operator=(const Url *other)
|
||||
{
|
||||
m_tls = other->m_tls;
|
||||
m_useTls = other->m_useTls;
|
||||
m_keepAlive = other->m_keepAlive;
|
||||
m_nicehash = other->m_nicehash;
|
||||
m_port = other->m_port;
|
||||
|
|
|
@ -37,10 +37,10 @@ public:
|
|||
|
||||
Url();
|
||||
Url(const char *url);
|
||||
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool tls = false, bool keepAlive = false, bool nicehash = false );
|
||||
Url(const char *host, uint16_t port, const char *user = nullptr, const char *password = nullptr, bool useTls = false, bool keepAlive = false, bool nicehash = false );
|
||||
~Url();
|
||||
|
||||
inline bool isTls() const { return m_tls; }
|
||||
inline bool useTls() const { return m_useTls; }
|
||||
inline bool isKeepAlive() const { return m_keepAlive; }
|
||||
inline bool isNicehash() const { return m_nicehash; }
|
||||
inline bool isValid() const { return m_host && m_port > 0; }
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
inline const char *password() const { return m_password ? m_password : kDefaultPassword; }
|
||||
inline const char *user() const { return m_user ? m_user : kDefaultUser; }
|
||||
inline uint16_t port() const { return m_port; }
|
||||
inline void setTls(bool tls) { m_tls = tls; }
|
||||
inline void setUseTls(bool tls) { m_useTls = tls; }
|
||||
inline void setKeepAlive(bool keepAlive) { m_keepAlive = keepAlive; }
|
||||
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
Url &operator=(const Url *other);
|
||||
|
||||
private:
|
||||
bool m_tls;
|
||||
bool m_useTls;
|
||||
bool m_keepAlive;
|
||||
bool m_nicehash;
|
||||
char *m_host;
|
||||
|
|
|
@ -49,7 +49,7 @@ DonateStrategy::DonateStrategy(const char *agent, IStrategyListener *listener) :
|
|||
keccak(reinterpret_cast<const uint8_t *>(user), static_cast<int>(strlen(user)), hash, sizeof(hash));
|
||||
Job::toHex(hash, 32, userId);
|
||||
|
||||
#ifndef XMRIG_NO_SSL_TLS
|
||||
#ifndef XMRIG_NO_TLS
|
||||
Url *url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 8080 : 8081, userId, nullptr, true, false, true);
|
||||
#else
|
||||
Url *url = new Url("donate.graef.in", Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE ? 80 : 443, userId, nullptr, false, false, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue