use "IPv6" and "IPv4" in strings as these are the official spellings and make ParseNetwork() in netbase.cpp case-insensitive

This commit is contained in:
Philip Kaufmann 2012-05-13 00:40:30 +02:00
parent a6cd0b08f6
commit ea933b03b4
3 changed files with 6 additions and 4 deletions

View File

@ -192,7 +192,7 @@ bool AppInit2(int argc, char* argv[])
" -timeout=<n> \t " + _("Specify connection timeout (in milliseconds)") + "\n" + " -timeout=<n> \t " + _("Specify connection timeout (in milliseconds)") + "\n" +
" -proxy=<ip:port> \t " + _("Connect through socks proxy") + "\n" + " -proxy=<ip:port> \t " + _("Connect through socks proxy") + "\n" +
" -socks=<n> \t " + _("Select the version of socks proxy to use (4 or 5, 5 is default)") + "\n" + " -socks=<n> \t " + _("Select the version of socks proxy to use (4 or 5, 5 is default)") + "\n" +
" -noproxy=<net> \t " + _("Do not use proxy for connections to network net (ipv4 or ipv6)") + "\n" + " -noproxy=<net> \t " + _("Do not use proxy for connections to network <net> (IPv4 or IPv6)") + "\n" +
" -dns \t " + _("Allow DNS lookups for -addnode, -seednode and -connect") + "\n" + " -dns \t " + _("Allow DNS lookups for -addnode, -seednode and -connect") + "\n" +
" -proxydns \t " + _("Pass DNS requests to (SOCKS5) proxy") + "\n" + " -proxydns \t " + _("Pass DNS requests to (SOCKS5) proxy") + "\n" +
" -port=<port> \t\t " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)") + "\n" + " -port=<port> \t\t " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)") + "\n" +
@ -201,7 +201,7 @@ bool AppInit2(int argc, char* argv[])
" -connect=<ip> \t\t " + _("Connect only to the specified node") + "\n" + " -connect=<ip> \t\t " + _("Connect only to the specified node") + "\n" +
" -seednode=<ip> \t\t " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n" + " -seednode=<ip> \t\t " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n" +
" -externalip=<ip> \t " + _("Specify your own public address") + "\n" + " -externalip=<ip> \t " + _("Specify your own public address") + "\n" +
" -blocknet=<net> \t " + _("Do not connect to addresses in network net (ipv4, ipv6)") + "\n" + " -blocknet=<net> \t " + _("Do not connect to addresses in network <net> (IPv4 or IPv6)") + "\n" +
" -discover \t " + _("Try to discover public IP address (default: 1)") + "\n" + " -discover \t " + _("Try to discover public IP address (default: 1)") + "\n" +
" -irc \t " + _("Find peers using internet relay chat (default: 0)") + "\n" + " -irc \t " + _("Find peers using internet relay chat (default: 0)") + "\n" +
" -listen \t " + _("Accept connections from outside (default: 1)") + "\n" + " -listen \t " + _("Accept connections from outside (default: 1)") + "\n" +

View File

@ -1796,7 +1796,7 @@ void static Discover()
struct sockaddr_in* s4 = (struct sockaddr_in*)(ifa->ifa_addr); struct sockaddr_in* s4 = (struct sockaddr_in*)(ifa->ifa_addr);
CNetAddr addr(s4->sin_addr); CNetAddr addr(s4->sin_addr);
if (AddLocal(addr, LOCAL_IF)) if (AddLocal(addr, LOCAL_IF))
printf("ipv4 %s: %s\n", ifa->ifa_name, addr.ToString().c_str()); printf("IPv4 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
} }
#ifdef USE_IPV6 #ifdef USE_IPV6
else if (ifa->ifa_addr->sa_family == AF_INET6) else if (ifa->ifa_addr->sa_family == AF_INET6)
@ -1804,7 +1804,7 @@ void static Discover()
struct sockaddr_in6* s6 = (struct sockaddr_in6*)(ifa->ifa_addr); struct sockaddr_in6* s6 = (struct sockaddr_in6*)(ifa->ifa_addr);
CNetAddr addr(s6->sin6_addr); CNetAddr addr(s6->sin6_addr);
if (AddLocal(addr, LOCAL_IF)) if (AddLocal(addr, LOCAL_IF))
printf("ipv6 %s: %s\n", ifa->ifa_name, addr.ToString().c_str()); printf("IPv6 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
} }
#endif #endif
} }

View File

@ -11,6 +11,7 @@
#endif #endif
#include "strlcpy.h" #include "strlcpy.h"
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
using namespace std; using namespace std;
@ -27,6 +28,7 @@ static bool vfNoProxy[NET_MAX] = {};
static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff }; static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
enum Network ParseNetwork(std::string net) { enum Network ParseNetwork(std::string net) {
boost::to_lower(net);
if (net == "ipv4") return NET_IPV4; if (net == "ipv4") return NET_IPV4;
if (net == "ipv6") return NET_IPV6; if (net == "ipv6") return NET_IPV6;
if (net == "tor") return NET_TOR; if (net == "tor") return NET_TOR;