Browse Source

configurable UPnP name

pull/578/head
orignal 9 years ago
parent
commit
77493d0d09
  1. 1
      Config.cpp
  2. 3
      UPnP.cpp

1
Config.cpp

@ -134,6 +134,7 @@ namespace config { @@ -134,6 +134,7 @@ namespace config {
options_description upnp("UPnP options");
upnp.add_options()
("upnp.enabled", value<bool>()->default_value(upnp_default), "Enable or disable UPnP: automatic port forwarding")
("upnp.name", value<std::string>()->default_value("I2Pd"), "Name i2pd appears in UPnP forwardings list")
;
options_description precomputation("Precomputation options");

3
UPnP.cpp

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
#include "NetDb.h"
#include "util.h"
#include "RouterInfo.h"
#include "Config.h"
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
@ -143,7 +144,7 @@ namespace transport @@ -143,7 +144,7 @@ namespace transport
{
std::string strType (GetProto (address)), strPort (std::to_string (address->port));
int r;
std::string strDesc = "I2Pd";
std::string strDesc; i2p::config::GetOption("upnp.name", strDesc);
r = UPNP_AddPortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), 0, "0");
if (r!=UPNPCOMMAND_SUCCESS)
{

Loading…
Cancel
Save