From 4c4e856a1a60fa30efd8ddc8668c568a93ffa487 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 17 Apr 2019 14:40:00 -0400 Subject: [PATCH] ntcp2.addressv6 parameter --- daemon/Daemon.cpp | 7 +++++++ libi2pd/Config.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/daemon/Daemon.cpp b/daemon/Daemon.cpp index 0022b186..0ea45bb7 100644 --- a/daemon/Daemon.cpp +++ b/daemon/Daemon.cpp @@ -165,6 +165,13 @@ namespace i2p uint16_t ntcp2port; i2p::config::GetOption("ntcp2.port", ntcp2port); if (!ntcp && !ntcp2port) ntcp2port = port; // use standard port i2p::context.PublishNTCP2Address (ntcp2port, true); // publish + if (ipv6) + { + std::string ipv6Addr; i2p::config::GetOption("ntcp2.addressv6", ipv6Addr); + auto addr = boost::asio::ip::address_v6::from_string (ipv6Addr); + if (!addr.is_unspecified () && addr != boost::asio::ip::address_v6::any ()) + i2p::context.UpdateNTCP2V6Address (addr); // set ipv6 address if configured + } } else i2p::context.PublishNTCP2Address (port, false); // unpublish diff --git a/libi2pd/Config.cpp b/libi2pd/Config.cpp index fe25eb09..52f40089 100644 --- a/libi2pd/Config.cpp +++ b/libi2pd/Config.cpp @@ -239,6 +239,7 @@ namespace config { ("ntcp2.enabled", value()->default_value(true), "Enable NTCP2 (default: enabled)") ("ntcp2.published", value()->default_value(false), "Publish NTCP2 (default: disabled)") ("ntcp2.port", value()->default_value(0), "Port to listen for incoming NTCP2 connections (default: auto)") + ("ntcp2.addressv6", value()->default_value("::"), "Address to bind NTCP2 on") ; options_description nettime("Time sync options");