Browse Source

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

nfactor-troky
Con Kolivas 11 years ago
parent
commit
770556cdec
  1. 2
      README
  2. 2
      cgminer.c
  3. 12
      util.c

2
README

@ -185,7 +185,7 @@ Options for both config file and command line:
--scrypt Use the scrypt algorithm for mining (litecoin only) --scrypt Use the scrypt algorithm for mining (litecoin only)
--sharelog <arg> Append share log to file --sharelog <arg> Append share log to file
--shares <arg> Quit after mining N shares (default: unlimited) --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) --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) --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 --text-only|-T Disable ncurses formatted screen output

2
cgminer.c

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

12
util.c

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

Loading…
Cancel
Save