diff --git a/Makefile.am b/Makefile.am index dca45e965..54d9a1f5b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -212,7 +212,7 @@ include_bitcoin_node_protocols_HEADERS = \ include/bitcoin/node/protocols/protocol_transaction_out_106.hpp \ include/bitcoin/node/protocols/protocol_web.hpp \ include/bitcoin/node/protocols/protocol_websocket.hpp \ - include/bitcoin/node/protocols/protocol_websocket_handshake.hpp \ + include/bitcoin/node/protocols/protocol_websocket_shake.hpp \ include/bitcoin/node/protocols/protocols.hpp include_bitcoin_node_sessionsdir = ${includedir}/bitcoin/node/sessions diff --git a/builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj b/builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj index 01e85c7fd..da20ace6c 100644 --- a/builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj +++ b/builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj @@ -216,7 +216,7 @@ - + diff --git a/builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj.filters b/builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj.filters index 57f3e2f58..0f362992c 100644 --- a/builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj.filters +++ b/builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj.filters @@ -335,7 +335,7 @@ include\bitcoin\node\protocols - + include\bitcoin\node\protocols diff --git a/include/bitcoin/node.hpp b/include/bitcoin/node.hpp index 1e9b1f4a6..e01b206d1 100644 --- a/include/bitcoin/node.hpp +++ b/include/bitcoin/node.hpp @@ -70,7 +70,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/bitcoin/node/channels/channel_websocket.hpp b/include/bitcoin/node/channels/channel_websocket.hpp index 70974e197..dd4ac86f4 100644 --- a/include/bitcoin/node/channels/channel_websocket.hpp +++ b/include/bitcoin/node/channels/channel_websocket.hpp @@ -28,6 +28,7 @@ namespace libbitcoin { namespace node { /// Abstract base websocket channel state for the node. +/// Does not inherit node::channel_http but does inherit network::channel_http. class BCN_API channel_websocket : public network::channel_websocket, public node::channel diff --git a/include/bitcoin/node/protocols/protocol_websocket_handshake.hpp b/include/bitcoin/node/protocols/protocol_websocket_shake.hpp similarity index 68% rename from include/bitcoin/node/protocols/protocol_websocket_handshake.hpp rename to include/bitcoin/node/protocols/protocol_websocket_shake.hpp index f5034854b..bbca1dcc2 100644 --- a/include/bitcoin/node/protocols/protocol_websocket_handshake.hpp +++ b/include/bitcoin/node/protocols/protocol_websocket_shake.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_WEBSOCKET_HANDSHAKE_HPP -#define LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_WEBSOCKET_HANDSHAKE_HPP +#ifndef LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_WEBSOCKET_SHAKE_HPP +#define LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_WEBSOCKET_SHAKE_HPP #include #include @@ -26,32 +26,32 @@ namespace libbitcoin { namespace node { -// TODO: make this an intermediate base class for websocket_handshake. +// TODO: make this an intermediate base class for websocket_shake. // TODO: and then create a distinct concrete class for deployment. -class BCN_API protocol_websocket_handshake - : public network::protocol_websocket_handshake, +class BCN_API protocol_websocket_shake + : public network::protocol_websocket_shake, public node::protocol, - protected network::tracker + protected network::tracker { public: - typedef std::shared_ptr ptr; + typedef std::shared_ptr ptr; // Replace base class channel_t (network::channel_http). using channel_t = node::channel_http; - protocol_websocket_handshake(const auto& session, + protocol_websocket_shake(const auto& session, const network::channel::ptr& channel, const options_t& options) NOEXCEPT - : network::protocol_websocket_handshake(session, channel, options), + : network::protocol_websocket_shake(session, channel, options), node::protocol(session, channel), - network::tracker(session->log) + network::tracker(session->log) { } /// Public start is required. void start() NOEXCEPT override { - network::protocol_websocket_handshake::start(); + network::protocol_websocket_shake::start(); } private: diff --git a/include/bitcoin/node/protocols/protocols.hpp b/include/bitcoin/node/protocols/protocols.hpp index 78bb663f8..4369a6310 100644 --- a/include/bitcoin/node/protocols/protocols.hpp +++ b/include/bitcoin/node/protocols/protocols.hpp @@ -50,6 +50,6 @@ #include #include #include -#include +#include #endif diff --git a/include/bitcoin/node/settings.hpp b/include/bitcoin/node/settings.hpp index 5e7e74304..6cfdb2d5d 100644 --- a/include/bitcoin/node/settings.hpp +++ b/include/bitcoin/node/settings.hpp @@ -136,7 +136,7 @@ class BCN_API settings server::settings::html_server explore{ "explore" }; /// native websocket query interface (http/s->tcp/s, json, handshake) - network::settings::websocket_server websocket{ "websocket" }; + network::settings::websocket_server socket{ "socket" }; /// bitcoind compat interface (http/s, stateless json-rpc-v2) network::settings::http_server bitcoind{ "bitcoind" }; diff --git a/src/full_node.cpp b/src/full_node.cpp index 9077461d6..62e6118b3 100644 --- a/src/full_node.cpp +++ b/src/full_node.cpp @@ -548,7 +548,7 @@ session_explore::ptr full_node::attach_explore_session() NOEXCEPT session_websocket::ptr full_node::attach_websocket_session() NOEXCEPT { - return net::attach(*this, config_.server.websocket); + return net::attach(*this, config_.server.socket); } session_bitcoind::ptr full_node::attach_bitcoind_session() NOEXCEPT diff --git a/src/parser.cpp b/src/parser.cpp index a4550502f..14178819e 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -94,7 +94,7 @@ parser::parser(system::chain::selection context) NOEXCEPT // admin configured.server.web.binds.emplace_back(asio::address{}, 8080_u16); configured.server.explore.binds.emplace_back(asio::address{}, 8180_u16); - configured.server.websocket.binds.emplace_back(asio::address{}, 8280_u16); + configured.server.socket.binds.emplace_back(asio::address{}, 8280_u16); configured.server.bitcoind.binds.emplace_back(asio::address{}, 8380_u16); configured.server.electrum.binds.emplace_back(asio::address{}, 8480_u16); configured.server.stratum_v1.binds.emplace_back(asio::address{}, 8580_u16); @@ -1149,7 +1149,7 @@ options_metadata parser::load_settings() THROWS ( "explore.bind", value(&configured.server.explore.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)." + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8180' (all IPv4)." ) ( "explore.connections", @@ -1187,35 +1187,35 @@ options_metadata parser::load_settings() THROWS "The path of the default source page, defaults to 'index.html'." ) - /* [websocket] */ + /* [socket] */ ( "websocket.secure", - value(&configured.server.websocket.secure), + value(&configured.server.socket.secure), "The service requires TLS (not implemented), defaults to 'false'." ) ( - "websocket.bind", - value(&configured.server.websocket.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)." + "socket.bind", + value(&configured.server.socket.binds), + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8280' (all IPv4)." ) ( - "websocket.connections", - value(&configured.server.websocket.connections), + "socket.connections", + value(&configured.server.socket.connections), "The required maximum number of connections, defaults to '0'." ) ( - "websocket.timeout_seconds", - value(&configured.server.websocket.timeout_seconds), + "socket.timeout_seconds", + value(&configured.server.socket.timeout_seconds), "The idle timeout (http keep-alive), defaults to '60'." ) ( - "websocket.server", - value(&configured.server.websocket.server), + "socket.server", + value(&configured.server.socket.server), "The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'." ) ( - "websocket.host", - value(&configured.server.websocket.hosts), + "socket.host", + value(&configured.server.socket.hosts), "The host name (http verification), multiple allowed, defaults to empty (disabled)." ) @@ -1228,7 +1228,7 @@ options_metadata parser::load_settings() THROWS ( "bitcoind.bind", value(&configured.server.bitcoind.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)." + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8380' (all IPv4)." ) ( "bitcoind.connections", @@ -1260,7 +1260,7 @@ options_metadata parser::load_settings() THROWS ( "electrum.bind", value(&configured.server.electrum.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)." + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8480' (all IPv4)." ) ( "electrum.connections", @@ -1282,7 +1282,7 @@ options_metadata parser::load_settings() THROWS ( "stratum_v1.bind", value(&configured.server.stratum_v1.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)." + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8580' (all IPv4)." ) ( "stratum_v1.connections", @@ -1304,7 +1304,7 @@ options_metadata parser::load_settings() THROWS ( "stratum_v2.bind", value(&configured.server.stratum_v2.binds), - "IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)." + "IP address to bind, multiple allowed, defaults to '0.0.0.0:8680' (all IPv4)." ) ( "stratum_v2.connections", diff --git a/test/settings.cpp b/test/settings.cpp index 1d4b3cb62..df78428ff 100644 --- a/test/settings.cpp +++ b/test/settings.cpp @@ -159,10 +159,10 @@ BOOST_AUTO_TEST_CASE(server__explore_server__defaults__expected) BOOST_AUTO_TEST_CASE(server__websocket_server__defaults__expected) { const server::settings instance{}; - const auto server = instance.websocket; + const auto server = instance.socket; // tcp_server - BOOST_REQUIRE_EQUAL(server.name, "websocket"); + BOOST_REQUIRE_EQUAL(server.name, "socket"); BOOST_REQUIRE(!server.secure); BOOST_REQUIRE(server.binds.empty()); BOOST_REQUIRE_EQUAL(server.connections, 0u);