New API settings.
This commit is contained in:
parent
1e0c410eea
commit
725796a1ab
14 changed files with 474 additions and 236 deletions
|
@ -21,6 +21,7 @@ include (src/base/base.cmake)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
"${HEADERS_BASE}"
|
"${HEADERS_BASE}"
|
||||||
|
"${HEADERS_BASE_HTTP}"
|
||||||
src/api/NetworkState.h
|
src/api/NetworkState.h
|
||||||
src/App.h
|
src/App.h
|
||||||
src/common/config/CommonConfig.h
|
src/common/config/CommonConfig.h
|
||||||
|
@ -80,6 +81,7 @@ endif()
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
"${SOURCES_BASE}"
|
"${SOURCES_BASE}"
|
||||||
|
"${SOURCES_BASE_HTTP}"
|
||||||
src/api/NetworkState.cpp
|
src/api/NetworkState.cpp
|
||||||
src/App.cpp
|
src/App.cpp
|
||||||
src/common/config/CommonConfig.cpp
|
src/common/config/CommonConfig.cpp
|
||||||
|
@ -220,14 +222,9 @@ if (WITH_HTTPD)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
|
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(/DXMRIG_FEATURE_HTTP)
|
|
||||||
add_definitions(/DXMRIG_FEATURE_API)
|
|
||||||
else()
|
else()
|
||||||
set(HTTPD_SOURCES "")
|
set(HTTPD_SOURCES "")
|
||||||
set(MHD_LIBRARY "")
|
set(MHD_LIBRARY "")
|
||||||
remove_definitions(/DXMRIG_FEATURE_HTTP)
|
|
||||||
remove_definitions(/DXMRIG_FEATURE_API)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(src)
|
include_directories(src)
|
||||||
|
|
|
@ -104,10 +104,10 @@ int xmrig::App::exec()
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_HTTP
|
# ifdef XMRIG_FEATURE_HTTP
|
||||||
m_httpd = new Httpd(
|
m_httpd = new Httpd(
|
||||||
m_controller->config()->apiPort(),
|
m_controller->config()->http().port(),
|
||||||
m_controller->config()->apiToken(),
|
m_controller->config()->http().token(),
|
||||||
m_controller->config()->isApiIPv6(),
|
false,
|
||||||
m_controller->config()->isApiRestricted()
|
m_controller->config()->http().isRestricted()
|
||||||
);
|
);
|
||||||
|
|
||||||
m_httpd->start();
|
m_httpd->start();
|
||||||
|
|
|
@ -142,8 +142,8 @@ void Summary::print(xmrig::Controller *controller)
|
||||||
print_memory(controller->config());
|
print_memory(controller->config());
|
||||||
print_cpu(controller->config());
|
print_cpu(controller->config());
|
||||||
print_threads(controller->config());
|
print_threads(controller->config());
|
||||||
controller->config()->printPools();
|
controller->config()->pools().print();
|
||||||
controller->config()->printAPI();
|
controller->config()->http().print();
|
||||||
|
|
||||||
print_commands(controller->config());
|
print_commands(controller->config());
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ void ApiRouter::genId(const char *id)
|
||||||
uint8_t hash[200];
|
uint8_t hash[200];
|
||||||
const size_t addrSize = sizeof(interfaces[i].phys_addr);
|
const size_t addrSize = sizeof(interfaces[i].phys_addr);
|
||||||
const size_t inSize = strlen(APP_KIND) + addrSize + sizeof(uint16_t);
|
const size_t inSize = strlen(APP_KIND) + addrSize + sizeof(uint16_t);
|
||||||
const uint16_t port = static_cast<uint16_t>(m_controller->config()->apiPort());
|
const uint16_t port = static_cast<uint16_t>(m_controller->config()->http().port());
|
||||||
|
|
||||||
uint8_t *input = new uint8_t[inSize]();
|
uint8_t *input = new uint8_t[inSize]();
|
||||||
memcpy(input, &port, sizeof(uint16_t));
|
memcpy(input, &port, sizeof(uint16_t));
|
||||||
|
|
|
@ -21,6 +21,7 @@ set(HEADERS_BASE
|
||||||
src/base/kernel/Signals.h
|
src/base/kernel/Signals.h
|
||||||
src/base/net/dns/Dns.h
|
src/base/net/dns/Dns.h
|
||||||
src/base/net/dns/DnsRecord.h
|
src/base/net/dns/DnsRecord.h
|
||||||
|
src/base/net/http/Http.h
|
||||||
src/base/net/stratum/Client.h
|
src/base/net/stratum/Client.h
|
||||||
src/base/net/stratum/Job.h
|
src/base/net/stratum/Job.h
|
||||||
src/base/net/stratum/Pool.h
|
src/base/net/stratum/Pool.h
|
||||||
|
@ -50,6 +51,7 @@ set(SOURCES_BASE
|
||||||
src/base/kernel/Signals.cpp
|
src/base/kernel/Signals.cpp
|
||||||
src/base/net/dns/Dns.cpp
|
src/base/net/dns/Dns.cpp
|
||||||
src/base/net/dns/DnsRecord.cpp
|
src/base/net/dns/DnsRecord.cpp
|
||||||
|
src/base/net/http/Http.cpp
|
||||||
src/base/net/stratum/Client.cpp
|
src/base/net/stratum/Client.cpp
|
||||||
src/base/net/stratum/Job.cpp
|
src/base/net/stratum/Job.cpp
|
||||||
src/base/net/stratum/Pool.cpp
|
src/base/net/stratum/Pool.cpp
|
||||||
|
@ -77,3 +79,24 @@ if (NOT WIN32)
|
||||||
set(SOURCES_SYSLOG src/base/io/log/backends/SysLog.h src/base/io/log/backends/SysLog.cpp)
|
set(SOURCES_SYSLOG src/base/io/log/backends/SysLog.h src/base/io/log/backends/SysLog.cpp)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if (WITH_HTTPD)
|
||||||
|
set(HEADERS_BASE_HTTP
|
||||||
|
# src/base/net/http/Http.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SOURCES_BASE_HTTP
|
||||||
|
# src/base/net/http/Http.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_definitions(/DXMRIG_FEATURE_HTTP)
|
||||||
|
add_definitions(/DXMRIG_FEATURE_API)
|
||||||
|
else()
|
||||||
|
set(HEADERS_BASE_HTTP "")
|
||||||
|
set(SOURCES_BASE_HTTP "")
|
||||||
|
remove_definitions(/DXMRIG_FEATURE_HTTP)
|
||||||
|
remove_definitions(/DXMRIG_FEATURE_API)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_definitions(/DXMRIG_DEPRECATED)
|
||||||
|
|
112
src/base/net/http/Http.cpp
Normal file
112
src/base/net/http/Http.cpp
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "3rdparty/rapidjson/document.h"
|
||||||
|
#include "base/io/Json.h"
|
||||||
|
#include "base/io/log/Log.h"
|
||||||
|
#include "base/net/http/Http.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
static const char *kEnabled = "enabled";
|
||||||
|
static const char *kHost = "host";
|
||||||
|
static const char *kLocalhost = "127.0.0.1";
|
||||||
|
static const char *kPort = "port";
|
||||||
|
static const char *kRestricted = "restricted";
|
||||||
|
static const char *kToken = "access-token";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xmrig::Http::Http() :
|
||||||
|
m_enabled(false),
|
||||||
|
m_restricted(true),
|
||||||
|
m_host(kLocalhost),
|
||||||
|
m_port(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Http::isEqual(const Http &other) const
|
||||||
|
{
|
||||||
|
return other.m_enabled == m_enabled &&
|
||||||
|
other.m_restricted == m_restricted &&
|
||||||
|
other.m_host == m_host &&
|
||||||
|
other.m_token == m_token &&
|
||||||
|
other.m_port == m_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rapidjson::Value xmrig::Http::toJSON(rapidjson::Document &doc) const
|
||||||
|
{
|
||||||
|
using namespace rapidjson;
|
||||||
|
auto &allocator = doc.GetAllocator();
|
||||||
|
|
||||||
|
Value obj(kObjectType);
|
||||||
|
|
||||||
|
obj.AddMember(StringRef(kEnabled), m_enabled, allocator);
|
||||||
|
obj.AddMember(StringRef(kHost), m_host.toJSON(), allocator);
|
||||||
|
obj.AddMember(StringRef(kPort), m_port, allocator);
|
||||||
|
obj.AddMember(StringRef(kToken), m_token.toJSON(), allocator);
|
||||||
|
obj.AddMember(StringRef(kRestricted), m_restricted, allocator);
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Http::load(const rapidjson::Value &http)
|
||||||
|
{
|
||||||
|
if (!http.IsObject()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_enabled = Json::getBool(http, kEnabled);
|
||||||
|
m_restricted = Json::getBool(http, kRestricted, true);
|
||||||
|
m_host = Json::getString(http, kHost, kLocalhost);
|
||||||
|
m_token = Json::getString(http, kToken);
|
||||||
|
|
||||||
|
setPort(Json::getInt(http, kPort));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Http::print() const
|
||||||
|
{
|
||||||
|
# ifdef XMRIG_FEATURE_API
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") BLUE_BOLD("http://%s:%d"), "HTTP API", host().data(), port());
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void xmrig::Http::setPort(int port)
|
||||||
|
{
|
||||||
|
if (port >= 0 && port <= 65536) {
|
||||||
|
m_port = static_cast<uint16_t>(port);
|
||||||
|
}
|
||||||
|
}
|
73
src/base/net/http/Http.h
Normal file
73
src/base/net/http/Http.h
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
/* XMRig
|
||||||
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||||
|
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||||
|
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||||
|
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||||
|
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||||
|
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||||
|
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef XMRIG_HTTP_H
|
||||||
|
#define XMRIG_HTTP_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "base/tools/String.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
class Http
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Http();
|
||||||
|
|
||||||
|
inline bool isEnabled() const { return m_enabled; }
|
||||||
|
inline bool isRestricted() const { return m_restricted; }
|
||||||
|
inline const String &host() const { return m_host; }
|
||||||
|
inline const String &token() const { return m_token; }
|
||||||
|
inline uint16_t port() const { return m_port; }
|
||||||
|
inline void setEnabled(bool enabled) { m_enabled = enabled; }
|
||||||
|
inline void setHost(const char *host) { m_host = host; }
|
||||||
|
inline void setRestricted(bool restricted) { m_restricted = restricted; }
|
||||||
|
inline void setToken(const char *token) { m_token = token; }
|
||||||
|
|
||||||
|
inline bool operator!=(const Http &other) const { return !isEqual(other); }
|
||||||
|
inline bool operator==(const Http &other) const { return isEqual(other); }
|
||||||
|
|
||||||
|
bool isEqual(const Http &other) const;
|
||||||
|
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||||
|
void load(const rapidjson::Value &http);
|
||||||
|
void print() const;
|
||||||
|
void setPort(int port);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_enabled;
|
||||||
|
bool m_restricted;
|
||||||
|
String m_host;
|
||||||
|
String m_token;
|
||||||
|
uint16_t m_port;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
|
#endif // XMRIG_HTTP_H
|
||||||
|
|
|
@ -66,38 +66,18 @@
|
||||||
xmrig::CommonConfig::CommonConfig() :
|
xmrig::CommonConfig::CommonConfig() :
|
||||||
m_algorithm(CRYPTONIGHT, VARIANT_AUTO),
|
m_algorithm(CRYPTONIGHT, VARIANT_AUTO),
|
||||||
m_adjusted(false),
|
m_adjusted(false),
|
||||||
m_apiIPv6(false),
|
|
||||||
m_apiRestricted(true),
|
|
||||||
m_autoSave(true),
|
m_autoSave(true),
|
||||||
m_background(false),
|
m_background(false),
|
||||||
m_dryRun(false),
|
m_dryRun(false),
|
||||||
m_syslog(false),
|
m_syslog(false),
|
||||||
|
m_upgrade(false),
|
||||||
m_watch(true),
|
m_watch(true),
|
||||||
m_apiPort(0),
|
|
||||||
m_printTime(60),
|
m_printTime(60),
|
||||||
m_state(NoneState)
|
m_state(NoneState)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void xmrig::CommonConfig::printAPI()
|
|
||||||
{
|
|
||||||
# ifdef XMRIG_FEATURE_API
|
|
||||||
if (apiPort() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN("%s:") CYAN_BOLD("%d"), "API BIND", isApiIPv6() ? "[::]" : "0.0.0.0", apiPort());
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xmrig::CommonConfig::printPools()
|
|
||||||
{
|
|
||||||
m_pools.print();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xmrig::CommonConfig::printVersions()
|
void xmrig::CommonConfig::printVersions()
|
||||||
{
|
{
|
||||||
char buf[256] = { 0 };
|
char buf[256] = { 0 };
|
||||||
|
@ -228,12 +208,23 @@ bool xmrig::CommonConfig::parseBoolean(int key, bool enable)
|
||||||
m_watch = enable;
|
m_watch = enable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ApiIPv6Key: /* ipv6 */
|
# ifdef XMRIG_DEPRECATED
|
||||||
m_apiIPv6 = enable;
|
case ApiIPv6Key: /* --api-ipv6 */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ApiRestrictedKey: /* restricted */
|
case ApiRestrictedKey: /* --api-no-restricted */
|
||||||
m_apiRestricted = enable;
|
fputs("option \"--api-no-restricted\" deprecated, use \"--http-no-restricted\" instead.\n", stderr);
|
||||||
|
fflush(stdout);
|
||||||
|
m_http.setRestricted(enable);
|
||||||
|
break;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
case HttpRestrictedKey: /* --http-no-restricted */
|
||||||
|
m_http.setRestricted(enable);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HttpEnabledKey: /* --http-enabled */
|
||||||
|
m_http.setEnabled(enable);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DryRunKey: /* --dry-run */
|
case DryRunKey: /* --dry-run */
|
||||||
|
@ -289,8 +280,20 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg)
|
||||||
m_logFile = arg;
|
m_logFile = arg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
# ifdef XMRIG_DEPRECATED
|
||||||
case ApiAccessTokenKey: /* --api-access-token */
|
case ApiAccessTokenKey: /* --api-access-token */
|
||||||
m_apiToken = arg;
|
fputs("option \"--api-access-token\" deprecated, use \"--http-access-token\" instead.\n", stderr);
|
||||||
|
fflush(stdout);
|
||||||
|
m_http.setToken(arg);
|
||||||
|
break;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
case HttpAccessTokenKey: /* --http-access-token */
|
||||||
|
m_http.setToken(arg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HttpHostKey: /* --http-host */
|
||||||
|
m_http.setHost(arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ApiWorkerIdKey: /* --api-worker-id */
|
case ApiWorkerIdKey: /* --api-worker-id */
|
||||||
|
@ -307,26 +310,33 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg)
|
||||||
|
|
||||||
case RetriesKey: /* --retries */
|
case RetriesKey: /* --retries */
|
||||||
case RetryPauseKey: /* --retry-pause */
|
case RetryPauseKey: /* --retry-pause */
|
||||||
case ApiPort: /* --api-port */
|
|
||||||
case PrintTimeKey: /* --print-time */
|
case PrintTimeKey: /* --print-time */
|
||||||
return parseUint64(key, strtol(arg, nullptr, 10));
|
case HttpPort: /* --http-port */
|
||||||
|
# ifdef XMRIG_DEPRECATED
|
||||||
|
case ApiPort: /* --api-port */
|
||||||
|
# endif
|
||||||
|
return parseUint64(key, static_cast<uint64_t>(strtol(arg, nullptr, 10)));
|
||||||
|
|
||||||
case BackgroundKey: /* --background */
|
case BackgroundKey: /* --background */
|
||||||
case SyslogKey: /* --syslog */
|
case SyslogKey: /* --syslog */
|
||||||
case KeepAliveKey: /* --keepalive */
|
case KeepAliveKey: /* --keepalive */
|
||||||
case NicehashKey: /* --nicehash */
|
case NicehashKey: /* --nicehash */
|
||||||
case TlsKey: /* --tls */
|
case TlsKey: /* --tls */
|
||||||
case ApiIPv6Key: /* --api-ipv6 */
|
case DryRunKey: /* --dry-run */
|
||||||
case DryRunKey: /* --dry-run */
|
case HttpEnabledKey: /* --http-enabled */
|
||||||
return parseBoolean(key, true);
|
return parseBoolean(key, true);
|
||||||
|
|
||||||
case ColorKey: /* --no-color */
|
case ColorKey: /* --no-color */
|
||||||
case WatchKey: /* --no-watch */
|
case WatchKey: /* --no-watch */
|
||||||
|
case HttpRestrictedKey: /* --http-no-restricted */
|
||||||
|
# ifdef XMRIG_DEPRECATED
|
||||||
case ApiRestrictedKey: /* --api-no-restricted */
|
case ApiRestrictedKey: /* --api-no-restricted */
|
||||||
|
case ApiIPv6Key: /* --api-ipv6 */
|
||||||
|
# endif
|
||||||
return parseBoolean(key, false);
|
return parseBoolean(key, false);
|
||||||
|
|
||||||
case DonateLevelKey: /* --donate-level */
|
case DonateLevelKey: /* --donate-level */
|
||||||
return parseUint64(key, strtol(arg, nullptr, 10));
|
return parseUint64(key, static_cast<uint64_t>(strtol(arg, nullptr, 10)));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -348,6 +358,19 @@ void xmrig::CommonConfig::parseJSON(const rapidjson::Document &doc)
|
||||||
if (pools.IsArray()) {
|
if (pools.IsArray()) {
|
||||||
m_pools.load(pools);
|
m_pools.load(pools);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef XMRIG_DEPRECATED
|
||||||
|
const rapidjson::Value &api = doc["api"];
|
||||||
|
if (api.IsObject() && api.HasMember("port")) {
|
||||||
|
m_upgrade = true;
|
||||||
|
m_http.load(api);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_http.load(doc["http"]);
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
m_http.load(doc["http"]);
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -384,10 +407,16 @@ bool xmrig::CommonConfig::parseInt(int key, int arg)
|
||||||
m_pools.setProxyDonate(arg);
|
m_pools.setProxyDonate(arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
# ifdef XMRIG_DEPRECATED
|
||||||
case ApiPort: /* --api-port */
|
case ApiPort: /* --api-port */
|
||||||
if (arg > 0 && arg <= 65536) {
|
fputs("option \"--api-port\" deprecated, use \"--http-port\" instead.\n", stderr);
|
||||||
m_apiPort = arg;
|
fflush(stdout);
|
||||||
}
|
m_http.setPort(arg);
|
||||||
|
break;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
case HttpPort: /* --http-port */
|
||||||
|
m_http.setPort(arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PrintTimeKey: /* --print-time */
|
case PrintTimeKey: /* --print-time */
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#define XMRIG_COMMONCONFIG_H
|
#define XMRIG_COMMONCONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "base/net/http/Http.h"
|
||||||
#include "base/net/stratum/Pools.h"
|
#include "base/net/stratum/Pools.h"
|
||||||
#include "base/tools/String.h"
|
|
||||||
#include "common/interfaces/IConfig.h"
|
#include "common/interfaces/IConfig.h"
|
||||||
#include "common/xmrig.h"
|
#include "common/xmrig.h"
|
||||||
|
|
||||||
|
@ -40,19 +40,16 @@ class CommonConfig : public IConfig
|
||||||
public:
|
public:
|
||||||
CommonConfig();
|
CommonConfig();
|
||||||
|
|
||||||
inline bool isApiIPv6() const { return m_apiIPv6; }
|
|
||||||
inline bool isApiRestricted() const { return m_apiRestricted; }
|
|
||||||
inline bool isAutoSave() const { return m_autoSave; }
|
inline bool isAutoSave() const { return m_autoSave; }
|
||||||
inline bool isBackground() const { return m_background; }
|
inline bool isBackground() const { return m_background; }
|
||||||
inline bool isDryRun() const { return m_dryRun; }
|
inline bool isDryRun() const { return m_dryRun; }
|
||||||
inline bool isSyslog() const { return m_syslog; }
|
inline bool isSyslog() const { return m_syslog; }
|
||||||
inline const char *apiId() const { return m_apiId.data(); }
|
inline const String &apiId() const { return m_apiId; }
|
||||||
inline const char *apiToken() const { return m_apiToken.data(); }
|
inline const String &apiWorkerId() const { return m_apiWorkerId; }
|
||||||
inline const char *apiWorkerId() const { return m_apiWorkerId.data(); }
|
|
||||||
inline const char *logFile() const { return m_logFile.data(); }
|
inline const char *logFile() const { return m_logFile.data(); }
|
||||||
inline const char *userAgent() const { return m_userAgent.data(); }
|
inline const char *userAgent() const { return m_userAgent.data(); }
|
||||||
|
inline const Http &http() const { return m_http; }
|
||||||
inline const Pools &pools() const { return m_pools; }
|
inline const Pools &pools() const { return m_pools; }
|
||||||
inline int apiPort() const { return m_apiPort; }
|
|
||||||
inline int printTime() const { return m_printTime; }
|
inline int printTime() const { return m_printTime; }
|
||||||
|
|
||||||
inline bool isWatch() const override { return m_watch && !m_fileName.isNull(); }
|
inline bool isWatch() const override { return m_watch && !m_fileName.isNull(); }
|
||||||
|
@ -61,8 +58,6 @@ public:
|
||||||
|
|
||||||
bool save() override;
|
bool save() override;
|
||||||
|
|
||||||
void printAPI();
|
|
||||||
void printPools();
|
|
||||||
void printVersions();
|
void printVersions();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -81,19 +76,17 @@ protected:
|
||||||
|
|
||||||
Algorithm m_algorithm;
|
Algorithm m_algorithm;
|
||||||
bool m_adjusted;
|
bool m_adjusted;
|
||||||
bool m_apiIPv6;
|
|
||||||
bool m_apiRestricted;
|
|
||||||
bool m_autoSave;
|
bool m_autoSave;
|
||||||
bool m_background;
|
bool m_background;
|
||||||
bool m_dryRun;
|
bool m_dryRun;
|
||||||
bool m_syslog;
|
bool m_syslog;
|
||||||
|
bool m_upgrade;
|
||||||
bool m_watch;
|
bool m_watch;
|
||||||
int m_apiPort;
|
Http m_http;
|
||||||
int m_printTime;
|
int m_printTime;
|
||||||
Pools m_pools;
|
Pools m_pools;
|
||||||
State m_state;
|
State m_state;
|
||||||
String m_apiId;
|
String m_apiId;
|
||||||
String m_apiToken;
|
|
||||||
String m_apiWorkerId;
|
String m_apiWorkerId;
|
||||||
String m_fileName;
|
String m_fileName;
|
||||||
String m_logFile;
|
String m_logFile;
|
||||||
|
|
|
@ -41,94 +41,102 @@ class IConfig
|
||||||
public:
|
public:
|
||||||
enum Keys {
|
enum Keys {
|
||||||
// common
|
// common
|
||||||
AlgorithmKey = 'a',
|
AlgorithmKey = 'a',
|
||||||
ApiAccessTokenKey = 4001,
|
ApiWorkerIdKey = 4002,
|
||||||
ApiIPv6Key = 4003,
|
ApiIdKey = 4005,
|
||||||
ApiPort = 4000,
|
HttpPort = 4100,
|
||||||
ApiRestrictedKey = 4004,
|
HttpAccessTokenKey = 4101,
|
||||||
ApiWorkerIdKey = 4002,
|
HttpRestrictedKey = 4104,
|
||||||
ApiIdKey = 4005,
|
HttpEnabledKey = 4106,
|
||||||
BackgroundKey = 'B',
|
HttpHostKey = 4107,
|
||||||
ColorKey = 1002,
|
BackgroundKey = 'B',
|
||||||
ConfigKey = 'c',
|
ColorKey = 1002,
|
||||||
DonateLevelKey = 1003,
|
ConfigKey = 'c',
|
||||||
KeepAliveKey = 'k',
|
DonateLevelKey = 1003,
|
||||||
LogFileKey = 'l',
|
KeepAliveKey = 'k',
|
||||||
PasswordKey = 'p',
|
LogFileKey = 'l',
|
||||||
RetriesKey = 'r',
|
PasswordKey = 'p',
|
||||||
RetryPauseKey = 'R',
|
RetriesKey = 'r',
|
||||||
RigIdKey = 1012,
|
RetryPauseKey = 'R',
|
||||||
SyslogKey = 'S',
|
RigIdKey = 1012,
|
||||||
UrlKey = 'o',
|
SyslogKey = 'S',
|
||||||
UserAgentKey = 1008,
|
UrlKey = 'o',
|
||||||
UserKey = 'u',
|
UserAgentKey = 1008,
|
||||||
UserpassKey = 'O',
|
UserKey = 'u',
|
||||||
VariantKey = 1010,
|
UserpassKey = 'O',
|
||||||
VerboseKey = 1100,
|
VariantKey = 1010,
|
||||||
WatchKey = 1105,
|
VerboseKey = 1100,
|
||||||
TlsKey = 1013,
|
WatchKey = 1105,
|
||||||
FingerprintKey = 1014,
|
TlsKey = 1013,
|
||||||
AutoSaveKey = 1016,
|
FingerprintKey = 1014,
|
||||||
ProxyDonateKey = 1017,
|
AutoSaveKey = 1016,
|
||||||
|
ProxyDonateKey = 1017,
|
||||||
|
|
||||||
|
# ifdef XMRIG_DEPRECATED
|
||||||
|
ApiPort = 4000,
|
||||||
|
ApiAccessTokenKey = 4001,
|
||||||
|
ApiIPv6Key = 4003,
|
||||||
|
ApiRestrictedKey = 4004,
|
||||||
|
# endif
|
||||||
|
|
||||||
// xmrig common
|
// xmrig common
|
||||||
CPUPriorityKey = 1021,
|
CPUPriorityKey = 1021,
|
||||||
NicehashKey = 1006,
|
NicehashKey = 1006,
|
||||||
PrintTimeKey = 1007,
|
PrintTimeKey = 1007,
|
||||||
|
|
||||||
// xmrig cpu
|
// xmrig cpu
|
||||||
AVKey = 'v',
|
AVKey = 'v',
|
||||||
CPUAffinityKey = 1020,
|
CPUAffinityKey = 1020,
|
||||||
DryRunKey = 5000,
|
DryRunKey = 5000,
|
||||||
HugePagesKey = 1009,
|
HugePagesKey = 1009,
|
||||||
MaxCPUUsageKey = 1004,
|
MaxCPUUsageKey = 1004,
|
||||||
SafeKey = 1005,
|
SafeKey = 1005,
|
||||||
ThreadsKey = 't',
|
ThreadsKey = 't',
|
||||||
HardwareAESKey = 1011,
|
HardwareAESKey = 1011,
|
||||||
AssemblyKey = 1015,
|
AssemblyKey = 1015,
|
||||||
|
|
||||||
// xmrig amd
|
// xmrig amd
|
||||||
OclPlatformKey = 1400,
|
OclPlatformKey = 1400,
|
||||||
OclAffinityKey = 1401,
|
OclAffinityKey = 1401,
|
||||||
OclDevicesKey = 1402,
|
OclDevicesKey = 1402,
|
||||||
OclLaunchKey = 1403,
|
OclLaunchKey = 1403,
|
||||||
OclCacheKey = 1404,
|
OclCacheKey = 1404,
|
||||||
OclPrintKey = 1405,
|
OclPrintKey = 1405,
|
||||||
OclLoaderKey = 1406,
|
OclLoaderKey = 1406,
|
||||||
OclSridedIndexKey = 1407,
|
OclSridedIndexKey = 1407,
|
||||||
OclMemChunkKey = 1408,
|
OclMemChunkKey = 1408,
|
||||||
OclUnrollKey = 1409,
|
OclUnrollKey = 1409,
|
||||||
OclCompModeKey = 1410,
|
OclCompModeKey = 1410,
|
||||||
|
|
||||||
// xmrig-proxy
|
// xmrig-proxy
|
||||||
AccessLogFileKey = 'A',
|
AccessLogFileKey = 'A',
|
||||||
BindKey = 'b',
|
BindKey = 'b',
|
||||||
CoinKey = 1104,
|
CoinKey = 1104,
|
||||||
CustomDiffKey = 1102,
|
CustomDiffKey = 1102,
|
||||||
DebugKey = 1101,
|
DebugKey = 1101,
|
||||||
ModeKey = 'm',
|
ModeKey = 'm',
|
||||||
PoolCoinKey = 'C',
|
PoolCoinKey = 'C',
|
||||||
ReuseTimeoutKey = 1106,
|
ReuseTimeoutKey = 1106,
|
||||||
WorkersKey = 1103,
|
WorkersKey = 1103,
|
||||||
WorkersAdvKey = 1107,
|
WorkersAdvKey = 1107,
|
||||||
TlsBindKey = 1108,
|
TlsBindKey = 1108,
|
||||||
TlsCertKey = 1109,
|
TlsCertKey = 1109,
|
||||||
TlsCertKeyKey = 1110,
|
TlsCertKeyKey = 1110,
|
||||||
TlsDHparamKey = 1111,
|
TlsDHparamKey = 1111,
|
||||||
TlsCiphersKey = 1112,
|
TlsCiphersKey = 1112,
|
||||||
TlsCipherSuitesKey = 1113,
|
TlsCipherSuitesKey = 1113,
|
||||||
TlsProtocolsKey = 1114,
|
TlsProtocolsKey = 1114,
|
||||||
AlgoExtKey = 1115,
|
AlgoExtKey = 1115,
|
||||||
ProxyPasswordKey = 1116,
|
ProxyPasswordKey = 1116,
|
||||||
|
|
||||||
// xmrig nvidia
|
// xmrig nvidia
|
||||||
CudaMaxThreadsKey = 1200,
|
CudaMaxThreadsKey = 1200,
|
||||||
CudaBFactorKey = 1201,
|
CudaBFactorKey = 1201,
|
||||||
CudaBSleepKey = 1202,
|
CudaBSleepKey = 1202,
|
||||||
CudaDevicesKey = 1203,
|
CudaDevicesKey = 1203,
|
||||||
CudaLaunchKey = 1204,
|
CudaLaunchKey = 1204,
|
||||||
CudaAffinityKey = 1205,
|
CudaAffinityKey = 1205,
|
||||||
CudaMaxUsageKey = 1206,
|
CudaMaxUsageKey = 1206,
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~IConfig() = default;
|
virtual ~IConfig() = default;
|
||||||
|
|
|
@ -73,13 +73,10 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
||||||
doc.AddMember("algo", StringRef(algorithm().name()), allocator);
|
doc.AddMember("algo", StringRef(algorithm().name()), allocator);
|
||||||
|
|
||||||
Value api(kObjectType);
|
Value api(kObjectType);
|
||||||
api.AddMember("port", apiPort(), allocator);
|
api.AddMember("id", m_apiId.toJSON(), allocator);
|
||||||
api.AddMember("access-token", apiToken() ? Value(StringRef(apiToken())).Move() : Value(kNullType).Move(), allocator);
|
api.AddMember("worker-id", m_apiWorkerId.toJSON(), allocator);
|
||||||
api.AddMember("id", apiId() ? Value(StringRef(apiId())).Move() : Value(kNullType).Move(), allocator);
|
|
||||||
api.AddMember("worker-id", apiWorkerId() ? Value(StringRef(apiWorkerId())).Move() : Value(kNullType).Move(), allocator);
|
|
||||||
api.AddMember("ipv6", isApiIPv6(), allocator);
|
|
||||||
api.AddMember("restricted", isApiRestricted(), allocator);
|
|
||||||
doc.AddMember("api", api, allocator);
|
doc.AddMember("api", api, allocator);
|
||||||
|
doc.AddMember("http", m_http.toJSON(doc), allocator);
|
||||||
|
|
||||||
# ifndef XMRIG_NO_ASM
|
# ifndef XMRIG_NO_ASM
|
||||||
doc.AddMember("asm", Asm::toJSON(m_assembly), allocator);
|
doc.AddMember("asm", Asm::toJSON(m_assembly), allocator);
|
||||||
|
@ -269,7 +266,7 @@ bool xmrig::Config::parseUint64(int key, uint64_t arg)
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case CPUAffinityKey: /* --cpu-affinity */
|
case CPUAffinityKey: /* --cpu-affinity */
|
||||||
if (arg) {
|
if (arg) {
|
||||||
m_threads.mask = arg;
|
m_threads.mask = static_cast<int64_t>(arg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
||||||
inline Assembly assembly() const { return m_assembly; }
|
inline Assembly assembly() const { return m_assembly; }
|
||||||
inline bool isHugePages() const { return m_hugePages; }
|
inline bool isHugePages() const { return m_hugePages; }
|
||||||
inline bool isShouldSave() const { return m_shouldSave && isAutoSave(); }
|
inline bool isShouldSave() const { return (m_shouldSave || m_upgrade) && isAutoSave(); }
|
||||||
inline const std::vector<IThread *> &threads() const { return m_threads.list; }
|
inline const std::vector<IThread *> &threads() const { return m_threads.list; }
|
||||||
inline int priority() const { return m_priority; }
|
inline int priority() const { return m_priority; }
|
||||||
inline int threadsCount() const { return m_threads.list.size(); }
|
inline int threadsCount() const { return m_threads.list.size(); }
|
||||||
|
|
|
@ -44,45 +44,54 @@ static char const short_options[] = "a:c:kBp:Px:r:R:s:t:T:o:u:O:v:l:S";
|
||||||
|
|
||||||
|
|
||||||
static struct option const options[] = {
|
static struct option const options[] = {
|
||||||
{ "algo", 1, nullptr, IConfig::AlgorithmKey },
|
{ "algo", 1, nullptr, IConfig::AlgorithmKey },
|
||||||
{ "api-access-token", 1, nullptr, IConfig::ApiAccessTokenKey },
|
{ "api-worker-id", 1, nullptr, IConfig::ApiWorkerIdKey },
|
||||||
{ "api-port", 1, nullptr, IConfig::ApiPort },
|
{ "api-id", 1, nullptr, IConfig::ApiIdKey },
|
||||||
{ "api-worker-id", 1, nullptr, IConfig::ApiWorkerIdKey },
|
{ "http-enabled", 0, nullptr, IConfig::HttpEnabledKey },
|
||||||
{ "api-id", 1, nullptr, IConfig::ApiIdKey },
|
{ "http-host", 1, nullptr, IConfig::HttpHostKey },
|
||||||
{ "api-ipv6", 0, nullptr, IConfig::ApiIPv6Key },
|
{ "http-access-token", 1, nullptr, IConfig::HttpAccessTokenKey },
|
||||||
{ "api-no-restricted", 0, nullptr, IConfig::ApiRestrictedKey },
|
{ "http-port", 1, nullptr, IConfig::HttpPort },
|
||||||
{ "av", 1, nullptr, IConfig::AVKey },
|
{ "http-no-restricted", 0, nullptr, IConfig::HttpRestrictedKey },
|
||||||
{ "background", 0, nullptr, IConfig::BackgroundKey },
|
{ "av", 1, nullptr, IConfig::AVKey },
|
||||||
{ "config", 1, nullptr, IConfig::ConfigKey },
|
{ "background", 0, nullptr, IConfig::BackgroundKey },
|
||||||
{ "cpu-affinity", 1, nullptr, IConfig::CPUAffinityKey },
|
{ "config", 1, nullptr, IConfig::ConfigKey },
|
||||||
{ "cpu-priority", 1, nullptr, IConfig::CPUPriorityKey },
|
{ "cpu-affinity", 1, nullptr, IConfig::CPUAffinityKey },
|
||||||
{ "donate-level", 1, nullptr, IConfig::DonateLevelKey },
|
{ "cpu-priority", 1, nullptr, IConfig::CPUPriorityKey },
|
||||||
{ "donate-over-proxy", 1, nullptr, IConfig::ProxyDonateKey },
|
{ "donate-level", 1, nullptr, IConfig::DonateLevelKey },
|
||||||
{ "dry-run", 0, nullptr, IConfig::DryRunKey },
|
{ "donate-over-proxy", 1, nullptr, IConfig::ProxyDonateKey },
|
||||||
{ "keepalive", 0, nullptr, IConfig::KeepAliveKey },
|
{ "dry-run", 0, nullptr, IConfig::DryRunKey },
|
||||||
{ "log-file", 1, nullptr, IConfig::LogFileKey },
|
{ "keepalive", 0, nullptr, IConfig::KeepAliveKey },
|
||||||
{ "max-cpu-usage", 1, nullptr, IConfig::MaxCPUUsageKey },
|
{ "log-file", 1, nullptr, IConfig::LogFileKey },
|
||||||
{ "nicehash", 0, nullptr, IConfig::NicehashKey },
|
{ "max-cpu-usage", 1, nullptr, IConfig::MaxCPUUsageKey },
|
||||||
{ "no-color", 0, nullptr, IConfig::ColorKey },
|
{ "nicehash", 0, nullptr, IConfig::NicehashKey },
|
||||||
{ "no-watch", 0, nullptr, IConfig::WatchKey },
|
{ "no-color", 0, nullptr, IConfig::ColorKey },
|
||||||
{ "no-huge-pages", 0, nullptr, IConfig::HugePagesKey },
|
{ "no-watch", 0, nullptr, IConfig::WatchKey },
|
||||||
{ "variant", 1, nullptr, IConfig::VariantKey },
|
{ "no-huge-pages", 0, nullptr, IConfig::HugePagesKey },
|
||||||
{ "pass", 1, nullptr, IConfig::PasswordKey },
|
{ "variant", 1, nullptr, IConfig::VariantKey },
|
||||||
{ "print-time", 1, nullptr, IConfig::PrintTimeKey },
|
{ "pass", 1, nullptr, IConfig::PasswordKey },
|
||||||
{ "retries", 1, nullptr, IConfig::RetriesKey },
|
{ "print-time", 1, nullptr, IConfig::PrintTimeKey },
|
||||||
{ "retry-pause", 1, nullptr, IConfig::RetryPauseKey },
|
{ "retries", 1, nullptr, IConfig::RetriesKey },
|
||||||
{ "safe", 0, nullptr, IConfig::SafeKey },
|
{ "retry-pause", 1, nullptr, IConfig::RetryPauseKey },
|
||||||
{ "syslog", 0, nullptr, IConfig::SyslogKey },
|
{ "safe", 0, nullptr, IConfig::SafeKey },
|
||||||
{ "threads", 1, nullptr, IConfig::ThreadsKey },
|
{ "syslog", 0, nullptr, IConfig::SyslogKey },
|
||||||
{ "url", 1, nullptr, IConfig::UrlKey },
|
{ "threads", 1, nullptr, IConfig::ThreadsKey },
|
||||||
{ "user", 1, nullptr, IConfig::UserKey },
|
{ "url", 1, nullptr, IConfig::UrlKey },
|
||||||
{ "user-agent", 1, nullptr, IConfig::UserAgentKey },
|
{ "user", 1, nullptr, IConfig::UserKey },
|
||||||
{ "userpass", 1, nullptr, IConfig::UserpassKey },
|
{ "user-agent", 1, nullptr, IConfig::UserAgentKey },
|
||||||
{ "rig-id", 1, nullptr, IConfig::RigIdKey },
|
{ "userpass", 1, nullptr, IConfig::UserpassKey },
|
||||||
{ "tls", 0, nullptr, IConfig::TlsKey },
|
{ "rig-id", 1, nullptr, IConfig::RigIdKey },
|
||||||
{ "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey },
|
{ "tls", 0, nullptr, IConfig::TlsKey },
|
||||||
{ "asm", 1, nullptr, IConfig::AssemblyKey },
|
{ "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey },
|
||||||
{ nullptr, 0, nullptr, 0 }
|
{ "asm", 1, nullptr, IConfig::AssemblyKey },
|
||||||
|
|
||||||
|
# ifdef XMRIG_DEPRECATED
|
||||||
|
{ "api-port", 1, nullptr, IConfig::ApiPort },
|
||||||
|
{ "api-access-token", 1, nullptr, IConfig::ApiAccessTokenKey },
|
||||||
|
{ "api-no-restricted", 0, nullptr, IConfig::ApiRestrictedKey },
|
||||||
|
{ "api-ipv6", 0, nullptr, IConfig::ApiIPv6Key },
|
||||||
|
# endif
|
||||||
|
|
||||||
|
{ nullptr, 0, nullptr, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,11 +124,7 @@ static struct option const config_options[] = {
|
||||||
|
|
||||||
|
|
||||||
static struct option const api_options[] = {
|
static struct option const api_options[] = {
|
||||||
{ "port", 1, nullptr, IConfig::ApiPort },
|
|
||||||
{ "access-token", 1, nullptr, IConfig::ApiAccessTokenKey },
|
|
||||||
{ "worker-id", 1, nullptr, IConfig::ApiWorkerIdKey },
|
{ "worker-id", 1, nullptr, IConfig::ApiWorkerIdKey },
|
||||||
{ "ipv6", 0, nullptr, IConfig::ApiIPv6Key },
|
|
||||||
{ "restricted", 0, nullptr, IConfig::ApiRestrictedKey },
|
|
||||||
{ "id", 1, nullptr, IConfig::ApiIdKey },
|
{ "id", 1, nullptr, IConfig::ApiIdKey },
|
||||||
{ nullptr, 0, nullptr, 0 }
|
{ nullptr, 0, nullptr, 0 }
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,58 +35,59 @@ namespace xmrig {
|
||||||
static char const usage[] = "\
|
static char const usage[] = "\
|
||||||
Usage: " APP_ID " [OPTIONS]\n\
|
Usage: " APP_ID " [OPTIONS]\n\
|
||||||
Options:\n\
|
Options:\n\
|
||||||
-a, --algo=ALGO specify the algorithm to use\n\
|
-a, --algo=ALGO specify the algorithm to use\n\
|
||||||
cryptonight\n"
|
cryptonight\n"
|
||||||
#ifndef XMRIG_NO_AEON
|
#ifndef XMRIG_NO_AEON
|
||||||
"\
|
"\
|
||||||
cryptonight-lite\n"
|
cryptonight-lite\n"
|
||||||
#endif
|
#endif
|
||||||
#ifndef XMRIG_NO_SUMO
|
#ifndef XMRIG_NO_SUMO
|
||||||
"\
|
"\
|
||||||
cryptonight-heavy\n"
|
cryptonight-heavy\n"
|
||||||
#endif
|
#endif
|
||||||
"\
|
"\
|
||||||
-o, --url=URL URL of mining server\n\
|
-o, --url=URL URL of mining server\n\
|
||||||
-O, --userpass=U:P username:password pair for mining server\n\
|
-O, --userpass=U:P username:password pair for mining server\n\
|
||||||
-u, --user=USERNAME username for mining server\n\
|
-u, --user=USERNAME username for mining server\n\
|
||||||
-p, --pass=PASSWORD password for mining server\n\
|
-p, --pass=PASSWORD password for mining server\n\
|
||||||
--rig-id=ID rig identifier for pool-side statistics (needs pool support)\n\
|
--rig-id=ID rig identifier for pool-side statistics (needs pool support)\n\
|
||||||
-t, --threads=N number of miner threads\n\
|
-t, --threads=N number of miner threads\n\
|
||||||
-v, --av=N algorithm variation, 0 auto select\n\
|
-v, --av=N algorithm variation, 0 auto select\n\
|
||||||
-k, --keepalive send keepalived packet for prevent timeout (needs pool support)\n\
|
-k, --keepalive send keepalived packet for prevent timeout (needs pool support)\n\
|
||||||
--nicehash enable nicehash.com support\n\
|
--nicehash enable nicehash.com support\n\
|
||||||
--tls enable SSL/TLS support (needs pool support)\n\
|
--tls enable SSL/TLS support (needs pool support)\n\
|
||||||
--tls-fingerprint=F pool TLS certificate fingerprint, if set enable strict certificate pinning\n\
|
--tls-fingerprint=F pool TLS certificate fingerprint, if set enable strict certificate pinning\n\
|
||||||
-r, --retries=N number of times to retry before switch to backup server (default: 5)\n\
|
-r, --retries=N number of times to retry before switch to backup server (default: 5)\n\
|
||||||
-R, --retry-pause=N time to pause between retries (default: 5)\n\
|
-R, --retry-pause=N time to pause between retries (default: 5)\n\
|
||||||
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1\n\
|
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1\n\
|
||||||
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n\
|
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n\
|
||||||
--no-huge-pages disable huge pages support\n\
|
--no-huge-pages disable huge pages support\n\
|
||||||
--no-color disable colored output\n\
|
--no-color disable colored output\n\
|
||||||
--variant algorithm PoW variant\n\
|
--variant algorithm PoW variant\n\
|
||||||
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\
|
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\
|
||||||
--user-agent set custom user-agent string for pool\n\
|
--user-agent set custom user-agent string for pool\n\
|
||||||
-B, --background run the miner in the background\n\
|
-B, --background run the miner in the background\n\
|
||||||
-c, --config=FILE load a JSON-format configuration file\n\
|
-c, --config=FILE load a JSON-format configuration file\n\
|
||||||
-l, --log-file=FILE log all output to a file\n"
|
-l, --log-file=FILE log all output to a file\n"
|
||||||
# ifdef HAVE_SYSLOG_H
|
# ifdef HAVE_SYSLOG_H
|
||||||
"\
|
"\
|
||||||
-S, --syslog use system log for output messages\n"
|
-S, --syslog use system log for output messages\n"
|
||||||
# endif
|
# endif
|
||||||
"\
|
"\
|
||||||
--max-cpu-usage=N maximum CPU usage for automatic threads mode (default 75)\n\
|
--max-cpu-usage=N maximum CPU usage for automatic threads mode (default 75)\n\
|
||||||
--safe safe adjust threads and av settings for current CPU\n\
|
--safe safe adjust threads and av settings for current CPU\n\
|
||||||
--asm=ASM ASM code for cn/2, possible values: auto, none, intel, ryzen, bulldozer.\n\
|
--asm=ASM ASM code for cn/2, possible values: auto, none, intel, ryzen, bulldozer.\n\
|
||||||
--print-time=N print hashrate report every N seconds\n\
|
--print-time=N print hashrate report every N seconds\n\
|
||||||
--api-port=N port for the miner API\n\
|
--api-worker-id=ID custom worker-id for API\n\
|
||||||
--api-access-token=T access token for API\n\
|
--api-id=ID custom instance ID for API\n\
|
||||||
--api-worker-id=ID custom worker-id for API\n\
|
--http-enabled enable HTTP API\n\
|
||||||
--api-id=ID custom instance ID for API\n\
|
--http-host=HOST bind host for HTTP API (by default 127.0.0.1)\n\
|
||||||
--api-ipv6 enable IPv6 support for API\n\
|
--http-port=N bind port for HTTP API\n\
|
||||||
--api-no-restricted enable full remote access (only if API token set)\n\
|
--http-access-token=T access token for HTTP API\n\
|
||||||
--dry-run test configuration and exit\n\
|
--http-no-restricted enable full remote access to HTTP API (only if access token set)\n\
|
||||||
-h, --help display this help and exit\n\
|
--dry-run test configuration and exit\n\
|
||||||
-V, --version output version information and exit\n\
|
-h, --help display this help and exit\n\
|
||||||
|
-V, --version output version information and exit\n\
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue