Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #84 from ijcoe6ru/develop
Browse files Browse the repository at this point in the history
Change default lp from 30303 to c_defaultListenPort
  • Loading branch information
bobsummerwill committed Jun 8, 2016
2 parents 77f4435 + 0f7cf80 commit f941290
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions libp2p/Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ static const unsigned short c_defaultListenPort = 30303;
struct NetworkPreferences
{
// Default Network Preferences
NetworkPreferences(unsigned short lp = 30303): listenPort(lp) {}
NetworkPreferences(unsigned short lp = c_defaultListenPort): listenPort(lp) {}

// Network Preferences with specific Listen IP
NetworkPreferences(std::string const& l, unsigned short lp = 30303, bool u = true): publicIPAddress(), listenIPAddress(l), listenPort(lp), traverseNAT(u) {}
NetworkPreferences(std::string const& l, unsigned short lp = c_defaultListenPort, bool u = true): publicIPAddress(), listenIPAddress(l), listenPort(lp), traverseNAT(u) {}

// Network Preferences with intended Public IP
NetworkPreferences(std::string const& publicIP, std::string const& l = std::string(), unsigned short lp = 30303, bool u = true): publicIPAddress(publicIP), listenIPAddress(l), listenPort(lp), traverseNAT(u) { if (!publicIPAddress.empty() && !isPublicAddress(publicIPAddress)) BOOST_THROW_EXCEPTION(InvalidPublicIPAddress()); }
NetworkPreferences(std::string const& publicIP, std::string const& l = std::string(), unsigned short lp = c_defaultListenPort, bool u = true): publicIPAddress(publicIP), listenIPAddress(l), listenPort(lp), traverseNAT(u) { if (!publicIPAddress.empty() && !isPublicAddress(publicIPAddress)) BOOST_THROW_EXCEPTION(InvalidPublicIPAddress()); }

/// Addressing

std::string publicIPAddress;
std::string listenIPAddress;
unsigned short listenPort = c_defaultListenPort;


/// Preferences

bool traverseNAT = true;
bool discovery = true; // Discovery is activated with network.
bool pin = false; // Only accept or connect to trusted peers.
Expand All @@ -73,16 +73,16 @@ class Network
public:
/// @returns public and private interface addresses
static std::set<bi::address> getInterfaceAddresses();

/// Try to bind and listen on _listenPort, else attempt net-allocated port.
static int tcp4Listen(bi::tcp::acceptor& _acceptor, NetworkPreferences const& _netPrefs);

/// Return public endpoint of upnp interface. If successful o_upnpifaddr will be a private interface address and endpoint will contain public address and port.
static bi::tcp::endpoint traverseNAT(std::set<bi::address> const& _ifAddresses, unsigned short _listenPort, bi::address& o_upnpInterfaceAddr);

/// Resolve "host:port" string as TCP endpoint. Returns unspecified endpoint on failure.
static bi::tcp::endpoint resolveHost(std::string const& _host);
};

}
}

0 comments on commit f941290

Please sign in to comment.