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: @@ -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

2
cgminer.c

@ -1249,7 +1249,7 @@ static struct opt_table opt_config_table[] = { @@ -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

@ -347,7 +347,7 @@ json_t *json_rpc_call(CURL *curl, const char *url, @@ -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) @@ -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) @@ -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;
}

Loading…
Cancel
Save