mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 18:15:50 +00:00
Remove deprecated IPAddress
This commit is contained in:
@@ -22,7 +22,7 @@ David Features:
|
||||
|
||||
- std::priority_queue for DeadlineTimer
|
||||
|
||||
- Change ProxyInfo to use IPAddress, get rid of IPv4Address from the parsing
|
||||
- Change ProxyInfo to use IP::Endpoint, get rid of IPv4Address from the parsing
|
||||
code
|
||||
|
||||
- Validators should delay the application of newly downloaded lists from
|
||||
@@ -34,7 +34,7 @@ David Features:
|
||||
|
||||
- Look into using CMake
|
||||
|
||||
- IPv6 support in IPAddress
|
||||
- IPv6 support in IP::Endpoint
|
||||
|
||||
- Configuration list for Jenkins
|
||||
|
||||
|
||||
@@ -23,15 +23,9 @@
|
||||
#include "net/BufferType.h"
|
||||
#include "net/DynamicBuffer.h"
|
||||
|
||||
#include "net/IPAddress.h"
|
||||
#include "net/IPEndpoint.h"
|
||||
#include "net/IPAddressV4.h"
|
||||
#include "net/IPAddressV6.h"
|
||||
#include "net/IPEndpoint.h"
|
||||
|
||||
// VFALCO DEPRECATED, REMOVE ASAP!
|
||||
namespace beast {
|
||||
typedef IP::Endpoint IPAddress;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "Collector.h"
|
||||
|
||||
#include "../net/IPAddress.h"
|
||||
#include "../net/IPEndpoint.h"
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
@param prefix A string pre-pended before each metric name.
|
||||
@param journal Destination for logging output.
|
||||
*/
|
||||
static std::shared_ptr <StatsDCollector> New (IPAddress const& address,
|
||||
static std::shared_ptr <StatsDCollector> New (IP::Endpoint const& address,
|
||||
std::string const& prefix, Journal journal);
|
||||
};
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ private:
|
||||
typedef SharedData <StateType> State;
|
||||
|
||||
Journal m_journal;
|
||||
IPAddress m_address;
|
||||
IP::Endpoint m_address;
|
||||
std::string m_prefix;
|
||||
boost::asio::io_service m_io_service;
|
||||
boost::optional <boost::asio::io_service::work> m_work;
|
||||
@@ -213,7 +213,7 @@ private:
|
||||
std::thread m_thread;
|
||||
|
||||
static boost::asio::ip::udp::endpoint to_endpoint (
|
||||
IPAddress const &address)
|
||||
IP::Endpoint const &address)
|
||||
{
|
||||
if (address.is_v4 ())
|
||||
{
|
||||
@@ -230,7 +230,7 @@ private:
|
||||
|
||||
public:
|
||||
StatsDCollectorImp (
|
||||
IPAddress const& address,
|
||||
IP::Endpoint const& address,
|
||||
std::string const& prefix,
|
||||
Journal journal)
|
||||
: m_journal (journal)
|
||||
@@ -697,7 +697,7 @@ void StatsDMeterImpl::do_process ()
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
std::shared_ptr <StatsDCollector> StatsDCollector::New (
|
||||
IPAddress const& address, std::string const& prefix, Journal journal)
|
||||
IP::Endpoint const& address, std::string const& prefix, Journal journal)
|
||||
{
|
||||
return std::make_shared <detail::StatsDCollectorImp> (
|
||||
address, prefix, journal);
|
||||
|
||||
@@ -389,7 +389,7 @@ public:
|
||||
testParse <Endpoint> ("Parse Endpoint");
|
||||
}
|
||||
|
||||
IPAddressTests () : UnitTest ("IPAddress", "beast")
|
||||
IPAddressTests () : UnitTest ("IP::Endpoint", "beast")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "../detail/Parse.h"
|
||||
|
||||
namespace beast {
|
||||
namespace IP {
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class Resolver
|
||||
public:
|
||||
typedef std::function <
|
||||
void (std::string,
|
||||
std::vector <beast::IPAddress>) >
|
||||
std::vector <beast::IP::Endpoint>) >
|
||||
HandlerType;
|
||||
|
||||
virtual ~Resolver () = 0;
|
||||
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
if (ec == boost::asio::error::operation_aborted)
|
||||
return;
|
||||
|
||||
std::vector <IPAddress> addresses;
|
||||
std::vector <IP::Endpoint> addresses;
|
||||
|
||||
// If we get an error message back, we don't return any
|
||||
// results that we may have gotten.
|
||||
|
||||
@@ -38,11 +38,11 @@ struct Port
|
||||
Port ();
|
||||
Port (Port const& other);
|
||||
Port& operator= (Port const& other);
|
||||
Port (uint16 port_, IPAddress const& addr_,
|
||||
Port (uint16 port_, IP::Endpoint const& addr_,
|
||||
Security security_, SSLContext* context_);
|
||||
|
||||
uint16 port;
|
||||
IPAddress addr;
|
||||
IP::Endpoint addr;
|
||||
Security security;
|
||||
SSLContext* context;
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
virtual Journal journal() = 0;
|
||||
|
||||
/** Returns the remote address of the connection. */
|
||||
virtual IPAddress remoteAddress() = 0;
|
||||
virtual IP::Endpoint remoteAddress() = 0;
|
||||
|
||||
/** Returns `true` if the full HTTP headers have been received. */
|
||||
virtual bool headersComplete() = 0;
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
return m_impl.journal();
|
||||
}
|
||||
|
||||
IPAddress remoteAddress()
|
||||
IP::Endpoint remoteAddress()
|
||||
{
|
||||
return from_asio (get_socket().remote_endpoint());
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ Port& Port::operator= (Port const& other)
|
||||
|
||||
Port::Port (
|
||||
uint16 port_,
|
||||
IPAddress const& addr_,
|
||||
IP::Endpoint const& addr_,
|
||||
Security security_,
|
||||
SSLContext* context_)
|
||||
: port (port_)
|
||||
|
||||
@@ -53,14 +53,14 @@ inline endpoint_t to_asio (Port const& port)
|
||||
return endpoint_t (address().from_string (s), port.port);
|
||||
}
|
||||
|
||||
//IPAddress::V6 v6 (ep.v6());
|
||||
//IP::Endpoint::V6 v6 (ep.v6());
|
||||
return endpoint_t ();
|
||||
}
|
||||
|
||||
inline IPAddress from_asio (endpoint_t const& endpoint)
|
||||
inline IP::Endpoint from_asio (endpoint_t const& endpoint)
|
||||
{
|
||||
std::stringstream ss (to_string (endpoint));
|
||||
IPAddress ep;
|
||||
IP::Endpoint ep;
|
||||
ss >> ep;
|
||||
return ep;
|
||||
}
|
||||
|
||||
@@ -63,15 +63,15 @@ public:
|
||||
file, along with the set of corresponding IP addresses.
|
||||
*/
|
||||
virtual void addFixedPeer (std::string const& name,
|
||||
std::vector <IPAddress> const& addresses) = 0;
|
||||
std::vector <IP::Endpoint> const& addresses) = 0;
|
||||
|
||||
/** Add a set of strings as fallback IPAddress sources.
|
||||
/** Add a set of strings as fallback IP::Endpoint sources.
|
||||
@param name A label used for diagnostics.
|
||||
*/
|
||||
virtual void addFallbackStrings (std::string const& name,
|
||||
std::vector <std::string> const& strings) = 0;
|
||||
|
||||
/** Add a URL as a fallback location to obtain IPAddress sources.
|
||||
/** Add a URL as a fallback location to obtain IP::Endpoint sources.
|
||||
@param name A label used for diagnostics.
|
||||
*/
|
||||
/* VFALCO NOTE Unimplemented
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ripple {
|
||||
namespace PeerFinder {
|
||||
|
||||
/** Represents a set of addresses. */
|
||||
typedef std::vector <IPAddress> IPAddresses;
|
||||
typedef std::vector <IP::Endpoint> IPAddresses;
|
||||
|
||||
/** A set of Endpoint used for connecting. */
|
||||
typedef std::vector <Endpoint> Endpoints;
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Endpoint (IPAddress const& address,
|
||||
Endpoint (IP::Endpoint const& address,
|
||||
std::chrono::seconds uptime, int valence)
|
||||
: m_address (address)
|
||||
, m_uptime (uptime)
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
IPAddress const& address () const
|
||||
IP::Endpoint const& address () const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
IPAddress m_address;
|
||||
IP::Endpoint m_address;
|
||||
std::chrono::seconds m_uptime;
|
||||
int m_valence;
|
||||
};
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
typedef boost::unordered_map <IPAddress, Entry> Entries;
|
||||
typedef boost::unordered_map <IP::Endpoint, Entry> Entries;
|
||||
|
||||
typedef std::vector <Entries::iterator> SortedEntries;
|
||||
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
}
|
||||
|
||||
/** Called when an address is learned from a message. */
|
||||
bool insert (IPAddress const& address)
|
||||
bool insert (IP::Endpoint const& address)
|
||||
{
|
||||
std::pair <Entries::iterator, bool> result (
|
||||
m_entries.emplace (boost::unordered::piecewise_construct,
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
}
|
||||
|
||||
/** Called when an outbound connection attempt fails to handshake. */
|
||||
void onConnectionFailure (IPAddress const& address)
|
||||
void onConnectionFailure (IP::Endpoint const& address)
|
||||
{
|
||||
Entries::iterator iter (m_entries.find (address));
|
||||
// If the entry doesn't already exist don't bother remembering
|
||||
@@ -327,7 +327,7 @@ public:
|
||||
}
|
||||
|
||||
/** Called when an outbound connection handshake completes. */
|
||||
void onConnectionHandshake (IPAddress const& address,
|
||||
void onConnectionHandshake (IP::Endpoint const& address,
|
||||
HandshakeAction action)
|
||||
{
|
||||
std::pair <Entries::iterator, bool> result (
|
||||
@@ -368,7 +368,7 @@ public:
|
||||
// and update their uptime in periodicActivity() now that
|
||||
// we have the m_clock member?
|
||||
//
|
||||
void onConnectionActive (IPAddress const& address)
|
||||
void onConnectionActive (IP::Endpoint const& address)
|
||||
{
|
||||
std::pair <Entries::iterator, bool> result (
|
||||
m_entries.emplace (boost::unordered::piecewise_construct,
|
||||
@@ -393,7 +393,7 @@ public:
|
||||
return std::string ();
|
||||
}
|
||||
/** Called when an active outbound connection closes. */
|
||||
void onConnectionClosed (IPAddress const& address)
|
||||
void onConnectionClosed (IP::Endpoint const& address)
|
||||
{
|
||||
Entries::iterator iter (m_entries.find (address));
|
||||
// Must exist!
|
||||
|
||||
@@ -55,14 +55,14 @@ private:
|
||||
|
||||
CheckerImp& m_owner;
|
||||
boost::asio::io_service& m_io_service;
|
||||
IPAddress m_address;
|
||||
IP::Endpoint m_address;
|
||||
AbstractHandler <void (Result)> m_handler;
|
||||
socket_type m_socket;
|
||||
boost::system::error_code m_error;
|
||||
bool m_canAccept;
|
||||
|
||||
Request (CheckerImp& owner, boost::asio::io_service& io_service,
|
||||
IPAddress const& address, AbstractHandler <void (Result)> handler)
|
||||
IP::Endpoint const& address, AbstractHandler <void (Result)> handler)
|
||||
: m_owner (owner)
|
||||
, m_io_service (io_service)
|
||||
, m_address (address)
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
iter->cancel();
|
||||
}
|
||||
|
||||
void async_test (IPAddress const& endpoint,
|
||||
void async_test (IP::Endpoint const& endpoint,
|
||||
AbstractHandler <void (Result)> handler)
|
||||
{
|
||||
new Request (*this, m_io_service, endpoint, handler);
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
{ }
|
||||
|
||||
/** The original address. */
|
||||
IPAddress address;
|
||||
IP::Endpoint address;
|
||||
|
||||
/** The error code from the operation. */
|
||||
boost::system::error_code error;
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
void (Result const& result);
|
||||
*/
|
||||
template <typename Handler>
|
||||
void async_test (IPAddress const& endpoint,
|
||||
void async_test (IP::Endpoint const& endpoint,
|
||||
BEAST_MOVE_ARG(Handler) handler)
|
||||
{
|
||||
async_test (endpoint,
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
BEAST_MOVE_CAST(Handler)(handler)));
|
||||
}
|
||||
|
||||
virtual void async_test (IPAddress const& endpoint,
|
||||
virtual void async_test (IP::Endpoint const& endpoint,
|
||||
AbstractHandler <void (Result)> handler) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
m_checker->cancel();
|
||||
}
|
||||
|
||||
void async_test (IPAddress const& endpoint,
|
||||
void async_test (IP::Endpoint const& endpoint,
|
||||
AbstractHandler <void (Checker::Result)> handler)
|
||||
{
|
||||
m_checker->async_test (endpoint, Handler (
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
{
|
||||
Endpoint ep;
|
||||
ep.hops = 0;
|
||||
ep.address = IPAddress (
|
||||
ep.address = IP::Endpoint (
|
||||
IP::AddressV4 (index), port);
|
||||
c.insert (ep);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
}
|
||||
|
||||
void addFixedPeer (std::string const& name,
|
||||
std::vector <IPAddress> const& addresses)
|
||||
std::vector <IP::Endpoint> const& addresses)
|
||||
{
|
||||
SharedState::Access state (m_state);
|
||||
|
||||
@@ -626,7 +626,7 @@ public:
|
||||
struct LessWithoutPortSet
|
||||
{
|
||||
bool operator() (
|
||||
Endpoint const& lhs, IPAddress const& rhs) const
|
||||
Endpoint const& lhs, IP::Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.address.address() < rhs.address();
|
||||
}
|
||||
@@ -636,12 +636,12 @@ public:
|
||||
return lhs.address.address() < rhs.address.address();
|
||||
}
|
||||
bool operator() (
|
||||
IPAddress const& lhs, Endpoint const& rhs) const
|
||||
IP::Endpoint const& lhs, Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.address() < rhs.address.address();
|
||||
}
|
||||
bool operator() (
|
||||
IPAddress const& lhs, IPAddress const& rhs) const
|
||||
IP::Endpoint const& lhs, IP::Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.address() < rhs.address();
|
||||
}
|
||||
@@ -772,7 +772,7 @@ public:
|
||||
struct LessWithoutPortSet
|
||||
{
|
||||
bool operator() (Bootcache::Endpoint const& lhs,
|
||||
IPAddress const& rhs) const
|
||||
IP::Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.address().at_port (0) < rhs.at_port (0);
|
||||
}
|
||||
@@ -782,13 +782,13 @@ public:
|
||||
return lhs.address().at_port (0) <
|
||||
rhs.address().at_port (0);
|
||||
}
|
||||
bool operator() (IPAddress const& lhs,
|
||||
bool operator() (IP::Endpoint const& lhs,
|
||||
Bootcache::Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.at_port (0) < rhs.address().at_port (0);
|
||||
}
|
||||
bool operator() (IPAddress const& lhs,
|
||||
IPAddress const& rhs) const
|
||||
bool operator() (IP::Endpoint const& lhs,
|
||||
IP::Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.at_port (0) < rhs.at_port (0);
|
||||
}
|
||||
@@ -828,7 +828,7 @@ public:
|
||||
struct LessWithoutPortSet
|
||||
{
|
||||
bool operator() (
|
||||
Endpoint const& lhs, IPAddress const& rhs) const
|
||||
Endpoint const& lhs, IP::Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.address.address() < rhs.address();
|
||||
}
|
||||
@@ -838,12 +838,12 @@ public:
|
||||
return lhs.address.address() < rhs.address.address();
|
||||
}
|
||||
bool operator() (
|
||||
IPAddress const& lhs, Endpoint const& rhs) const
|
||||
IP::Endpoint const& lhs, Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.address() < rhs.address.address();
|
||||
}
|
||||
bool operator() (
|
||||
IPAddress const& lhs, IPAddress const& rhs) const
|
||||
IP::Endpoint const& lhs, IP::Endpoint const& rhs) const
|
||||
{
|
||||
return lhs.address() < rhs.address();
|
||||
}
|
||||
@@ -1032,7 +1032,7 @@ public:
|
||||
// Add one address.
|
||||
// Returns `true` if the address is new.
|
||||
//
|
||||
bool addBootcacheAddress (IPAddress const& address,
|
||||
bool addBootcacheAddress (IP::Endpoint const& address,
|
||||
SharedState::Access& state)
|
||||
{
|
||||
return state->bootcache.insert (address);
|
||||
@@ -1108,13 +1108,13 @@ public:
|
||||
consistency_check (state->config.wantIncoming);
|
||||
Endpoint ep;
|
||||
ep.hops = 0;
|
||||
ep.address = IPAddress (
|
||||
ep.address = IP::Endpoint (
|
||||
IP::AddressV4 ()).at_port (state->config.listeningPort);
|
||||
return ep;
|
||||
}
|
||||
|
||||
// Returns true if the IPAddress contains no invalid data.
|
||||
bool is_valid_address (IPAddress const& address)
|
||||
// Returns true if the IP::Endpoint contains no invalid data.
|
||||
bool is_valid_address (IP::Endpoint const& address)
|
||||
{
|
||||
if (is_unspecified (address))
|
||||
return false;
|
||||
@@ -1197,8 +1197,8 @@ public:
|
||||
}
|
||||
|
||||
// Called when the Checker completes a connectivity test
|
||||
void checkComplete (IPAddress const& address,
|
||||
IPAddress const & checkedAddress, Checker::Result const& result)
|
||||
void checkComplete (IP::Endpoint const& address,
|
||||
IP::Endpoint const & checkedAddress, Checker::Result const& result)
|
||||
{
|
||||
if (result.error == boost::asio::error::operation_aborted)
|
||||
return;
|
||||
@@ -1267,7 +1267,7 @@ public:
|
||||
// of our outbound sockets.
|
||||
//
|
||||
// VFALCO TODO Do the lookup using an additional index by local address
|
||||
bool haveLocalOutboundAddress (IPAddress const& local_address,
|
||||
bool haveLocalOutboundAddress (IP::Endpoint const& local_address,
|
||||
SharedState::Access& state)
|
||||
{
|
||||
for (Slots::const_iterator iter (state->slots.begin());
|
||||
@@ -1286,7 +1286,7 @@ public:
|
||||
|
||||
#if 0
|
||||
void onPeerAddressChanged (
|
||||
IPAddress const& currentAddress, IPAddress const& newAddress)
|
||||
IP::Endpoint const& currentAddress, IP::Endpoint const& newAddress)
|
||||
{
|
||||
// VFALCO TODO Demote this to trace after PROXY is tested.
|
||||
m_journal.debug <<
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
|
||||
void addFixedPeer (std::string const& name,
|
||||
std::vector <IPAddress> const& addresses)
|
||||
std::vector <IP::Endpoint> const& addresses)
|
||||
{
|
||||
m_queue.dispatch (
|
||||
m_context.wrap (
|
||||
@@ -163,12 +163,12 @@ public:
|
||||
section.data().begin()); iter != section.data().end(); ++iter)
|
||||
{
|
||||
std::string const& s (*iter);
|
||||
IPAddress addr (IPAddress::from_string (s));
|
||||
IP::Endpoint addr (IP::Endpoint::from_string (s));
|
||||
if (is_unspecified (addr))
|
||||
addr = IPAddress::from_string_altform(s);
|
||||
addr = IP::Endpoint::from_string_altform(s);
|
||||
if (! is_unspecified (addr))
|
||||
{
|
||||
// add IPAddress to bootstrap cache
|
||||
// add IP::Endpoint to bootstrap cache
|
||||
++n;
|
||||
}
|
||||
}
|
||||
@@ -184,12 +184,12 @@ public:
|
||||
section.data().begin()); iter != section.data().end(); ++iter)
|
||||
{
|
||||
std::string const& s (*iter);
|
||||
IPAddress addr (IPAddress::from_string (s));
|
||||
IP::Endpoint addr (IP::Endpoint::from_string (s));
|
||||
if (is_unspecified (addr))
|
||||
addr = IPAddress::from_string_altform(s);
|
||||
addr = IP::Endpoint::from_string_altform(s);
|
||||
if (! is_unspecified (addr))
|
||||
{
|
||||
// add IPAddress to fixed peers
|
||||
// add IP::Endpoint to fixed peers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,10 +184,10 @@ public:
|
||||
//
|
||||
clock_type::time_point whenAcceptEndpoints;
|
||||
|
||||
// The set of all recent IPAddress that we have seen from this peer.
|
||||
// The set of all recent IP::Endpoint that we have seen from this peer.
|
||||
// We try to avoid sending a peer the same addresses they gave us.
|
||||
//
|
||||
//std::set <IPAddress> received;
|
||||
//std::set <IP::Endpoint> received;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -44,8 +44,8 @@ public:
|
||||
results.addresses.reserve (m_strings.size());
|
||||
for (int i = 0; i < m_strings.size (); ++i)
|
||||
{
|
||||
IPAddress ep (
|
||||
IPAddress::from_string_altform (
|
||||
IP::Endpoint ep (
|
||||
IP::Endpoint::from_string_altform (
|
||||
m_strings [i]));
|
||||
if (! is_unspecified (ep))
|
||||
results.addresses.push_back (ep);
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
|
||||
struct SavedBootstrapAddress
|
||||
{
|
||||
IPAddress address;
|
||||
IP::Endpoint address;
|
||||
std::chrono::seconds cumulativeUptime;
|
||||
int connectionValence;
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
{
|
||||
SavedBootstrapAddress entry;
|
||||
|
||||
entry.address = IPAddress::from_string (s);
|
||||
entry.address = IP::Endpoint::from_string (s);
|
||||
|
||||
if (! is_unspecified (entry.address))
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ is_remote_node_pred <Node> is_remote_node (Node const* node)
|
||||
class is_remote_endpoint
|
||||
{
|
||||
public:
|
||||
explicit is_remote_endpoint (IPAddress const& address)
|
||||
explicit is_remote_endpoint (IP::Endpoint const& address)
|
||||
: m_endpoint (address)
|
||||
{ }
|
||||
template <typename Link>
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
return link.remote_endpoint() == m_endpoint;
|
||||
}
|
||||
private:
|
||||
IPAddress const m_endpoint;
|
||||
IP::Endpoint const m_endpoint;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ struct Gossip
|
||||
struct Item
|
||||
{
|
||||
int balance;
|
||||
IPAddress address;
|
||||
IP::Endpoint address;
|
||||
};
|
||||
|
||||
std::vector <Item> items;
|
||||
|
||||
@@ -35,10 +35,10 @@ public:
|
||||
virtual ~Manager() = 0;
|
||||
|
||||
/** Create a new endpoint keyed by inbound IP address. */
|
||||
virtual Consumer newInboundEndpoint (IPAddress const& address) = 0;
|
||||
virtual Consumer newInboundEndpoint (IP::Endpoint const& address) = 0;
|
||||
|
||||
/** Create a new endpoint keyed by outbound IP address and port. */
|
||||
virtual Consumer newOutboundEndpoint (IPAddress const& address) = 0;
|
||||
virtual Consumer newOutboundEndpoint (IP::Endpoint const& address) = 0;
|
||||
|
||||
/** Create a new endpoint keyed by name. */
|
||||
virtual Consumer newAdminEndpoint (std::string const& name) = 0;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Resource {
|
||||
struct Key
|
||||
{
|
||||
Kind kind;
|
||||
IPAddress address;
|
||||
IP::Endpoint address;
|
||||
std::string name;
|
||||
|
||||
struct hasher
|
||||
@@ -51,7 +51,7 @@ struct Key
|
||||
}
|
||||
|
||||
private:
|
||||
std::hash <IPAddress> m_addr_hash;
|
||||
std::hash <IP::Endpoint> m_addr_hash;
|
||||
boost::hash <std::string> m_name_hash;
|
||||
};
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
state->table.clear();
|
||||
}
|
||||
|
||||
Consumer newInboundEndpoint (IPAddress const& address)
|
||||
Consumer newInboundEndpoint (IP::Endpoint const& address)
|
||||
{
|
||||
if (isWhitelisted (address))
|
||||
return newAdminEndpoint (to_string (address));
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
return Consumer (*this, *entry);
|
||||
}
|
||||
|
||||
Consumer newOutboundEndpoint (IPAddress const& address)
|
||||
Consumer newOutboundEndpoint (IP::Endpoint const& address)
|
||||
{
|
||||
if (isWhitelisted (address))
|
||||
return newAdminEndpoint (to_string (address));
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
bool isWhitelisted (IPAddress const& address)
|
||||
bool isWhitelisted (IP::Endpoint const& address)
|
||||
{
|
||||
if (! is_public (address))
|
||||
return true;
|
||||
|
||||
@@ -42,12 +42,12 @@ public:
|
||||
stopThread ();
|
||||
}
|
||||
|
||||
Consumer newInboundEndpoint (IPAddress const& address)
|
||||
Consumer newInboundEndpoint (IP::Endpoint const& address)
|
||||
{
|
||||
return m_logic.newInboundEndpoint (address);
|
||||
}
|
||||
|
||||
Consumer newOutboundEndpoint (IPAddress const& address)
|
||||
Consumer newOutboundEndpoint (IP::Endpoint const& address)
|
||||
{
|
||||
return m_logic.newOutboundEndpoint (address);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
{
|
||||
Gossip::Item item;
|
||||
item.balance = 100 + random().nextInt (500);
|
||||
item.address = IPAddress (
|
||||
item.address = IP::Endpoint (
|
||||
IP::AddressV4 (207, 127, 82, v + i));
|
||||
gossip.items.push_back (item);
|
||||
}
|
||||
@@ -80,8 +80,8 @@ public:
|
||||
Tests::TestLogic logic (j);
|
||||
|
||||
Charge const fee (dropThreshold + 1);
|
||||
IPAddress const addr (
|
||||
IPAddress::from_string ("207.127.82.2"));
|
||||
IP::Endpoint const addr (
|
||||
IP::Endpoint::from_string ("207.127.82.2"));
|
||||
|
||||
{
|
||||
Consumer c (logic.newInboundEndpoint (addr));
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
Gossip g;
|
||||
Gossip::Item item;
|
||||
item.balance = 100;
|
||||
item.address = IPAddress (
|
||||
item.address = IP::Endpoint (
|
||||
IP::AddressV4 (207, 127, 82, 1));
|
||||
g.items.push_back (item);
|
||||
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
TestLogic logic (j);
|
||||
|
||||
{
|
||||
IPAddress address (IPAddress::from_string ("207.127.82.1"));
|
||||
IP::Endpoint address (IP::Endpoint::from_string ("207.127.82.1"));
|
||||
Consumer c (logic.newInboundEndpoint (address));
|
||||
Charge fee (1000);
|
||||
j.info <<
|
||||
@@ -202,7 +202,7 @@ public:
|
||||
}
|
||||
|
||||
{
|
||||
IPAddress address (IPAddress::from_string ("207.127.82.2"));
|
||||
IP::Endpoint address (IP::Endpoint::from_string ("207.127.82.2"));
|
||||
Consumer c (logic.newInboundEndpoint (address));
|
||||
Charge fee (1000);
|
||||
j.info <<
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
|
||||
if (server == "statsd")
|
||||
{
|
||||
IPAddress const address (IPAddress::from_string (
|
||||
IP::Endpoint const address (IP::Endpoint::from_string (
|
||||
params ["address"].toStdString ()));
|
||||
std::string const& prefix (params ["prefix"].toStdString ());
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
if (! getConfig ().getRpcIP().empty () &&
|
||||
getConfig ().getRpcPort() != 0)
|
||||
{
|
||||
IPAddress ep (IPAddress::from_string (getConfig().getRpcIP()));
|
||||
IP::Endpoint ep (IP::Endpoint::from_string (getConfig().getRpcIP()));
|
||||
if (! is_unspecified (ep))
|
||||
{
|
||||
HTTP::Port port;
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
}
|
||||
|
||||
// Stolen directly from RPCServerHandler
|
||||
std::string processRequest (std::string const& request, IPAddress const& remoteIPAddress)
|
||||
std::string processRequest (std::string const& request, IP::Endpoint const& remoteIPAddress)
|
||||
{
|
||||
Json::Value jvRequest;
|
||||
{
|
||||
|
||||
@@ -847,7 +847,7 @@ Json::Value RPCHandler::doConnect (Json::Value params,
|
||||
else
|
||||
iPort = SYSTEM_PEER_PORT;
|
||||
|
||||
IPAddress ip (IPAddress::from_string(params["ip"].asString ()));
|
||||
IP::Endpoint ip (IP::Endpoint::from_string(params["ip"].asString ()));
|
||||
|
||||
if (! is_unspecified (ip))
|
||||
getApp().getPeers ().connect (ip.at_port(iPort));
|
||||
|
||||
@@ -36,7 +36,7 @@ bool RPCServerHandler::isAuthorized (
|
||||
return HTTPAuthorized (headers);
|
||||
}
|
||||
|
||||
std::string RPCServerHandler::processRequest (std::string const& request, IPAddress const& remoteIPAddress)
|
||||
std::string RPCServerHandler::processRequest (std::string const& request, IP::Endpoint const& remoteIPAddress)
|
||||
{
|
||||
Json::Value jsonRequest;
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
bool isAuthorized (std::map <std::string, std::string> const& headers);
|
||||
|
||||
std::string processRequest (std::string const& request, IPAddress const& remoteIPAddress);
|
||||
std::string processRequest (std::string const& request, IP::Endpoint const& remoteIPAddress);
|
||||
|
||||
private:
|
||||
NetworkOPs& m_networkOPs;
|
||||
|
||||
@@ -23,7 +23,7 @@ SETUP_LOGN (WSConnection, "WSConnection")
|
||||
|
||||
WSConnection::WSConnection (Resource::Manager& resourceManager,
|
||||
Resource::Consumer usage, InfoSub::Source& source, bool isPublic,
|
||||
IPAddress const& remoteAddress, boost::asio::io_service& io_service)
|
||||
IP::Endpoint const& remoteAddress, boost::asio::io_service& io_service)
|
||||
: InfoSub (source, usage)
|
||||
, m_resourceManager (resourceManager)
|
||||
, m_isPublic (isPublic)
|
||||
|
||||
@@ -39,7 +39,7 @@ protected:
|
||||
|
||||
WSConnection (Resource::Manager& resourceManager,
|
||||
Resource::Consumer usage, InfoSub::Source& source, bool isPublic,
|
||||
IPAddress const& remoteAddress, boost::asio::io_service& io_service);
|
||||
IP::Endpoint const& remoteAddress, boost::asio::io_service& io_service);
|
||||
|
||||
virtual ~WSConnection ();
|
||||
|
||||
@@ -57,7 +57,7 @@ protected:
|
||||
Resource::Manager& m_resourceManager;
|
||||
Resource::Consumer m_usage;
|
||||
bool const m_isPublic;
|
||||
IPAddress const m_remoteAddress;
|
||||
IP::Endpoint const m_remoteAddress;
|
||||
LockType m_receiveQueueMutex;
|
||||
std::deque <message_ptr> m_receiveQueue;
|
||||
NetworkOPs& m_netOPs;
|
||||
|
||||
@@ -46,7 +46,7 @@ void parseAddresses (OutputSequence& out, InputIterator first, InputIterator las
|
||||
auto const str (*first);
|
||||
++first;
|
||||
{
|
||||
IPAddress const addr (IPAddress::from_string (str));
|
||||
IP::Endpoint const addr (IP::Endpoint::from_string (str));
|
||||
if (! is_unspecified (addr))
|
||||
{
|
||||
out.push_back (addr);
|
||||
@@ -54,7 +54,7 @@ void parseAddresses (OutputSequence& out, InputIterator first, InputIterator las
|
||||
}
|
||||
}
|
||||
{
|
||||
IPAddress const addr (IPAddress::from_string_altform (str));
|
||||
IP::Endpoint const addr (IP::Endpoint::from_string_altform (str));
|
||||
if (! is_unspecified (addr))
|
||||
{
|
||||
out.push_back (addr);
|
||||
@@ -106,7 +106,7 @@ Config::Config ()
|
||||
LEDGER_CREATOR = false;
|
||||
|
||||
RPC_ALLOW_REMOTE = false;
|
||||
RPC_ADMIN_ALLOW.push_back (beast::IPAddress::from_string("127.0.0.1"));
|
||||
RPC_ADMIN_ALLOW.push_back (beast::IP::Endpoint::from_string("127.0.0.1"));
|
||||
|
||||
PEER_SSL_CIPHER_LIST = DEFAULT_PEER_SSL_CIPHER_LIST;
|
||||
PEER_SCAN_INTERVAL_MIN = DEFAULT_PEER_SCAN_INTERVAL_MIN;
|
||||
@@ -342,8 +342,8 @@ void Config::load ()
|
||||
|
||||
if (smtTmp)
|
||||
{
|
||||
std::vector<IPAddress> parsedAddresses;
|
||||
//parseAddresses<std::vector<IPAddress>, std::vector<std::string>::const_iterator>
|
||||
std::vector<IP::Endpoint> parsedAddresses;
|
||||
//parseAddresses<std::vector<IP::Endpoint>, std::vector<std::string>::const_iterator>
|
||||
// (parsedAddresses, (*smtTmp).cbegin(), (*smtTmp).cend());
|
||||
parseAddresses (parsedAddresses, (*smtTmp).cbegin(), (*smtTmp).cend());
|
||||
RPC_ADMIN_ALLOW.insert (RPC_ADMIN_ALLOW.end(),
|
||||
@@ -693,7 +693,7 @@ void Config::setRpcIpAndOptionalPort (std::string const& newAddress)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Config::Role Config::getAdminRole (Json::Value const& params, beast::IPAddress const& remoteIp) const
|
||||
Config::Role Config::getAdminRole (Json::Value const& params, beast::IP::Endpoint const& remoteIp) const
|
||||
{
|
||||
Config::Role role (Config::FORBID);
|
||||
|
||||
@@ -732,7 +732,7 @@ Config::Role Config::getAdminRole (Json::Value const& params, beast::IPAddress c
|
||||
}
|
||||
|
||||
// Meets IP restriction for admin.
|
||||
IPAddress const remote_addr (remoteIp.at_port (0));
|
||||
IP::Endpoint const remote_addr (remoteIp.at_port (0));
|
||||
bool bAdminIP = false;
|
||||
|
||||
for (auto const& allow_addr : RPC_ADMIN_ALLOW)
|
||||
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
ADMIN,
|
||||
FORBID
|
||||
};
|
||||
Role getAdminRole (Json::Value const& params, IPAddress const& remoteIp) const;
|
||||
Role getAdminRole (Json::Value const& params, IP::Endpoint const& remoteIp) const;
|
||||
|
||||
/** Listening port number for peer connections. */
|
||||
int peerListeningPort;
|
||||
@@ -410,7 +410,7 @@ public:
|
||||
std::string WEBSOCKET_SSL_KEY;
|
||||
|
||||
// RPC parameters
|
||||
std::vector<beast::IPAddress> RPC_ADMIN_ALLOW;
|
||||
std::vector<beast::IP::Endpoint> RPC_ADMIN_ALLOW;
|
||||
std::string RPC_ADMIN_PASSWORD;
|
||||
std::string RPC_ADMIN_USER;
|
||||
std::string RPC_PASSWORD;
|
||||
|
||||
@@ -103,8 +103,8 @@ public:
|
||||
// Note that this returns the original flags
|
||||
virtual Flag getFlags () = 0;
|
||||
|
||||
virtual IPAddress local_endpoint() = 0;
|
||||
virtual IPAddress remote_endpoint() = 0;
|
||||
virtual IP::Endpoint local_endpoint() = 0;
|
||||
virtual IP::Endpoint remote_endpoint() = 0;
|
||||
virtual ProxyInfo getProxyInfo () = 0;
|
||||
|
||||
/** Returns a pointer to the SSL handle or nullptr if no SSL. */
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
@param request The RPC request string.
|
||||
@return The server's response.
|
||||
*/
|
||||
virtual std::string processRequest (std::string const& request, IPAddress const& remoteIPAddress) = 0;
|
||||
virtual std::string processRequest (std::string const& request, IP::Endpoint const& remoteIPAddress) = 0;
|
||||
};
|
||||
|
||||
virtual ~RPCServer () { }
|
||||
|
||||
@@ -89,19 +89,19 @@ protected:
|
||||
return m_origFlags;
|
||||
}
|
||||
|
||||
IPAddress local_endpoint()
|
||||
IP::Endpoint local_endpoint()
|
||||
{
|
||||
return IPAddressConversion::from_asio (
|
||||
m_next_layer.local_endpoint());
|
||||
}
|
||||
|
||||
IPAddress remote_endpoint()
|
||||
IP::Endpoint remote_endpoint()
|
||||
{
|
||||
if (m_proxyInfoSet)
|
||||
{
|
||||
if (m_proxyInfo.protocol == "TCP4")
|
||||
{
|
||||
return IPAddress (
|
||||
return IP::Endpoint (
|
||||
IP::AddressV4 (
|
||||
m_proxyInfo.destAddress.value [0],
|
||||
m_proxyInfo.destAddress.value [1],
|
||||
@@ -112,7 +112,7 @@ protected:
|
||||
|
||||
// VFALCO TODO IPv6 support
|
||||
bassertfalse;
|
||||
return IPAddress();
|
||||
return IP::Endpoint();
|
||||
}
|
||||
|
||||
return IPAddressConversion::from_asio (
|
||||
|
||||
Reference in New Issue
Block a user