Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ jobs:
path: /usr/local/ssl
key: openssl-1.1.1-ubuntu-22.04-v2

- name: Cache Boost 1.86.0
- name: Cache Boost 1.90.0
id: cache-boost
uses: actions/cache@v4
with:
path: |
/usr/local/include/boost
/usr/local/lib/libboost_*
key: boost-1.86.0-ubuntu-22.04-static-v2
key: boost-1.90.0-ubuntu-22.04-static-v2

- name: Cache OpenCL 3.0.19
id: cache-opencl
Expand Down Expand Up @@ -159,16 +159,16 @@ jobs:
echo "✅ OpenSSL 1.1.1 installed successfully"

#==========================================================================
# BOOST 1.86.0 INSTALLATION
# BOOST 1.90.0 INSTALLATION
#==========================================================================

- name: Install Boost 1.86.0
- name: Install Boost 1.90.0
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
# Download Boost 1.86.0
wget --no-check-certificate https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.gz
tar -xzf boost_1_86_0.tar.gz
cd boost_1_86_0
# Download Boost 1.90.0
wget --no-check-certificate https://archives.boost.io/release/1.90.0/source/boost_1_90_0.tar.gz
tar -xzf boost_1_90_0.tar.gz
cd boost_1_90_0

# Bootstrap Boost
./bootstrap.sh --prefix=/usr/local
Expand All @@ -180,9 +180,9 @@ jobs:
# CLEAN UP BOOST FILES
cd ..
echo "🧹 Cleaning up Boost installation files..."
sudo rm -rf boost_1_86_0 boost_1_86_0.tar.gz
sudo rm -rf boost_1_90_0 boost_1_90_0.tar.gz

echo "✅ Boost 1.86.0 installed successfully"
echo "✅ Boost 1.90.0 installed successfully"

#==========================================================================
# OPENCL 3.0.19 INSTALLATION
Expand Down Expand Up @@ -385,7 +385,7 @@ jobs:
echo "📦 Platform: Ubuntu 22.04"
echo "📦 Build Type: Release"
echo "📦 CUDA: 13.1 (Blackwell support)"
echo "📦 Boost: 1.86.0"
echo "📦 Boost: 1.90.0"
echo "📦 OpenSSL: 1.1.1"
echo "📦 OpenCL: 3.0.19"
echo "📦 Compiler: Clang 15"
Expand Down
10 changes: 5 additions & 5 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- cuda 13.1 => Windows
- cuda 13.1 => Ubuntu
- OpenSSL 1.1.1
- boost 1.86.0
- boost 1.90.0
- OpenCL 3.0.19

### Windows
Expand All @@ -20,7 +20,7 @@ cuda :
https://developer.nvidia.com/cuda-13-1-0-download-archive

boost :
https://boostorg.jfrog.io/artifactory/main/release/1.86.0/source/boost_1_86_0.zip
https://archives.boost.io/release/1.90.0/source/boost_1_90_0.zip
```bat
bootstrap.bat
b2.exe debug release
Expand Down Expand Up @@ -114,9 +114,9 @@ sudo apt-get -y install cuda-toolkit-13-1

boost :
```sh
wget --no-check-certificate https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.gz
tar -xvf boost_1_86_0.tar.gz
cd boost_1_86_0
wget --no-check-certificate https://archives.boost.io/release/1.90.0/source/boost_1_90_0.tar.gz
tar -xvf boost_1_90_0.tar.gz
cd boost_1_90_0
./bootstrap.sh --prefix=/usr/local
./b2 debug release
sudo ./b2 install
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ endif()
################################################################################
if (WIN32)
set(Boost_ROOT "C:\\Boost")
set(BOOST_INCLUDEDIR "C:\\Boost\\include\\boost-1_86")
set(BOOST_INCLUDEDIR "C:\\Boost\\include\\boost-1_90")
set(Boost_COMPILER -vc${VISUAL_STUDIO_VERSION})
set(Boost_THREADAPI win32)
else()
Expand Down Expand Up @@ -218,7 +218,7 @@ endif()
################################################################################
### FIND PACKAGE | LIBRARIES ####
################################################################################
find_package(Boost 1.86.0 EXACT COMPONENTS atomic chrono filesystem system json thread serialization program_options)
find_package(Boost 1.90.0 EXACT COMPONENTS atomic chrono filesystem system json thread serialization program_options)
if (BUILD_AMD)
find_package(OpenCL COMPONENTS OpenCL)
endif()
Expand Down
1 change: 1 addition & 0 deletions PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ N/A : No default value is set.
| `--cpu` | ✅ | false | Enable or disable device cpu. | `--cpu=<true\|false>` |
| `--socks5` | ✅ | false | Enable pool connection through a SOCKS5 proxy server on localhost. | `--socks5=<true\|false>` |
| `--socks_port` | ✅ | 9050 | The port of the SOCKS5 proxy server on localhost. | `--socks_port=9050` |
| `--socks_host` | ✅ | 127.0.0.1 | The host address of the SOCKS5 proxy server. | `--socks_host=127.0.0.1` |
| `--api_port` | ✅ | 8080 | Miner API port. | `--api_port=8080` |


