Browse Source

Implement socks4 proxy support.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
e15d57d729
  1. 1
      README
  2. 6
      main.c
  3. 1
      miner.h
  4. 4
      util.c

1
README

@ -148,6 +148,7 @@ Options for both config file and command line: @@ -148,6 +148,7 @@ Options for both config file and command line:
--sched-start <arg> Set a time of day in HH:MM to start mining (a once off without a stop time)
--sched-stop <arg> Set a time of day in HH:MM to stop mining (will quit without a start time)
--shares <arg> Quit after mining N shares (default: unlimited)
--socks-proxy <arg> Set socks4 proxy (host:port)
--submit-stale Submit shares even if they would normally be considered stale
--syslog Use system log for output messages (default: standard error)
--text-only|-T Disable ncurses formatted screen output

6
main.c

@ -307,6 +307,7 @@ struct block { @@ -307,6 +307,7 @@ struct block {
static struct block *blocks = NULL;
static char *opt_kernel = NULL;
char *opt_socks_proxy = NULL;
static const char def_conf[] = "cgminer.conf";
static bool config_loaded = false;
@ -1700,6 +1701,9 @@ static struct opt_table opt_config_table[] = { @@ -1700,6 +1701,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--shares",
opt_set_intval, NULL, &opt_shares,
"Quit after mining N shares (default: unlimited)"),
OPT_WITH_ARG("--socks-proxy",
opt_set_charp, NULL, &opt_socks_proxy,
"Set socks4 proxy (host:port)"),
OPT_WITHOUT_ARG("--submit-stale",
opt_set_bool, &opt_submit_stale,
"Submit shares even if they would normally be considered stale"),
@ -3241,6 +3245,8 @@ static void write_config(FILE *fcfg) @@ -3241,6 +3245,8 @@ static void write_config(FILE *fcfg)
fprintf(fcfg, ",\n\"sched-time\" : \"%d:%d\"", schedstart.tm.tm_hour, schedstart.tm.tm_min);
if (schedstop.enable)
fprintf(fcfg, ",\n\"stop-time\" : \"%d:%d\"", schedstop.tm.tm_hour, schedstop.tm.tm_min);
if (opt_socks_proxy && *opt_socks_proxy)
fprintf(fcfg, ",\n\"socks-proxy\" : \"%s\"", opt_socks_proxy);
for(i = 0; i < nDevs; i++)
if (!gpus[i].enabled)
break;

1
miner.h

@ -412,6 +412,7 @@ extern bool opt_debug; @@ -412,6 +412,7 @@ extern bool opt_debug;
extern bool opt_protocol;
extern bool opt_log_output;
extern char *opt_kernel_path;
extern char *opt_socks_proxy;
extern char *cgminer_path;
extern bool opt_autofan;
extern bool opt_autoengine;

4
util.c

@ -345,6 +345,10 @@ json_t *json_rpc_call(CURL *curl, const char *url, @@ -345,6 +345,10 @@ json_t *json_rpc_call(CURL *curl, const char *url,
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, resp_hdr_cb);
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &hi);
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
if (opt_socks_proxy) {
curl_easy_setopt(curl, CURLOPT_PROXY, opt_socks_proxy);
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
}
if (userpass) {
curl_easy_setopt(curl, CURLOPT_USERPWD, userpass);
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

Loading…
Cancel
Save