mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 18:11:05 +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)
|
||||
{
|
||||
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::brand(),
|
||||
Cpu::sockets(),
|
||||
Cpu::isX64() ? "\x1B[1;32m" : "\x1B[1;31m-",
|
||||
Cpu::hasAES() ? "\x1B[1;32m" : "\x1B[1;31m-");
|
||||
# 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
|
||||
}
|
||||
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
|
||||
Log::i()->text(" * %-13s%.1f MB/%.1f MB", "CPU L2/L3", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
||||
# 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)
|
||||
{
|
||||
if (!params.IsObject()) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
~Client();
|
||||
|
||||
bool disconnect();
|
||||
bool isTLS() const;
|
||||
const char *tlsVersion() const;
|
||||
int64_t submit(const JobResult &result);
|
||||
void connect();
|
||||
void connect(const Pool &pool);
|
||||
|
@ -100,6 +100,7 @@ private:
|
|||
|
||||
bool close();
|
||||
bool isCriticalError(const char *message);
|
||||
bool isTLS() const;
|
||||
bool parseJob(const rapidjson::Value ¶ms, int *code);
|
||||
bool parseLogin(const rapidjson::Value &result, int *code);
|
||||
bool send(BIO *bio);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
|
||||
Client::Tls::Tls(Client *client) :
|
||||
m_ready(false),
|
||||
m_buf(),
|
||||
m_client(client),
|
||||
m_ssl(nullptr)
|
||||
|
@ -87,26 +88,31 @@ 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)
|
||||
{
|
||||
BIO_write(m_readBio, data, size);
|
||||
|
||||
if (!SSL_is_init_finished(m_ssl)) {
|
||||
const int rc = SSL_connect(m_ssl);
|
||||
const int rc = SSL_connect(m_ssl);
|
||||
|
||||
if (rc < 0 && SSL_get_error(m_ssl, rc) == SSL_ERROR_WANT_READ) {
|
||||
send();
|
||||
}
|
||||
if (rc < 0 && SSL_get_error(m_ssl, rc) == SSL_ERROR_WANT_READ) {
|
||||
send();
|
||||
} else if (rc == 1) {
|
||||
if (!verify()) {
|
||||
LOG_ERR("[%s] TLS certificate verification failed", m_client->m_pool.url());
|
||||
m_client->close();
|
||||
|
||||
if (rc == 1) {
|
||||
if (!verify()) {
|
||||
LOG_ERR("[%s] TLS certificate verification failed", m_client->m_pool.url());
|
||||
m_client->close();
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_client->login();
|
||||
m_ready = true;
|
||||
m_client->login();
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
bool handshake();
|
||||
bool send(const char *data, size_t size);
|
||||
|
||||
const char *tlsVersion() const;
|
||||
void read(const char *data, size_t size);
|
||||
|
||||
private:
|
||||
|
@ -48,6 +48,7 @@ private:
|
|||
|
||||
BIO *m_readBio;
|
||||
BIO *m_writeBio;
|
||||
bool m_ready;
|
||||
char m_buf[1024 * 2];
|
||||
Client *m_client;
|
||||
SSL *m_ssl;
|
||||
|
|
|
@ -101,7 +101,10 @@ void Network::onActive(IStrategy *strategy, Client *client)
|
|||
|
||||
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