Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_transaction_out_106.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_web.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_websocket.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_websocket_handshake.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_websocket_shake.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocols.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_inbound.hpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_websocket.hpp">
<Filter>include\bitcoin\node\protocols</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_websocket_handshake.hpp">
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_websocket_shake.hpp">
<Filter>include\bitcoin\node\protocols</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocols.hpp">
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#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/sessions/session.hpp>
#include <bitcoin/node/sessions/session_inbound.hpp>
Expand Down
1 change: 1 addition & 0 deletions include/bitcoin/node/channels/channel_websocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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 <memory>
#include <bitcoin/node/define.hpp>
Expand All @@ -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<protocol_websocket_handshake>
protected network::tracker<protocol_websocket_shake>
{
public:
typedef std::shared_ptr<protocol_websocket_handshake> ptr;
typedef std::shared_ptr<protocol_websocket_shake> 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<protocol_websocket_handshake>(session->log)
network::tracker<protocol_websocket_shake>(session->log)
{
}

/// Public start is required.
void start() NOEXCEPT override
{
network::protocol_websocket_handshake::start();
network::protocol_websocket_shake::start();
}

private:
Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/protocols/protocols.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
#include <bitcoin/node/protocols/protocol_stratum_v1.hpp>
#include <bitcoin/node/protocols/protocol_stratum_v2.hpp>
#include <bitcoin/node/protocols/protocol_websocket.hpp>
#include <bitcoin/node/protocols/protocol_websocket_handshake.hpp>
#include <bitcoin/node/protocols/protocol_websocket_shake.hpp>

#endif
2 changes: 1 addition & 1 deletion include/bitcoin/node/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" };
Expand Down
2 changes: 1 addition & 1 deletion src/full_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<session_websocket>(*this, config_.server.websocket);
return net::attach<session_websocket>(*this, config_.server.socket);
}

session_bitcoind::ptr full_node::attach_bitcoind_session() NOEXCEPT
Expand Down
38 changes: 19 additions & 19 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1149,7 +1149,7 @@ options_metadata parser::load_settings() THROWS
(
"explore.bind",
value<network::config::authorities>(&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",
Expand Down Expand Up @@ -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<bool>(&configured.server.websocket.secure),
value<bool>(&configured.server.socket.secure),
"The service requires TLS (not implemented), defaults to 'false'."
)
(
"websocket.bind",
value<network::config::authorities>(&configured.server.websocket.binds),
"IP address to bind, multiple allowed, defaults to '0.0.0.0:8080' (all IPv4)."
"socket.bind",
value<network::config::authorities>(&configured.server.socket.binds),
"IP address to bind, multiple allowed, defaults to '0.0.0.0:8280' (all IPv4)."
)
(
"websocket.connections",
value<uint16_t>(&configured.server.websocket.connections),
"socket.connections",
value<uint16_t>(&configured.server.socket.connections),
"The required maximum number of connections, defaults to '0'."
)
(
"websocket.timeout_seconds",
value<uint32_t>(&configured.server.websocket.timeout_seconds),
"socket.timeout_seconds",
value<uint32_t>(&configured.server.socket.timeout_seconds),
"The idle timeout (http keep-alive), defaults to '60'."
)
(
"websocket.server",
value<std::string>(&configured.server.websocket.server),
"socket.server",
value<std::string>(&configured.server.socket.server),
"The server name (http header), defaults to '" BC_HTTP_SERVER_NAME "'."
)
(
"websocket.host",
value<network::config::endpoints>(&configured.server.websocket.hosts),
"socket.host",
value<network::config::endpoints>(&configured.server.socket.hosts),
"The host name (http verification), multiple allowed, defaults to empty (disabled)."
)

Expand All @@ -1228,7 +1228,7 @@ options_metadata parser::load_settings() THROWS
(
"bitcoind.bind",
value<network::config::authorities>(&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",
Expand Down Expand Up @@ -1260,7 +1260,7 @@ options_metadata parser::load_settings() THROWS
(
"electrum.bind",
value<network::config::authorities>(&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",
Expand All @@ -1282,7 +1282,7 @@ options_metadata parser::load_settings() THROWS
(
"stratum_v1.bind",
value<network::config::authorities>(&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",
Expand All @@ -1304,7 +1304,7 @@ options_metadata parser::load_settings() THROWS
(
"stratum_v2.bind",
value<network::config::authorities>(&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",
Expand Down
4 changes: 2 additions & 2 deletions test/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading