Add RPC/WS ports to server_info (#4427)

Enhance the /crawl endpoint by publishing WebSocket/RPC ports in the
server_info response. The function processing requests to the /crawl
endpoint actually calls server_info internally, so this change enables a
server to advertise its WebSocket/RPC port(s) to peers via the /crawl
endpoint. `grpc` and `peer` ports are included as well.

The new `ports` array contains objects, each containing a `port` for the
listening port (number string), and an array `protocol` listing the
supported protocol(s).

This allows crawlers to build a richer topology without needing to
port-scan nodes. For non-admin users (including peers), the info about
*admin* ports is excluded.

Also increase test coverage for RPC ServerInfo.

Fix #2837.
This commit is contained in:
drlongle
2023-06-23 19:19:26 +02:00
committed by GitHub
parent 724a301599
commit 0b812cdece
6 changed files with 121 additions and 4 deletions

View File

@@ -602,6 +602,13 @@ public:
return *m_networkOPs;
}
virtual ServerHandlerImp&
getServerHandler() override
{
assert(serverHandler_);
return *serverHandler_;
}
boost::asio::io_service&
getIOService() override
{