mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add /crawl cgi request feature to peer protocol (RIPD-729):
This adds support for a cgi /crawl request, issued over HTTPS to the configured peer protocol port. The response to the request is a JSON object containing the node public key, type, and IP address of each directly connected neighbor. The IP address is suppressed unless the neighbor has requested its address to be revealed by adding "Crawl: public" to its HTTP headers. This field is currently set by the peer_private option in the rippled.cfg file.
This commit is contained in:
@@ -218,7 +218,8 @@ ConnectAttempt::onHandshake (error_code ec)
|
||||
return close(); // makeSharedValue logs
|
||||
|
||||
beast::http::message req = makeRequest(
|
||||
remote_endpoint_.address());
|
||||
! overlay_.peerFinder().config().peerPrivate,
|
||||
remote_endpoint_.address());
|
||||
auto const hello = buildHello (sharedValue, getApp());
|
||||
appendHello (req, hello);
|
||||
|
||||
@@ -509,7 +510,7 @@ ConnectAttempt::onReadBody (error_code ec,
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
beast::http::message
|
||||
ConnectAttempt::makeRequest (
|
||||
ConnectAttempt::makeRequest (bool crawl,
|
||||
boost::asio::ip::address const& remote_address)
|
||||
{
|
||||
beast::http::message m;
|
||||
@@ -521,13 +522,7 @@ ConnectAttempt::makeRequest (
|
||||
//std::string("RTXP/") + to_string (BuildInfo::getCurrentProtocol()));
|
||||
m.headers.append ("Connection", "Upgrade");
|
||||
m.headers.append ("Connect-As", "Peer");
|
||||
//m.headers.append ("Connect-As", "Leaf, Peer");
|
||||
//m.headers.append ("Accept-Encoding", "identity");
|
||||
//m.headers.append ("Local-Address", stream_.
|
||||
//m.headers.append ("X-Try-IPs", "192.168.0.1:51234");
|
||||
//m.headers.append ("X-Try-IPs", "208.239.114.74:51234");
|
||||
//m.headers.append ("A", "BC");
|
||||
//m.headers.append ("Content-Length", "0");
|
||||
m.headers.append ("Crawl", crawl ? "public" : "private");
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user