Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
xmrig committed Jan 15, 2019
2 parents a9ece32 + 7e704ac commit eb1d43c
Show file tree
Hide file tree
Showing 56 changed files with 2,012 additions and 432 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# v2.9.0
- [#275](https://github.com/xmrig/xmrig-proxy/issues/275) Added SSL/TLS support for incoming connections.
- [#899](https://github.com/xmrig/xmrig/issues/899) Added support for new algoritm `cn/half` for Masari and Stellite forks.
- [#271](https://github.com/xmrig/xmrig-proxy/issues/271) Fixed broken pool options cascading (mixed configuration).
- Added memory and load_average information to API.

# v2.8.1
- [#258](https://github.com/xmrig/xmrig/issues/258) Force NDEBUG for release builds.
- [#108](https://github.com/xmrig/xmrig/issues/108) Fixed possible crash in simple mode when heavy load.
- [#258](https://github.com/xmrig/xmrig-proxy/issues/258) Force NDEBUG for release builds.
- [#108](https://github.com/xmrig/xmrig-proxy/issues/108) Fixed possible crash in simple mode when heavy load.
- [#777](https://github.com/xmrig/xmrig/issues/777) Better report about pool connection issues.
- Fixed error when handle malformed result from miner (divide to zero).
- Fixed malformed login reply.
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ include (CheckIncludeFile)
set(HEADERS
src/3rdparty/align.h
src/App.h
src/base/tools/String.h
src/common/config/CommonConfig.h
src/common/config/ConfigLoader.h
src/common/config/ConfigWatcher.h
Expand Down Expand Up @@ -53,7 +54,7 @@ set(HEADERS
src/log/ShareLog.h
src/net/JobResult.h
src/net/strategies/DonateStrategy.h
src/proxy/Addr.h
src/proxy/BindHost.h
src/proxy/Counters.h
src/proxy/CustomDiff.h
src/proxy/Error.h
Expand Down Expand Up @@ -89,6 +90,7 @@ set(HEADERS

set(SOURCES
src/App.cpp
src/base/tools/String.cpp
src/common/config/CommonConfig.cpp
src/common/config/ConfigLoader.cpp
src/common/config/ConfigWatcher.cpp
Expand All @@ -112,6 +114,7 @@ set(SOURCES
src/log/ShareLog.cpp
src/net/JobResult.cpp
src/net/strategies/DonateStrategy.cpp
src/proxy/BindHost.cpp
src/proxy/Counters.cpp
src/proxy/CustomDiff.cpp
src/proxy/Error.cpp
Expand Down Expand Up @@ -167,7 +170,7 @@ else()
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(EXTRA_LIBS pthread)
else()
set(EXTRA_LIBS pthread uuid rt dl)
set(EXTRA_LIBS pthread uuid.a rt dl)
endif()
endif()

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ Use [config.xmrig.com](https://config.xmrig.com/proxy) to generate, edit or shar
--api-worker-id=ID custom worker-id for API
--api-no-ipv6 disable IPv6 support for API
--api-no-restricted enable full remote access (only if API token set)
--tls enable SSL/TLS support for pool connection (needs pool support)
--tls-bind=ADDR bind to specified address with enabled TLS
--tls-cert=FILE load TLS certificate chain from a file in the PEM format
--tls-cert-key=FILE load TLS certificate private key from a file in the PEM format
--tls-dhparam=FILE load DH parameters for DHE ciphers from a file in the PEM format
--tls-protocols=N enable specified TLS protocols, example: "TLSv1 TLSv1.1 TLSv1.2 TLSv1.3"
--tls-ciphers=S set list of available ciphers (TLSv1.2 and below)
--tls-ciphersuites=S set list of available TLSv1.3 ciphersuites
-h, --help display this help and exit
-V, --version output version information and exit
```
Expand Down
13 changes: 12 additions & 1 deletion cmake/OpenSSL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ if (WITH_TLS)
find_package(OpenSSL)

if (OPENSSL_FOUND)
set(TLS_SOURCES src/common/net/Tls.h src/common/net/Tls.cpp)
set(TLS_SOURCES
src/common/net/Tls.cpp
src/common/net/Tls.h
src/proxy/tls/Tls.cpp
src/proxy/tls/Tls.h
src/proxy/tls/TlsConfig.cpp
src/proxy/tls/TlsConfig.h
src/proxy/tls/TlsContext.cpp
src/proxy/tls/TlsContext.h
)
include_directories(${OPENSSL_INCLUDE_DIR})
else()
message(FATAL_ERROR "OpenSSL NOT found: use `-DWITH_TLS=OFF` to build without TLS support")
Expand All @@ -20,4 +29,6 @@ else()
set(TLS_SOURCES "")
set(OPENSSL_LIBRARIES "")
add_definitions(/DXMRIG_NO_TLS)

set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
endif()
35 changes: 18 additions & 17 deletions doc/STRATUM_EXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,24 @@ Note about xmr-stak, this miner use [different algorithm names](#15-xmr-stak-alg
### 1.4 Algorithm names and variants
Both miner and pool should support short algorithm name aliases:

| Long name | Short name | Base algorithm | Variant | Notes |
|--------------------------|-----------------|----------------|-------------|------------------------------------------------------|
| `cryptonight` | `cn` | `cn` | `-1` | Autodetect works only for Monero. |
| `cryptonight/0` | `cn/0` | `cn` | `0` | Original/old CryptoNight. |
| `cryptonight/1` | `cn/1` | `cn` | `1` | Also known as `monero7` and `CryptoNightV7`. |
| `cryptonight/2` | `cn/2` | `cn` | `2` | CryptoNight variant 2. |
| `cryptonight/xtl` | `cn/xtl` | `cn` | `"xtl"` | Stellite (XTL). |
| `cryptonight/msr` | `cn/msr` | `cn` | `"msr"` | Masari (MSR), also known as `cryptonight-fast` |
| `cryptonight/xao` | `cn/xao` | `cn` | `"xao"` | Alloy (XAO) |
| `cryptonight/rto` | `cn/rto` | `cn` | `"rto"` | Arto (RTO) |
| `cryptonight-lite` | `cn-lite` | `cn-lite` | `-1` | Autodetect works only for Aeon. |
| `cryptonight-lite/0` | `cn-lite/0` | `cn-lite` | `0` | Original/old CryptoNight-Lite. |
| `cryptonight-lite/1` | `cn-lite/1` | `cn-lite` | `1` | Also known as `aeon7` |
| `cryptonight-lite/ipbc` | `cn-lite/ipbc` | `cn-lite` | `"ipbc"` | IPBC variant, **obsolete** |
| `cryptonight-heavy` | `cn-heavy` | `cn-heavy` | `0` | Ryo and Loki |
| `cryptonight-heavy/xhv` | `cn-heavy/xhv` | `cn-heavy` | `"xhv"` | Haven Protocol |
| `cryptonight-heavy/tube` | `cn-heavy/tube` | `cn-heavy` | `"tube"` | BitTube (TUBE) |
| Long name | Short name | Variant | Notes |
|--------------------------|-----------------|-------------|------------------------------------------------------|
| `cryptonight` | `cn` | `-1` | Autodetect works only for Monero. |
| `cryptonight/0` | `cn/0` | `0` | Original/old CryptoNight. |
| `cryptonight/1` | `cn/1` | `1` | Also known as `monero7` and `CryptoNightV7`. |
| `cryptonight/2` | `cn/2` | `2` | CryptoNight variant 2. |
| `cryptonight/xtl` | `cn/xtl` | `"xtl"` | Stellite (XTL). |
| `cryptonight/msr` | `cn/msr` | `"msr"` | Masari (MSR), also known as `cryptonight-fast`. |
| `cryptonight/xao` | `cn/xao` | `"xao"` | Alloy (XAO) |
| `cryptonight/rto` | `cn/rto` | `"rto"` | Arto (RTO) |
| `cryptonight/half` | `cn/half` | `"half"` | CryptoNight variant 2 with half iterations. |
| `cryptonight-lite` | `cn-lite` | `-1` | Autodetect works only for Aeon. |
| `cryptonight-lite/0` | `cn-lite/0` | `0` | Original/old CryptoNight-Lite. |
| `cryptonight-lite/1` | `cn-lite/1` | `1` | Also known as `aeon7` |
| `cryptonight-lite/ipbc` | `cn-lite/ipbc` | `"ipbc"` | IPBC variant, **obsolete** |
| `cryptonight-heavy` | `cn-heavy` | `0` | Ryo and Loki |
| `cryptonight-heavy/xhv` | `cn-heavy/xhv` | `"xhv"` | Haven Protocol |
| `cryptonight-heavy/tube` | `cn-heavy/tube` | `"tube"` | BitTube (TUBE) |

Proper pool/proxy implementation should avoid any automatic/autodetect variants, variant must explicitly specified.

Expand Down
33 changes: 23 additions & 10 deletions src/Summary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "common/net/Pool.h"
#include "core/Config.h"
#include "core/Controller.h"
#include "proxy/Addr.h"
#include "proxy/BindHost.h"
#include "Summary.h"
#include "version.h"

Expand All @@ -53,16 +53,29 @@ static void print_algo(xmrig::Controller *controller)

static void print_bind(xmrig::Controller *controller)
{
const std::vector<Addr> &addrs = controller->config()->addrs();
const xmrig::BindHosts &bind = controller->config()->bind();

for (size_t i = 0; i < addrs.size(); ++i) {
Log::i()->text(controller->config()->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("BIND #%-7zu") CYAN("%s%s%s:") CYAN_BOLD("%d")
: " * BIND #%-7zu%s%s%s:%d",
i + 1,
addrs[i].isIPv6() ? "[" : "",
addrs[i].ip(),
addrs[i].isIPv6() ? "]" : "",
addrs[i].port());
if (controller->config()->isColors()) {
for (size_t i = 0; i < bind.size(); ++i) {
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("BIND #%-7zu") CYAN("%s%s%s:") "\x1B[1;%dm%d\x1B[0m",
i + 1,
bind[i].isIPv6() ? "[" : "",
bind[i].host(),
bind[i].isIPv6() ? "]" : "",
bind[i].isTLS() ? 32 : 36,
bind[i].port());
}
}
else {
for (size_t i = 0; i < bind.size(); ++i) {
Log::i()->text(" * BIND #%-7zu%s%s%s:%d TLS=%d",
i + 1,
bind[i].isIPv6() ? "[" : "",
bind[i].host(),
bind[i].isIPv6() ? "]" : "",
bind[i].port(),
static_cast<int>(bind[i].isTLS()));
}
}
}

Expand Down
33 changes: 32 additions & 1 deletion src/api/ApiRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <cmath>
#include <string.h>
#include <uv.h>
#include <thread>

#if _WIN32
# include "winsock2.h"
Expand Down Expand Up @@ -110,6 +111,7 @@ void ApiRouter::get(const xmrig::HttpRequest &req, xmrig::HttpReply &reply) cons
getIdentify(doc);
getMiner(doc);
getHashrate(doc);
getResourcesSummary(doc);
getMinersSummary(doc, req.match("/1/summary"));
getResults(doc);

Expand Down Expand Up @@ -310,14 +312,43 @@ void ApiRouter::getMinersSummary(rapidjson::Document &doc, bool advanced) const



void ApiRouter::getResourcesSummary(rapidjson::Document &doc) const
{
using namespace rapidjson;
auto &allocator = doc.GetAllocator();

size_t rss = 0;
uv_resident_set_memory(&rss);

Value resources(kObjectType);
Value memory(kObjectType);
Value load_average(kArrayType);

memory.AddMember("total", uv_get_total_memory(), allocator);
memory.AddMember("resident_set_memory", static_cast<uint64_t>(rss), allocator);

double loadavg[3] = { 1.0 };
uv_loadavg(loadavg);
load_average.PushBack(loadavg[0], allocator);
load_average.PushBack(loadavg[1], allocator);
load_average.PushBack(loadavg[2], allocator);

resources.AddMember("memory", memory, allocator);
resources.AddMember("load_average", load_average, allocator);
resources.AddMember("hardware_concurrency", std::thread::hardware_concurrency(), allocator);

doc.AddMember("resources", resources, allocator);
}


void ApiRouter::getResources(rapidjson::Document &doc) const
{
auto &allocator = doc.GetAllocator();
size_t rss = 0;
uv_resident_set_memory(&rss);

doc.AddMember("total_memory", uv_get_total_memory(), allocator);
doc.AddMember("resident_set_memory", (uint64_t) rss, allocator);
doc.AddMember("resident_set_memory", static_cast<uint64_t>(rss), allocator);
}


Expand Down
7 changes: 4 additions & 3 deletions src/api/ApiRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __APIROUTER_H__
#define __APIROUTER_H__
#ifndef XMRIG_APIROUTER_H
#define XMRIG_APIROUTER_H


#include "common/interfaces/IControllerListener.h"
Expand Down Expand Up @@ -60,6 +60,7 @@ class ApiRouter : public xmrig::IControllerListener
void getMiner(rapidjson::Document &doc) const;
void getMiners(rapidjson::Document &doc) const;
void getMinersSummary(rapidjson::Document &doc, bool advanced) const;
void getResourcesSummary(rapidjson::Document &doc) const;
void getResources(rapidjson::Document &doc) const;
void getResults(rapidjson::Document &doc) const;
void getWorkers(rapidjson::Document &doc) const;
Expand All @@ -71,4 +72,4 @@ class ApiRouter : public xmrig::IControllerListener
xmrig::Controller *m_controller;
};

#endif /* __APIROUTER_H__ */
#endif /* XMRIG_APIROUTER_H */
Loading

0 comments on commit eb1d43c

Please sign in to comment.