diff --git a/client/ClientContext.cpp b/client/ClientContext.cpp index 7a142d3b..a3f36ce6 100644 --- a/client/ClientContext.cpp +++ b/client/ClientContext.cpp @@ -71,7 +71,7 @@ namespace client ircPort, localDestination ); ircTunnel->Start (); - // TODO: allow muliple tunnels on the same port (but on a different address) + // TODO: allow multiple tunnels on the same port (but on a different address) m_ClientTunnels.insert(std::make_pair( ircPort, std::unique_ptr(ircTunnel) )); diff --git a/client/Daemon.cpp b/client/Daemon.cpp index 4777933a..06c3d1a0 100644 --- a/client/Daemon.cpp +++ b/client/Daemon.cpp @@ -76,9 +76,11 @@ namespace i2p int port = i2p::util::config::GetArg("-port", 0); if (port) i2p::context.UpdatePort (port); - const char * host = i2p::util::config::GetCharArg("-host", ""); - if (host && host[0]) - i2p::context.UpdateAddress (boost::asio::ip::address::from_string (host)); + const std::string host = i2p::util::config::GetArg("-host", ""); + // The host option is deprecated, so this was always true. + // Because of -Waddress, it's now exposed as the hack it was. + if (&host && host[0]) + i2p::context.UpdateAddress (boost::asio::ip::address::from_string (host)); i2p::context.SetSupportsV6 (i2p::util::config::GetArg("-v6", 0)); i2p::context.SetFloodfill (i2p::util::config::GetArg("-floodfill", 0)); diff --git a/core/RouterContext.cpp b/core/RouterContext.cpp index b632625e..9aa73fe1 100644 --- a/core/RouterContext.cpp +++ b/core/RouterContext.cpp @@ -42,8 +42,8 @@ namespace i2p int port = i2p::util::config::GetArg("-port", 0); if (!port) port = m_Rnd.GenerateWord32 (9111, 30777); // I2P network ports range - routerInfo.AddSSUAddress (i2p::util::config::GetCharArg("-host", "127.0.0.1"), port, routerInfo.GetIdentHash ()); - routerInfo.AddNTCPAddress (i2p::util::config::GetCharArg("-host", "127.0.0.1"), port); + routerInfo.AddSSUAddress (i2p::util::config::GetArg("-host", "127.0.0.1"), port, routerInfo.GetIdentHash ()); + routerInfo.AddNTCPAddress (i2p::util::config::GetArg("-host", "127.0.0.1"), port); routerInfo.SetCaps (i2p::data::RouterInfo::eReachable | i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC routerInfo.SetProperty ("coreVersion", I2P_VERSION); diff --git a/core/RouterInfo.cpp b/core/RouterInfo.cpp index 347c8ddb..79f68770 100644 --- a/core/RouterInfo.cpp +++ b/core/RouterInfo.cpp @@ -472,7 +472,7 @@ namespace data s.write (str.c_str (), len); } - void RouterInfo::AddNTCPAddress (const char * host, int port) + void RouterInfo::AddNTCPAddress (const std::string& host, int port) { Address addr; addr.host = boost::asio::ip::address::from_string (host); @@ -485,7 +485,7 @@ namespace data m_SupportedTransports |= addr.host.is_v6 () ? eNTCPV6 : eNTCPV4; } - void RouterInfo::AddSSUAddress (const char * host, int port, const uint8_t * key, int mtu) + void RouterInfo::AddSSUAddress (const std::string& host, int port, const uint8_t * key, int mtu) { Address addr; addr.host = boost::asio::ip::address::from_string (host); diff --git a/core/RouterInfo.h b/core/RouterInfo.h index 5bcb95e9..9491fe5e 100644 --- a/core/RouterInfo.h +++ b/core/RouterInfo.h @@ -103,8 +103,8 @@ namespace data const Address * GetSSUAddress (bool v4only = true) const; const Address * GetSSUV6Address () const; - void AddNTCPAddress (const char * host, int port); - void AddSSUAddress (const char * host, int port, const uint8_t * key, int mtu = 0); + void AddNTCPAddress (const std::string& host, int port); + void AddSSUAddress (const std::string& host, int port, const uint8_t * key, int mtu = 0); bool AddIntroducer (const Address * address, uint32_t tag); bool RemoveIntroducer (const boost::asio::ip::udp::endpoint& e); void SetProperty (const std::string& key, const std::string& value); // called from RouterContext only diff --git a/core/util/util.cpp b/core/util/util.cpp index 934f7cfc..ed8effb9 100644 --- a/core/util/util.cpp +++ b/core/util/util.cpp @@ -63,6 +63,7 @@ http://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found */ namespace i2p { namespace util { +// TODO: this will be replaced by a real option parser soon. namespace config { std::map mapArgs; std::map > mapMultiArgs; diff --git a/core/util/util.h b/core/util/util.h index c7a57622..f06cb115 100644 --- a/core/util/util.h +++ b/core/util/util.h @@ -38,12 +38,6 @@ namespace util */ std::string GetArg(const std::string& strArg, const std::string& strDefault); - /** - * @return a command line argument from config::mapArgs as a C-style string - * @param nDefault the default value to be returned - */ - const char* GetCharArg(const std::string& strArg, const std::string& nDefault); - /** * @return true if the argument is set, false otherwise */ diff --git a/doc/COMMANDLINE.md b/doc/COMMANDLINE.md index 7fcbd835..a28627b6 100644 --- a/doc/COMMANDLINE.md +++ b/doc/COMMANDLINE.md @@ -1,38 +1,55 @@ -Cmdline options -=============== +CLI Options +=========== -* --host= - The external IP (deprecated). -* --port= - The port to listen on -* --httpport= - The http port to listen on -* --httpaddress= - The ip address for the HTTP server, 127.0.0.1 by default +Basic +* --host= - The external IP (deprecated). Default: external interface. +* --port= - The port to listen on. Default: random (then saved to router.info). +* --httpport= - The HTTP port to listen on for WebUI. Default: 7070 +* --httpaddress= - The IP address of the WebUI HTTP server. Default: 127.0.0.1 + +System * --log= - Enable or disable logging to file. 1 for yes, 0 for no. * --daemon= - Enable or disable daemon mode. 1 for yes, 0 for no. -* --service= - 1 if uses system folders (/var/run/i2pd.pid, /var/log/i2pd.log, /var/lib/i2pd). -* --v6= - 1 if supports communication through ipv6, off by default -* --floodfill= - 1 if router is floodfill, off by default +* --service= - 1 if using system folders (/var/run/i2pd.pid, /var/log/i2pd.log, /var/lib/i2pd). + +Network +* --v6= - 1 to enable IPv6. Default: disabled. +* --floodfill= - 1 to enable router router as floodfill. Default: disabled. * --bandwidth= - L if bandwidth is limited to 32Kbs/sec, O if not. Always O if floodfill, otherwise L by default. -* --httpproxyport= - The port to listen on (HTTP Proxy) -* --httpproxyaddress= - The address to listen on (HTTP Proxy) -* --socksproxyport= - The port to listen on (SOCKS Proxy) -* --socksproxyaddress= - The address to listen on (SOCKS Proxy) -* --proxykeys= - optional keys file for proxy's local destination -* --ircport= - The local port of IRC tunnel to listen on. 6668 by default -* --ircaddress= - The adddress of IRC tunnel to listen on, 127.0.0.1 by default + +Proxies +* --httpproxyport= - The HTTP Proxy port to listen on. Default: 4446 +* --httpproxyaddress= - The HTTP Proxy address to listen on. Default: 127.0.0.1 +* --socksproxyport= - The SOCKS Proxy port to listen on. Default: 4447 +* --socksproxyaddress= - The SOCKS Proxy address to listen on. Default: 127.0.0.1 +* --proxykeys= - Optional keys file for proxy's local destination + +IRC +* --ircport= - The local port of IRC tunnel to listen on. Default: 6668 +* --ircaddress= - The adddress of IRC tunnel to listen on. Default: 127.0.0.1 * --ircdest= - I2P destination address of IRC server. For example irc.postman.i2p -* --irckeys= - optional keys file for tunnel's local destination +* --irckeys= - Optional keys file for tunnel's local destination. + +Eepsite * --eepkeys= - File name containing destination keys, for example privKeys.dat. The file will be created if it does not already exist (issue #110). -* --eepaddress= - Address incoming trafic forward to. 127.0.0.1 by default -* --eepport= - Port incoming trafic forward to. 80 by default -* --samport= - Port of SAM bridge. Usually 7656. SAM is off if not specified -* --samaddress= - Address of SAM bridge, 127.0.0.1 by default (only used if SAM is on) -* --bobport= - Port of BOB command channel. Usually 2827. BOB is off if not specified -* --bobaddress= - Address of BOB service, 127.0.0.1 by default (only used if BOB is on) -* --i2pcontrolport= - Port of I2P control service. Usually 7650. I2PControl is off if not specified -* --i2pcontroladdress= - Address of I2P control service, 127.0.0.1 by default (only used if I2PControl is on) -* --i2pcontrolpassword= - I2P control service password, "itoopie" by default -* --tunnelscfg= - Tunnels Config file (default: ~/.i2pd/tunnels.cfg or /var/lib/i2pd/tunnels.cfg) -* --conf= - Config file (default: ~/.i2pd/i2p.conf or /var/lib/i2pd/i2p.conf) +* --eepaddress= - Forward incoming traffic to this address. Default: 127.0.0.1 +* --eepport= - Forward incoming traffic to this port. Default: 80 + +API +* --samport= - Port of SAM bridge (usually 7656). Default: SAM is disabled if not specified. +* --samaddress= - Address of SAM bridge. Default: 127.0.0.1 (only used if SAM is enabled). +* --bobport= - Port of BOB command channel (usually 2827). BOB is disabled if not specified. +* --bobaddress= - Address of BOB service. Default: 127.0.0.1 (only used if BOB is enabled). + +I2CP +* --i2pcontrolport= - Port of I2P control service (usually 7650). I2PControl is disabled if not specified. +* --i2pcontroladdress= - Address of I2P control service. Default: 127.0.0.1 (only used if I2PControl is enabled). +* --i2pcontrolpassword= - I2P control service password. Default: "itoopie" (without quotations). + +Config +* --tunnelscfg= - Tunnels Config file. Default: ~/.i2pd/tunnels.cfg -or- /var/lib/i2pd/tunnels.cfg +* --conf= - Config file. Default: ~/.i2pd/i2p.conf -or- /var/lib/i2pd/i2p.conf This parameter will be silently ignored if the specified config file does not exist. Options specified on the command line take precedence over those in the config file. -* --install= - Installs the webui files, see BUILDING.md for details. +* --install= - Installs the WebUI (see doc/BUILDING.md for details). diff --git a/doc/CONFIG.md b/doc/CONFIG.md index 9bc9d31f..17ebcab2 100644 --- a/doc/CONFIG.md +++ b/doc/CONFIG.md @@ -10,7 +10,7 @@ i2p.conf: v6 = 0 ircdest = irc.postman.i2p -tunnels.cfg (filename of this config is subject of change): +tunnels.cfg (filename of this config is subject to change): ; outgoing tunnel sample, to remote service ; mandatory parameters: