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