add support for IPV6 proxy

This commit is contained in:
Jonas Schnelli 2015-07-26 17:32:05 +02:00
parent 1d9d182b2b
commit 134a393d1d

View file

@ -28,6 +28,7 @@ public:
const char *host;
const char *tor;
const char *ipv4_proxy;
const char *ipv6_proxy;
CDnsSeedOpts() : nThreads(96), nDnsThreads(4), nPort(53), mbox(NULL), ns(NULL), host(NULL), tor(NULL), fUseTestNet(false), fWipeBan(false), fWipeIgnore(false) {}
@ -44,6 +45,7 @@ public:
"-p <port> UDP port to listen on (default 53)\n"
"-o <ip:port> Tor proxy IP/Port\n"
"-i <ip:port> IPV4 proxy IP/Port\n"
"-k <ip:port> IPV6 proxy IP/Port\n"
"--testnet Use testnet\n"
"--wipeban Wipe list of banned nodes\n"
"--wipeignore Wipe list of ignored nodes\n"
@ -60,7 +62,8 @@ public:
{"dnsthreads", required_argument, 0, 'd'},
{"port", required_argument, 0, 'p'},
{"onion", required_argument, 0, 'o'},
{"proxy", required_argument, 0, 'i'},
{"proxyipv4", required_argument, 0, 'i'},
{"proxyipv6", required_argument, 0, 'ik'},
{"testnet", no_argument, &fUseTestNet, 1},
{"wipeban", no_argument, &fWipeBan, 1},
{"wipeignore", no_argument, &fWipeBan, 1},
@ -68,7 +71,7 @@ public:
{0, 0, 0, 0}
};
int option_index = 0;
int c = getopt_long(argc, argv, "h:n:m:t:p:d:o:i:", long_options, &option_index);
int c = getopt_long(argc, argv, "h:n:m:t:p:d:o:i:k:", long_options, &option_index);
if (c == -1) break;
switch (c) {
case 'h': {
@ -114,6 +117,11 @@ public:
break;
}
case 'k': {
ipv6_proxy = optarg;
break;
}
case '?': {
showHelp = true;
break;
@ -386,6 +394,13 @@ int main(int argc, char **argv) {
SetProxy(NET_IPV4, service);
}
}
if (opts.ipv6_proxy) {
CService service(opts.ipv6_proxy, 9050);
if (service.IsValid()) {
printf("Using IPv6 proxy at %s\n", service.ToStringIPPort().c_str());
SetProxy(NET_IPV6, service);
}
}
bool fDNS = true;
if (opts.fUseTestNet) {
printf("Using testnet.\n");