1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Use the --socks-proxy option with stratum, changing it to defaulting to socks5 and give appropriate message should it fail to connect.

This commit is contained in:
Con Kolivas 2013-09-07 09:39:03 +10:00
parent ddbd3ab78e
commit 770556cdec
3 changed files with 11 additions and 5 deletions

2
README
View File

@ -185,7 +185,7 @@ Options for both config file and command line:
--scrypt Use the scrypt algorithm for mining (litecoin only)
--sharelog <arg> Append share log to file
--shares <arg> Quit after mining N shares (default: unlimited)
--socks-proxy <arg> Set socks4 proxy (host:port) for all pools without a proxy specified
--socks-proxy <arg> Set socks proxy (host:port) for all pools without a proxy specified
--syslog Use system log for output messages (default: standard error)
--temp-cutoff <arg> Temperature where a device will be automatically disabled, one value or comma separated list (default: 95)
--text-only|-T Disable ncurses formatted screen output

View File

@ -1249,7 +1249,7 @@ static struct opt_table opt_config_table[] = {
"Quit after mining N shares (default: unlimited)"),
OPT_WITH_ARG("--socks-proxy",
opt_set_charp, NULL, &opt_socks_proxy,
"Set socks4 proxy (host:port)"),
"Set socks proxy (host:port)"),
#ifdef HAVE_SYSLOG_H
OPT_WITHOUT_ARG("--syslog",
opt_set_bool, &use_syslog,

12
util.c
View File

@ -347,7 +347,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, pool->rpc_proxytype);
} else if (opt_socks_proxy) {
curl_easy_setopt(curl, CURLOPT_PROXY, opt_socks_proxy);
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
}
if (userpass) {
curl_easy_setopt(curl, CURLOPT_USERPWD, userpass);
@ -1870,6 +1870,12 @@ static bool setup_stratum_socket(struct pool *pool)
hints->ai_socktype = SOCK_STREAM;
servinfo = &servinfobase;
p = &pbase;
if (!pool->rpc_proxy && opt_socks_proxy) {
pool->rpc_proxy = opt_socks_proxy;
extract_sockaddr(pool->rpc_proxy, &pool->sockaddr_proxy_url, &pool->sockaddr_proxy_port);
pool->rpc_proxytype = CURLPROXY_SOCKS5;
}
if (pool->rpc_proxy) {
sockaddr_url = pool->sockaddr_proxy_url;
sockaddr_port = pool->sockaddr_proxy_port;
@ -1905,8 +1911,8 @@ static bool setup_stratum_socket(struct pool *pool)
break;
}
if (p == NULL) {
applog(LOG_INFO, "Failed to find a stratum servinfo on %s:%s",
pool->sockaddr_url, pool->stratum_port);
applog(LOG_NOTICE, "Failed to connect to stratum on %s:%s",
sockaddr_url, sockaddr_port);
freeaddrinfo(servinfo);
return false;
}