aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorGiel van Schijndel <me@mortis.eu>2012-06-24 12:34:15 +0200
committerGiel van Schijndel <me@mortis.eu>2012-06-24 12:34:15 +0200
commit415a87ef363396fe689ec452a30d36b1752eab2e (patch)
tree1f68453bf98ac1a4a94394e2792fd3175480cd52 /src/init.cpp
parent896899e0d66e25f6549a92749d237c8a87b12f08 (diff)
parent817ee0d826087d418b5f0bffcdd92429574284e2 (diff)
downloadbitcoin-415a87ef363396fe689ec452a30d36b1752eab2e.tar.xz
Merge branch 'master' into async-ipv6-rpc
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 4e0947a16a..34a8509b84 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -223,6 +223,7 @@ std::string HelpMessage()
" -timeout=<n> " + _("Specify connection timeout (in milliseconds)") + "\n" +
" -proxy=<ip:port> " + _("Connect through socks proxy") + "\n" +
" -socks=<n> " + _("Select the version of socks proxy to use (4-5, default: 5)") + "\n" +
+ " -tor=<ip:port> " + _("Use proxy to reach tor hidden services (default: same as -proxy)") + "\n"
" -dns " + _("Allow DNS lookups for -addnode, -seednode and -connect") + "\n" +
" -port=<port> " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)") + "\n" +
" -maxconnections=<n> " + _("Maintain at most <n> connections to peers (default: 125)") + "\n" +
@@ -230,12 +231,12 @@ std::string HelpMessage()
" -connect=<ip> " + _("Connect only to the specified node(s)") + "\n" +
" -seednode=<ip> " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n" +
" -externalip=<ip> " + _("Specify your own public address") + "\n" +
- " -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4 or IPv6)") + "\n" +
+ " -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") + "\n" +
" -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n" +
" -irc " + _("Find peers using internet relay chat (default: 0)") + "\n" +
" -listen " + _("Accept connections from outside (default: 1 if no -proxy or -connect)") + "\n" +
" -bind=<addr> " + _("Bind to given address. Use [host]:port notation for IPv6") + "\n" +
- " -dnsseed " + _("Find peers using DNS lookup (default: 1)") + "\n" +
+ " -dnsseed " + _("Find peers using DNS lookup (default: 1 unless -connect)") + "\n" +
" -banscore=<n> " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n" +
" -bantime=<n> " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" +
" -maxreceivebuffer=<n> " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 10000)") + "\n" +
@@ -345,7 +346,7 @@ bool AppInit2()
SoftSetBoolArg("-listen", false);
}
- if (GetBoolArg("-listen", true)) {
+ if (!GetBoolArg("-listen", true)) {
// do not map ports or try to retrieve public IP when not listening (pointless)
SoftSetBoolArg("-upnp", false);
SoftSetBoolArg("-discover", false);
@@ -359,6 +360,13 @@ bool AppInit2()
// ********************************************************* Step 3: parameter-to-internal-flags
fDebug = GetBoolArg("-debug");
+
+ // -debug implies fDebug*
+ if (fDebug)
+ fDebugNet = true;
+ else
+ fDebugNet = GetBoolArg("-debugnet");
+
bitdb.SetDetach(GetBoolArg("-detachdb", false));
#if !defined(WIN32) && !defined(QT_GUI)
@@ -470,8 +478,10 @@ bool AppInit2()
}
}
+ CService addrProxy;
+ bool fProxy = false;
if (mapArgs.count("-proxy")) {
- CService addrProxy = CService(mapArgs["-proxy"], 9050);
+ addrProxy = CService(mapArgs["-proxy"], 9050);
if (!addrProxy.IsValid())
return InitError(strprintf(_("Invalid -proxy address: '%s'"), mapArgs["-proxy"].c_str()));
@@ -484,6 +494,20 @@ bool AppInit2()
#endif
SetNameProxy(addrProxy, nSocksVersion);
}
+ fProxy = true;
+ }
+
+ // -tor can override normal proxy, -notor disables tor entirely
+ if (!(mapArgs.count("-tor") && mapArgs["-tor"] == "0") && (fProxy || mapArgs.count("-tor"))) {
+ CService addrOnion;
+ if (!mapArgs.count("-tor"))
+ addrOnion = addrProxy;
+ else
+ addrOnion = CService(mapArgs["-tor"], 9050);
+ if (!addrOnion.IsValid())
+ return InitError(strprintf(_("Invalid -tor address: '%s'"), mapArgs["-tor"].c_str()));
+ SetProxy(NET_TOR, addrOnion, 5);
+ SetReachable(NET_TOR);
}
// see Step 2: parameter interactions for more information about these