Expand Down
6 changes: 6 additions & 0 deletions sources/common/cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ common::Cli::Cli()
"[OPTIONAL] Port of the SOCKS proxy.\n"
"--socks_port=9050"
)
(
"socks_host",
value<std::string>(),
"[OPTIONAL] Host Address of the SOCKS proxy.\n"
"--socks_host=127.0.0.1"
)

// Pool Custom
(
Expand Down
1 change: 1 addition & 0 deletions sources/common/cli/cli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@ namespace common

// Socks proxy settings
uint32_t getSocksPort() const;
std::optional<std::string> getSocksHost() const;
};
}
10 changes: 10 additions & 0 deletions sources/common/cli/cli_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,13 @@ uint32_t common::Cli::getSocksPort() const
}
return 9050u;
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 empty line between functions ;)


std::optional<std::string> common::Cli::getSocksHost() const
{
if (true == contains("socks_host"))
{
return params["socks_host"].as<std::string>();
}
return "127.0.0.1";
}
9 changes: 9 additions & 0 deletions sources/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,16 @@ bool common::Config::loadCli(int argc, char** argv)
mining.socksPort = SocksPort;
}
}

auto const socksHost{ cli.getSocksHost() };

if (std::nullopt != socksHost)
{
mining.socksHost = *socksHost;
}



////////////////////////////////////////////////////////////////////////
// RAVEN MINER
////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions sources/common/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace common
bool secrureConnect{ false };
bool stale{ false };
bool socks5{ false };
std::optional<std::string> socksHost{ "" };
};

struct SmartMiningConfig
Expand Down
50 changes: 37 additions & 13 deletions sources/network/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,54 @@ bool network::NetworkTCPClient::connect()
}

SAFE_DELETE(socketTCP);
socketTCP = NEW(boost_socket(ioService, context));

socketTCP = NEW(boost_socket(ioContext, context));
boost_resolver resolver{ ioContext };
if (true == config.mining.socks5)
{
boost_query query( host, std::to_string(port) );
boost_endpoint socksEndpoint{ {}, static_cast<boost::asio::ip::port_type>(config.mining.socksPort) };

if (config.mining.socksHost)
{
auto const addr{ boost::asio::ip::make_address(*config.mining.socksHost, ec) };
boost_endpoint socksEndpoint{
addr,
static_cast<boost::asio::ip::port_type>(config.mining.socksPort)
};

// DNS resolve is automatically done by the proxy_connect function
socks5::proxy_connect(socketTCP->next_layer(), query, socksEndpoint, ec);

auto endpoints { resolver.resolve(host, std::to_string(port), ec) };

if (socks5::result_code::ok != ec)
if (ec || endpoints.begin() == endpoints.end())
{
logErr() << "Cannot connect to " << host << ":" << port << " with SOCKS5 proxy on localhost:" << config.mining.socksPort;
logErr() << "Cannot resolve " << host << ":" << port;
return false;
}


auto targetEndpoint = *endpoints.begin();

socks5::proxy_connect(socketTCP->next_layer(), targetEndpoint, socksEndpoint, ec);


if (socks5::result_code::ok != ec)
{
logErr() << "Cannot connect to " << host << ":" << port << " with SOCKS5 proxy on " << *config.mining.socksHost << ":" << config.mining.socksPort;
return false;
}
}



}
else
{
auto const address{ boost::asio::ip::address::from_string(host, ec) };
// from_string is no longer a memeber of boost::asio::ip::address in 1.90.
auto const address{ boost::asio::ip::make_address(host, ec) };
if (boost_error::success != ec)
{
boost_resolver resolver{ ioService };
boost_query query{ host, std::to_string(port) };
auto endpoints{ resolver.resolve(query, ec) };

auto endpoints { resolver.resolve(host,std::to_string(port),
boost_resolve_flags::numeric_service,ec) };


if (boost_error::success != ec)
{
Expand Down Expand Up @@ -128,7 +152,7 @@ bool network::NetworkTCPClient::connect()
}

runService.interrupt();
runService = boost::thread{ boost::bind(&boost::asio::io_service::run, &ioService) };
runService = boost::thread{ boost::bind(&boost::asio::io_context::run, &ioContext) };

return true;
}
Expand Down
4 changes: 2 additions & 2 deletions sources/network/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace network
// boost alias
using boost_socket = boost::asio::ssl::stream<boost::asio::ip::tcp::socket>;
using boost_error = boost::system::errc::errc_t;
using boost_query = boost::asio::ip::tcp::resolver::query;
using boost_resolve_flags = boost::asio::ip::resolver_base::flags;
using boost_context = boost::asio::ssl::context;
using boost_queue = boost::lockfree::queue<std::string*>;
using boost_resolver = boost::asio::ip::tcp::resolver;
Expand All @@ -46,7 +46,7 @@ namespace network
boost_mutex rxMutex;
boost_mutex txMutex;
boost_thread runService;
boost::asio::io_service ioService;
boost::asio::io_context ioContext;
boost_queue tx{ 100 };
boost_context context{ boost_context::tlsv12_client };
boost_socket* socketTCP{ nullptr };
Expand Down
3 changes: 2 additions & 1 deletion sources/network/network_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ void network::NetworkTCPClient::onReceiveAsync(
if (boost_error::success == ec)
{
std::string msg;
msg.assign(boost::asio::buffer_cast<const char*>(recvBuffer.data()), bytes);
msg.assign(boost::asio::buffers_begin(recvBuffer.data()), boost::asio::buffers_begin(recvBuffer.data()) + bytes);

recvBuffer.consume(bytes);

if (false == msg.empty())
Expand Down
20 changes: 1 addition & 19 deletions sources/network/socks5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,8 @@ namespace socks5 {

template <typename Proto> struct core_t {
using Endpoint = typename Proto::endpoint;
using Query = typename boost::asio::ip::basic_resolver<Proto>::query;
Endpoint _proxy;

core_t(Query const& target, Endpoint proxy)
: _proxy(proxy)
, _request(target)
{
}
core_t(Endpoint const& target, Endpoint proxy)
: _proxy(proxy)
, _request(target)
Expand Down Expand Up @@ -184,7 +178,7 @@ namespace socks5 {
// constructors
request_t(Endpoint const& ep) : port(ep.port())
{
auto& addr = ep.address();
boost::asio::ip::address addr = ep.address();
if (addr.is_v4()) {
var_address.type = addr_type::IPv4;
var_address.payload.ipv4 = addr.to_v4().to_bytes();
Expand All @@ -194,18 +188,6 @@ namespace socks5 {
}
}

request_t(Query const& q) : port(std::stoi(q.service_name())) {
std::string const domain = q.host_name();
var_address.type = addr_type::Domain;

auto len = std::min(var_address.payload.domain.max_size() - 1,
domain.length());
assert(len == domain.length() || "domain truncated");
var_address.payload.domain[0] = len;
std::copy_n(domain.data(), len,
var_address.payload.domain.data() + 1);
}

auto buffers() const {
return std::array {
boost::asio::buffer(this, offsetof(request_t, var_address)),
Expand Down
Loading