mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-19 02:21:04 +00:00
Show TLS version.
This commit is contained in:
parent
2f3939396e
commit
bc9130ded3
6 changed files with 47 additions and 20 deletions
|
@ -53,18 +53,18 @@ static void print_memory(xmrig::Config *config) {
|
||||||
static void print_cpu(xmrig::Config *config)
|
static void print_cpu(xmrig::Config *config)
|
||||||
{
|
{
|
||||||
if (config->isColors()) {
|
if (config->isColors()) {
|
||||||
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s (%d) %sx64 %sAES-NI",
|
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%d)") " %sx64 %sAES",
|
||||||
"CPU",
|
"CPU",
|
||||||
Cpu::brand(),
|
Cpu::brand(),
|
||||||
Cpu::sockets(),
|
Cpu::sockets(),
|
||||||
Cpu::isX64() ? "\x1B[1;32m" : "\x1B[1;31m-",
|
Cpu::isX64() ? "\x1B[1;32m" : "\x1B[1;31m-",
|
||||||
Cpu::hasAES() ? "\x1B[1;32m" : "\x1B[1;31m-");
|
Cpu::hasAES() ? "\x1B[1;32m" : "\x1B[1;31m-");
|
||||||
# ifndef XMRIG_NO_LIBCPUID
|
# ifndef XMRIG_NO_LIBCPUID
|
||||||
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%.1f MB/%.1f MB", "CPU L2/L3", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%.1f MB/%.1f MB"), "CPU L2/L3", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log::i()->text(" * %-13s%s (%d) %sx64 %sAES-NI", "CPU", Cpu::brand(), Cpu::sockets(), Cpu::isX64() ? "" : "-", Cpu::hasAES() ? "" : "-");
|
Log::i()->text(" * %-13s%s (%d) %sx64 %sAES", "CPU", Cpu::brand(), Cpu::sockets(), Cpu::isX64() ? "" : "-", Cpu::hasAES() ? "" : "-");
|
||||||
# ifndef XMRIG_NO_LIBCPUID
|
# ifndef XMRIG_NO_LIBCPUID
|
||||||
Log::i()->text(" * %-13s%.1f MB/%.1f MB", "CPU L2/L3", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
Log::i()->text(" * %-13s%.1f MB/%.1f MB", "CPU L2/L3", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -186,9 +186,15 @@ bool Client::disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Client::isTLS() const
|
const char *Client::tlsVersion() const
|
||||||
{
|
{
|
||||||
return m_pool.isTLS() && m_tls;
|
# ifndef XMRIG_NO_TLS
|
||||||
|
if (isTLS()) {
|
||||||
|
return m_tls->tlsVersion();
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,6 +283,16 @@ bool Client::isCriticalError(const char *message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Client::isTLS() const
|
||||||
|
{
|
||||||
|
# ifndef XMRIG_NO_TLS
|
||||||
|
return m_pool.isTLS() && m_tls;
|
||||||
|
# else
|
||||||
|
return false;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
||||||
{
|
{
|
||||||
if (!params.IsObject()) {
|
if (!params.IsObject()) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
~Client();
|
~Client();
|
||||||
|
|
||||||
bool disconnect();
|
bool disconnect();
|
||||||
bool isTLS() const;
|
const char *tlsVersion() const;
|
||||||
int64_t submit(const JobResult &result);
|
int64_t submit(const JobResult &result);
|
||||||
void connect();
|
void connect();
|
||||||
void connect(const Pool &pool);
|
void connect(const Pool &pool);
|
||||||
|
@ -100,6 +100,7 @@ private:
|
||||||
|
|
||||||
bool close();
|
bool close();
|
||||||
bool isCriticalError(const char *message);
|
bool isCriticalError(const char *message);
|
||||||
|
bool isTLS() const;
|
||||||
bool parseJob(const rapidjson::Value ¶ms, int *code);
|
bool parseJob(const rapidjson::Value ¶ms, int *code);
|
||||||
bool parseLogin(const rapidjson::Value &result, int *code);
|
bool parseLogin(const rapidjson::Value &result, int *code);
|
||||||
bool send(BIO *bio);
|
bool send(BIO *bio);
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
|
|
||||||
Client::Tls::Tls(Client *client) :
|
Client::Tls::Tls(Client *client) :
|
||||||
|
m_ready(false),
|
||||||
m_buf(),
|
m_buf(),
|
||||||
m_client(client),
|
m_client(client),
|
||||||
m_ssl(nullptr)
|
m_ssl(nullptr)
|
||||||
|
@ -87,6 +88,12 @@ bool Client::Tls::send(const char *data, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *Client::Tls::tlsVersion() const
|
||||||
|
{
|
||||||
|
return m_ready ? SSL_get_version(m_ssl) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Client::Tls::read(const char *data, size_t size)
|
void Client::Tls::read(const char *data, size_t size)
|
||||||
{
|
{
|
||||||
BIO_write(m_readBio, data, size);
|
BIO_write(m_readBio, data, size);
|
||||||
|
@ -96,9 +103,7 @@ void Client::Tls::read(const char *data, size_t size)
|
||||||
|
|
||||||
if (rc < 0 && SSL_get_error(m_ssl, rc) == SSL_ERROR_WANT_READ) {
|
if (rc < 0 && SSL_get_error(m_ssl, rc) == SSL_ERROR_WANT_READ) {
|
||||||
send();
|
send();
|
||||||
}
|
} else if (rc == 1) {
|
||||||
|
|
||||||
if (rc == 1) {
|
|
||||||
if (!verify()) {
|
if (!verify()) {
|
||||||
LOG_ERR("[%s] TLS certificate verification failed", m_client->m_pool.url());
|
LOG_ERR("[%s] TLS certificate verification failed", m_client->m_pool.url());
|
||||||
m_client->close();
|
m_client->close();
|
||||||
|
@ -106,6 +111,7 @@ void Client::Tls::read(const char *data, size_t size)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ready = true;
|
||||||
m_client->login();
|
m_client->login();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
|
|
||||||
bool handshake();
|
bool handshake();
|
||||||
bool send(const char *data, size_t size);
|
bool send(const char *data, size_t size);
|
||||||
|
const char *tlsVersion() const;
|
||||||
void read(const char *data, size_t size);
|
void read(const char *data, size_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -48,6 +48,7 @@ private:
|
||||||
|
|
||||||
BIO *m_readBio;
|
BIO *m_readBio;
|
||||||
BIO *m_writeBio;
|
BIO *m_writeBio;
|
||||||
|
bool m_ready;
|
||||||
char m_buf[1024 * 2];
|
char m_buf[1024 * 2];
|
||||||
Client *m_client;
|
Client *m_client;
|
||||||
SSL *m_ssl;
|
SSL *m_ssl;
|
||||||
|
|
|
@ -101,7 +101,10 @@ void Network::onActive(IStrategy *strategy, Client *client)
|
||||||
|
|
||||||
m_state.setPool(client->host(), client->port(), client->ip());
|
m_state.setPool(client->host(), client->port(), client->ip());
|
||||||
|
|
||||||
LOG_INFO(isColors() ? "\x1B[01;37muse pool \x1B[01;36m%s:%d \x1B[01;30m%s" : "use pool %s:%d %s", client->host(), client->port(), client->ip());
|
const char *tlsVersion = client->tlsVersion();
|
||||||
|
LOG_INFO(isColors() ? WHITE_BOLD("use pool ") CYAN_BOLD("%s:%d ") GREEN_BOLD("%s") " \x1B[01;30m%s "
|
||||||
|
: "use pool %s:%d %s %s",
|
||||||
|
client->host(), client->port(), tlsVersion ? tlsVersion : "", client->ip());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue