20 #ifndef RIPPLE_RPC_WSINFOSUB_H
21 #define RIPPLE_RPC_WSINFOSUB_H
23 #include <ripple/beast/net/IPAddressConversion.h>
24 #include <ripple/json/json_writer.h>
25 #include <ripple/net/InfoSub.h>
26 #include <ripple/rpc/Role.h>
27 #include <ripple/server/WSSession.h>
28 #include <boost/utility/string_view.hpp>
44 auto const& h = ws->request();
48 ws->port().secure_gateway_nets_v4,
49 ws->port().secure_gateway_nets_v6))
51 auto it = h.find(
"X-User");
53 user_ = it->value().to_string();
76 boost::beast::multi_buffer sb;
78 sb.commit(boost::asio::buffer_copy(
79 sb.prepare(n), boost::asio::buffer(data, n)));
void stream(Json::Value const &jv, Write const &write)
Stream compact JSON to the specified function.
std::weak_ptr< WSSession > ws_
Manages a client's subscription to data feeds.
Address const & address() const
Returns the address portion of this endpoint.
WSInfoSub(Source &source, std::shared_ptr< WSSession > const &ws)
void send(Json::Value const &jv, bool) override
static IP::Endpoint from_asio(boost::asio::ip::address const &address)
Abstracts the source of subscription data.
boost::string_view forwardedFor(http_request_type const &request)
boost::string_view user() const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
boost::string_view forwarded_for() const
bool ipAllowed(beast::IP::Address const &remoteIp, std::vector< boost::asio::ip::network_v4 > const &nets4, std::vector< boost::asio::ip::network_v6 > const &nets6)
True if remoteIp is in any of adminIp.