mirror of
https://github.com/xmrig/xmrig.git
synced 2025-03-12 09:37:35 +00:00
Use XMRIG_FEATURE_TLS instead of XMRIG_NO_TLS
This commit is contained in:
parent
5db458efd4
commit
034720e888
8 changed files with 19 additions and 31 deletions
cmake
src
base
common
|
@ -18,12 +18,10 @@ if (WITH_TLS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(/DXMRIG_FEATURE_TLS)
|
add_definitions(/DXMRIG_FEATURE_TLS)
|
||||||
remove_definitions(/DXMRIG_NO_TLS)
|
|
||||||
else()
|
else()
|
||||||
set(TLS_SOURCES "")
|
set(TLS_SOURCES "")
|
||||||
set(OPENSSL_LIBRARIES "")
|
set(OPENSSL_LIBRARIES "")
|
||||||
remove_definitions(/DXMRIG_FEATURE_TLS)
|
remove_definitions(/DXMRIG_FEATURE_TLS)
|
||||||
add_definitions(/DXMRIG_NO_TLS)
|
|
||||||
|
|
||||||
set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
|
set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef XMRIG_NO_TLS
|
#ifdef XMRIG_FEATURE_TLS
|
||||||
# include <openssl/opensslv.h>
|
# include <openssl/opensslv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ static int showVersion()
|
||||||
printf("microhttpd/%s\n", MHD_get_version());
|
printf("microhttpd/%s\n", MHD_get_version());
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if !defined(XMRIG_NO_TLS) && defined(OPENSSL_VERSION_TEXT)
|
# if defined(XMRIG_FEATURE_TLS) && defined(OPENSSL_VERSION_TEXT)
|
||||||
{
|
{
|
||||||
constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
|
constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
|
||||||
printf("OpenSSL/%.*s\n", static_cast<int>(strchr(v, ' ') - v), v);
|
printf("OpenSSL/%.*s\n", static_cast<int>(strchr(v, ' ') - v), v);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
#ifndef XMRIG_NO_TLS
|
#ifdef XMRIG_FEATURE_TLS
|
||||||
# include <openssl/ssl.h>
|
# include <openssl/ssl.h>
|
||||||
# include <openssl/err.h>
|
# include <openssl/err.h>
|
||||||
# include "base/net/stratum/Tls.h"
|
# include "base/net/stratum/Tls.h"
|
||||||
|
@ -107,7 +107,7 @@ xmrig::Client::~Client()
|
||||||
|
|
||||||
void xmrig::Client::connect()
|
void xmrig::Client::connect()
|
||||||
{
|
{
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
if (m_pool.isTLS()) {
|
if (m_pool.isTLS()) {
|
||||||
m_tls = new Tls(this);
|
m_tls = new Tls(this);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ bool xmrig::Client::disconnect()
|
||||||
|
|
||||||
bool xmrig::Client::isTLS() const
|
bool xmrig::Client::isTLS() const
|
||||||
{
|
{
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
return m_pool.isTLS() && m_tls;
|
return m_pool.isTLS() && m_tls;
|
||||||
# else
|
# else
|
||||||
return false;
|
return false;
|
||||||
|
@ -194,7 +194,7 @@ bool xmrig::Client::isTLS() const
|
||||||
|
|
||||||
const char *xmrig::Client::tlsFingerprint() const
|
const char *xmrig::Client::tlsFingerprint() const
|
||||||
{
|
{
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
if (isTLS() && m_pool.fingerprint() == nullptr) {
|
if (isTLS() && m_pool.fingerprint() == nullptr) {
|
||||||
return m_tls->fingerprint();
|
return m_tls->fingerprint();
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ const char *xmrig::Client::tlsFingerprint() const
|
||||||
|
|
||||||
const char *xmrig::Client::tlsVersion() const
|
const char *xmrig::Client::tlsVersion() const
|
||||||
{
|
{
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
if (isTLS()) {
|
if (isTLS()) {
|
||||||
return m_tls->version();
|
return m_tls->version();
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ bool xmrig::Client::parseLogin(const rapidjson::Value &result, int *code)
|
||||||
|
|
||||||
bool xmrig::Client::send(BIO *bio)
|
bool xmrig::Client::send(BIO *bio)
|
||||||
{
|
{
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
uv_buf_t buf;
|
uv_buf_t buf;
|
||||||
buf.len = BIO_get_mem_data(bio, &buf.base);
|
buf.len = BIO_get_mem_data(bio, &buf.base);
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ int64_t xmrig::Client::send(size_t size)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("[%s] send (%d bytes): \"%s\"", url(), size, m_sendBuf);
|
LOG_DEBUG("[%s] send (%d bytes): \"%s\"", url(), size, m_sendBuf);
|
||||||
|
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
if (isTLS()) {
|
if (isTLS()) {
|
||||||
if (!m_tls->send(m_sendBuf, size)) {
|
if (!m_tls->send(m_sendBuf, size)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -597,7 +597,7 @@ void xmrig::Client::connect(sockaddr *addr)
|
||||||
|
|
||||||
void xmrig::Client::handshake()
|
void xmrig::Client::handshake()
|
||||||
{
|
{
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
if (isTLS()) {
|
if (isTLS()) {
|
||||||
m_expire = Chrono::steadyMSecs() + kResponseTimeout;
|
m_expire = Chrono::steadyMSecs() + kResponseTimeout;
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ void xmrig::Client::onClose()
|
||||||
m_socket = nullptr;
|
m_socket = nullptr;
|
||||||
setState(UnconnectedState);
|
setState(UnconnectedState);
|
||||||
|
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
if (m_tls) {
|
if (m_tls) {
|
||||||
delete m_tls;
|
delete m_tls;
|
||||||
m_tls = nullptr;
|
m_tls = nullptr;
|
||||||
|
@ -858,7 +858,7 @@ void xmrig::Client::read(ssize_t nread)
|
||||||
|
|
||||||
m_recvBuf.nread(size);
|
m_recvBuf.nread(size);
|
||||||
|
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
if (isTLS()) {
|
if (isTLS()) {
|
||||||
LOG_DEBUG("[%s] TLS received (%d bytes)", url(), static_cast<int>(nread));
|
LOG_DEBUG("[%s] TLS received (%d bytes)", url(), static_cast<int>(nread));
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
|
|
||||||
constexpr static int kResponseTimeout = 20 * 1000;
|
constexpr static int kResponseTimeout = 20 * 1000;
|
||||||
|
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
constexpr static int kInputBufferSize = 1024 * 16;
|
constexpr static int kInputBufferSize = 1024 * 16;
|
||||||
# else
|
# else
|
||||||
constexpr static int kInputBufferSize = 1024 * 2;
|
constexpr static int kInputBufferSize = 1024 * 2;
|
||||||
|
|
|
@ -178,7 +178,7 @@ bool xmrig::Pool::isCompatible(const Algorithm &algorithm) const
|
||||||
|
|
||||||
bool xmrig::Pool::isEnabled() const
|
bool xmrig::Pool::isEnabled() const
|
||||||
{
|
{
|
||||||
# ifdef XMRIG_NO_TLS
|
# ifndef XMRIG_FEATURE_TLS
|
||||||
if (isTLS()) {
|
if (isTLS()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
|
|
||||||
|
|
||||||
#ifndef XMRIG_NO_TLS
|
#ifdef XMRIG_FEATURE_TLS
|
||||||
# include <openssl/ssl.h>
|
# include <openssl/ssl.h>
|
||||||
# include <openssl/err.h>
|
# include <openssl/err.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,7 +41,7 @@ xmrig::String Platform::m_userAgent;
|
||||||
|
|
||||||
void Platform::init(const char *userAgent)
|
void Platform::init(const char *userAgent)
|
||||||
{
|
{
|
||||||
# ifndef XMRIG_NO_TLS
|
# ifdef XMRIG_FEATURE_TLS
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
ERR_load_BIO_strings();
|
ERR_load_BIO_strings();
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef XMRIG_NO_TLS
|
#ifdef XMRIG_FEATURE_TLS
|
||||||
# include <openssl/opensslv.h>
|
# include <openssl/opensslv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -131,12 +131,12 @@ void xmrig::CommonConfig::printVersions()
|
||||||
# else
|
# else
|
||||||
memset(buf, 0, 16);
|
memset(buf, 0, 16);
|
||||||
|
|
||||||
# if !defined(XMRIG_NO_HTTPD) || !defined(XMRIG_NO_TLS)
|
# if !defined(XMRIG_NO_HTTPD) || defined(XMRIG_FEATURE_TLS)
|
||||||
int length = 0;
|
int length = 0;
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if !defined(XMRIG_NO_TLS) && defined(OPENSSL_VERSION_TEXT)
|
# if defined(XMRIG_FEATURE_TLS) && defined(OPENSSL_VERSION_TEXT)
|
||||||
{
|
{
|
||||||
constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
|
constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
|
||||||
length += snprintf(buf + length, (sizeof buf) - length, "OpenSSL/%.*s ", static_cast<int>(strchr(v, ' ') - v), v);
|
length += snprintf(buf + length, (sizeof buf) - length, "OpenSSL/%.*s ", static_cast<int>(strchr(v, ' ') - v), v);
|
||||||
|
|
|
@ -29,16 +29,6 @@
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
|
|
||||||
|
|
||||||
#ifndef XMRIG_NO_HTTPD
|
|
||||||
# include <microhttpd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef XMRIG_NO_TLS
|
|
||||||
# include <openssl/opensslv.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "base/io/Json.h"
|
#include "base/io/Json.h"
|
||||||
#include "base/kernel/interfaces/IConfigListener.h"
|
#include "base/kernel/interfaces/IConfigListener.h"
|
||||||
#include "base/kernel/Process.h"
|
#include "base/kernel/Process.h"
|
||||||
|
|
Loading…
Reference in a new issue