From a6a5bb7c204130dd4f3ced74446798eb67ea6472 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 2 May 2011 15:34:42 +0200 Subject: Support for name lookups in -connect and -addnode * A new option -dns is introduced that enables name lookups in -connect and -addnode, which is not enabled by default, as it may be considered a security issue. * A Lookup function is added that supports retrieving one or more addresses based on a host name * CAddress constructors (optionally) support name lookups. * The different places in the source code that did name lookups are refactored to use NameLookup or CAddress instead (dns seeding, irc server lookup, getexternalip, ...). * Removed ToStringLog() from CAddress, and switched to ToString(), since it was empty. --- src/init.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index a8e93140b..7e8467534 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -158,6 +158,7 @@ bool AppInit2(int argc, char* argv[]) " -min \t\t " + _("Start minimized\n") + " -datadir= \t\t " + _("Specify data directory\n") + " -proxy= \t " + _("Connect through socks4 proxy\n") + + " -dns \t " + _("Allow DNS lookups for addnode and connect\n") + " -addnode= \t " + _("Add a node to connect to\n") + " -connect= \t\t " + _("Connect only to the specified node\n") + " -nolisten \t " + _("Don't accept connections from outside\n") + @@ -208,6 +209,7 @@ bool AppInit2(int argc, char* argv[]) } fDebug = GetBoolArg("-debug"); + fAllowDNS = GetBoolArg("-dns"); #ifndef __WXMSW__ fDaemon = GetBoolArg("-daemon"); @@ -458,7 +460,7 @@ bool AppInit2(int argc, char* argv[]) { foreach(string strAddr, mapMultiArgs["-addnode"]) { - CAddress addr(strAddr, NODE_NETWORK); + CAddress addr(strAddr, fAllowDNS); addr.nTime = 0; // so it won't relay unless successfully connected if (addr.IsValid()) AddAddress(addr); -- cgit v1.2.3