diff --git a/Makefile.am b/Makefile.am
index 3c4db26..f9ab461 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,8 +36,6 @@ src_libbitcoin_protocol_la_CPPFLAGS = -I${srcdir}/include ${zmq_BUILD_CPPFLAGS}
src_libbitcoin_protocol_la_LIBADD = ${zmq_LIBS} ${bitcoin_system_LIBS}
src_libbitcoin_protocol_la_SOURCES = \
src/settings.cpp \
- src/config/authority.cpp \
- src/config/endpoint.cpp \
src/config/sodium.cpp \
src/zmq/authenticator.cpp \
src/zmq/certificate.cpp \
@@ -94,9 +92,6 @@ include_bitcoin_protocol_HEADERS = \
include_bitcoin_protocol_configdir = ${includedir}/bitcoin/protocol/config
include_bitcoin_protocol_config_HEADERS = \
- include/bitcoin/protocol/config/authority.hpp \
- include/bitcoin/protocol/config/config.hpp \
- include/bitcoin/protocol/config/endpoint.hpp \
include/bitcoin/protocol/config/sodium.hpp
include_bitcoin_protocol_zmqdir = ${includedir}/bitcoin/protocol/zmq
diff --git a/builds/cmake/CMakeLists.txt b/builds/cmake/CMakeLists.txt
index 7265fe5..9a8f9ce 100644
--- a/builds/cmake/CMakeLists.txt
+++ b/builds/cmake/CMakeLists.txt
@@ -231,8 +231,6 @@ link_libraries(
#------------------------------------------------------------------------------
add_library( ${CANONICAL_LIB_NAME}
"../../src/settings.cpp"
- "../../src/config/authority.cpp"
- "../../src/config/endpoint.cpp"
"../../src/config/sodium.cpp"
"../../src/zmq/authenticator.cpp"
"../../src/zmq/certificate.cpp"
diff --git a/builds/msvc/vs2022/libbitcoin-protocol/libbitcoin-protocol.vcxproj b/builds/msvc/vs2022/libbitcoin-protocol/libbitcoin-protocol.vcxproj
index 962ed36..d4bef59 100644
--- a/builds/msvc/vs2022/libbitcoin-protocol/libbitcoin-protocol.vcxproj
+++ b/builds/msvc/vs2022/libbitcoin-protocol/libbitcoin-protocol.vcxproj
@@ -121,8 +121,6 @@
-
-
@@ -139,9 +137,6 @@
-
-
-
diff --git a/builds/msvc/vs2022/libbitcoin-protocol/libbitcoin-protocol.vcxproj.filters b/builds/msvc/vs2022/libbitcoin-protocol/libbitcoin-protocol.vcxproj.filters
index 1c7822c..29f793c 100644
--- a/builds/msvc/vs2022/libbitcoin-protocol/libbitcoin-protocol.vcxproj.filters
+++ b/builds/msvc/vs2022/libbitcoin-protocol/libbitcoin-protocol.vcxproj.filters
@@ -36,12 +36,6 @@
-
- src\config
-
-
- src\config
-
src\config
@@ -86,15 +80,6 @@
include\bitcoin\protocol
-
- include\bitcoin\protocol\config
-
-
- include\bitcoin\protocol\config
-
-
- include\bitcoin\protocol\config
-
include\bitcoin\protocol\config
diff --git a/include/bitcoin/protocol.hpp b/include/bitcoin/protocol.hpp
index 0bfd757..e0f6b00 100644
--- a/include/bitcoin/protocol.hpp
+++ b/include/bitcoin/protocol.hpp
@@ -20,9 +20,6 @@
#include
#include
#include
-#include
-#include
-#include
#include
#include
#include
diff --git a/include/bitcoin/protocol/config/authority.hpp b/include/bitcoin/protocol/config/authority.hpp
deleted file mode 100644
index 589ae41..0000000
--- a/include/bitcoin/protocol/config/authority.hpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
- *
- * This file is part of libbitcoin.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-#ifndef LIBBITCOIN_PROTOCOL_CONFIG_AUTHORITY_HPP
-#define LIBBITCOIN_PROTOCOL_CONFIG_AUTHORITY_HPP
-
-#include
-#include
-#include
-#include
-
-namespace libbitcoin {
-namespace protocol {
-
-/// This is a container for a {ip address, port} tuple.
-class BCP_API authority
-{
-public:
- DEFAULT_COPY_MOVE_DESTRUCT(authority);
-
- typedef std::shared_ptr ptr;
-
- authority() NOEXCEPT;
-
- /// Deserialize a IPv4 or IPv6 address-based hostname[:port].
- /// The port is optional and will be set to zero if not provided.
- /// The host can be in one of two forms:
- /// [2001:db8::2]:port or 1.2.240.1:port.
- authority(const std::string& value) THROWS;
-
- /// The host can be in one of three forms:
- /// [2001:db8::2] or 2001:db8::2 or 1.2.240.1
- authority(const std::string& host, uint16_t port) THROWS;
-
- /// True if the port is non-zero.
- operator bool() const NOEXCEPT;
-
- /// The ip address of the authority.
- const ipv6& ip() const NOEXCEPT;
-
- /// The tcp port of the authority.
- uint16_t port() const NOEXCEPT;
-
- /// The hostname of the authority as a string.
- /// The form of the return is determined by the type of address, either:
- /// 2001:db8::2 or 1.2.240.1
- std::string to_hostname() const NOEXCEPT;
-
- /// The authority as a string.
- /// The form of the return is determined by the type of address.
- /// The port is optional and not included if zero-valued.
- /// The authority in one of two forms: [2001:db8::2]:port or 1.2.240.1:port
- std::string to_string() const NOEXCEPT;
-
- friend std::istream& operator>>(std::istream& input,
- authority& argument) THROWS;
- friend std::ostream& operator<<(std::ostream& output,
- const authority& argument) NOEXCEPT;
-
-private:
- // These are not thread safe.
-
- ipv6 ip_;
- uint16_t port_;
-};
-
-typedef std::vector authorities;
-
-} // namespace protocol
-} // namespace libbitcoin
-
-namespace std
-{
-template<>
-struct hash
-{
- size_t operator()(const bc::protocol::authority& value) const NOEXCEPT
- {
- return std::hash{}(value.to_string());
- }
-};
-} // namespace std
-
-#endif
diff --git a/include/bitcoin/protocol/config/config.hpp b/include/bitcoin/protocol/config/config.hpp
deleted file mode 100644
index ac8b612..0000000
--- a/include/bitcoin/protocol/config/config.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
- *
- * This file is part of libbitcoin.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-#ifndef LIBBITCOIN_PROTOCOL_CONFIG_HPP
-#define LIBBITCOIN_PROTOCOL_CONFIG_HPP
-
-#include
-#include
-#include
-
-#endif
diff --git a/include/bitcoin/protocol/config/endpoint.hpp b/include/bitcoin/protocol/config/endpoint.hpp
deleted file mode 100644
index d94c560..0000000
--- a/include/bitcoin/protocol/config/endpoint.hpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
- *
- * This file is part of libbitcoin.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-#ifndef LIBBITCOIN_PROTOCOL_CONFIG_ENDPOINT_HPP
-#define LIBBITCOIN_PROTOCOL_CONFIG_ENDPOINT_HPP
-
-#include
-#include
-#include
-#include
-
-namespace libbitcoin {
-namespace protocol {
-
-/// Serialization helper for a network endpoint in URI format.
-/// This is a container for a {scheme, host, port} tuple.
-class BCP_API endpoint
-{
-public:
- DEFAULT_COPY_MOVE_DESTRUCT(endpoint);
-
- typedef std::shared_ptr ptr;
-
- endpoint() NOEXCEPT;
-
- /// The scheme and port may be undefined, in which case the port is
- /// reported as zero and the scheme is reported as an empty string.
- /// The value is of the form: [scheme://]host[:port]
- endpoint(const std::string& uri) THROWS;
- endpoint(const authority& authority) NOEXCEPT;
-
- /// host may be host name or ip address.
- endpoint(const std::string& host, uint16_t port) NOEXCEPT;
- endpoint(const std::string& scheme, const std::string& host,
- uint16_t port) NOEXCEPT;
-
- /// True if the endpoint is initialized.
- operator bool() const NOEXCEPT;
-
- /// The scheme of the endpoint or empty string.
- const std::string& scheme() const NOEXCEPT;
-
- /// The host name or ip address of the endpoint.
- const std::string& host() const NOEXCEPT;
-
- /// The tcp port of the endpoint.
- uint16_t port() const NOEXCEPT;
-
- /// An empty scheme and/or empty port is omitted.
- /// The endpoint is of the form: [scheme://]host[:port]
- std::string to_string() const NOEXCEPT;
-
- /// Return a new endpoint that replaces host instances of "*" with
- /// "localhost". This is intended for clients that wish to connect
- /// to a service that has been configured to bind to all interfaces.
- /// The endpoint is of the form: [scheme://]host[:port]
- endpoint to_local() const NOEXCEPT;
-
- friend std::istream& operator>>(std::istream& input,
- endpoint& argument) THROWS;
- friend std::ostream& operator<<(std::ostream& output,
- const endpoint& argument) NOEXCEPT;
-
-private:
- // These are not thread safe.
- std::string scheme_;
- std::string host_;
- uint16_t port_;
-};
-
-typedef std::vector endpoints;
-
-} // namespace protocol
-} // namespace libbitcoin
-
-namespace std
-{
-template<>
-struct hash
-{
- size_t operator()(const bc::protocol::endpoint& value) const NOEXCEPT
- {
- return std::hash{}(value.to_string());
- }
-};
-} // namespace std
-
-#endif
diff --git a/include/bitcoin/protocol/zmq/authenticator.hpp b/include/bitcoin/protocol/zmq/authenticator.hpp
index 32c022d..0e82832 100644
--- a/include/bitcoin/protocol/zmq/authenticator.hpp
+++ b/include/bitcoin/protocol/zmq/authenticator.hpp
@@ -24,7 +24,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -45,7 +44,7 @@ class BCP_API authenticator
typedef std::shared_ptr ptr;
/// The fixed inprocess authentication endpoint.
- static const endpoint authentication_point;
+ static const system::config::endpoint authentication_point;
/// There may be only one authenticator per process.
authenticator(thread_priority priority=thread_priority::normal) NOEXCEPT;
@@ -77,10 +76,10 @@ class BCP_API authenticator
virtual void allow(const system::hash_digest& public_key) NOEXCEPT;
/// Allow clients with the following ip addresses (whitelist).
- virtual void allow(const authority& address) NOEXCEPT;
+ virtual void allow(const system::config::authority& address) NOEXCEPT;
/// Allow clients with the following ip addresses (blacklist).
- virtual void deny(const authority& address) NOEXCEPT;
+ virtual void deny(const system::config::authority& address) NOEXCEPT;
protected:
void work() NOEXCEPT override;
diff --git a/include/bitcoin/protocol/zmq/certificate.hpp b/include/bitcoin/protocol/zmq/certificate.hpp
index fbb2a38..bcfb7a1 100644
--- a/include/bitcoin/protocol/zmq/certificate.hpp
+++ b/include/bitcoin/protocol/zmq/certificate.hpp
@@ -20,7 +20,7 @@
#define LIBBITCOIN_PROTOCOL_ZMQ_CERTIFICATE_HPP
#include
-#include
+#include
#include
namespace libbitcoin {
diff --git a/include/bitcoin/protocol/zmq/socket.hpp b/include/bitcoin/protocol/zmq/socket.hpp
index 3e1cb7b..a3afe17 100644
--- a/include/bitcoin/protocol/zmq/socket.hpp
+++ b/include/bitcoin/protocol/zmq/socket.hpp
@@ -20,7 +20,7 @@
#define LIBBITCOIN_PROTOCOL_ZMQ_SOCKET_HPP
#include
-#include
+#include
#include
#include
#include
@@ -91,10 +91,10 @@ class BCP_API socket
identifier id() const NOEXCEPT;
/// Bind the socket to the specified local address.
- error::code bind(const endpoint& address) NOEXCEPT;
+ error::code bind(const system::config::endpoint& address) NOEXCEPT;
/// Connect the socket to the specified remote address.
- error::code connect(const endpoint& address) NOEXCEPT;
+ error::code connect(const system::config::endpoint& address) NOEXCEPT;
/// Sets the domain for ZAP (ZMQ RFC 27) authentication.
bool set_authentication_domain(const std::string& domain) NOEXCEPT;
@@ -115,7 +115,7 @@ class BCP_API socket
bool set_certificate(const certificate& certificate) NOEXCEPT;
/// Configure the socket to connect through the specified socks5 proxy.
- bool set_socks_proxy(const authority& socks_proxy) NOEXCEPT;
+ bool set_socks_proxy(const system::config::authority& socks_proxy) NOEXCEPT;
/// Configure subscriber socket to apply the message filter.
bool set_subscription(const system::data_chunk& filter) NOEXCEPT;
diff --git a/src/config/authority.cpp b/src/config/authority.cpp
deleted file mode 100644
index 56fdb8e..0000000
--- a/src/config/authority.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
- *
- * This file is part of libbitcoin.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-#include
-
-#include
-#include
-#include
-#include
-
-namespace libbitcoin {
-namespace protocol {
-
-constexpr ip_address null_ip_address
-{
- {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
-};
-
-// host: [2001:db8::2] or 2001:db8::2 or 1.2.240.1
-// returns: [2001:db8::2] or [2001:db8::2] or 1.2.240.1
-static std::string to_host_name(const std::string& host) NOEXCEPT
-{
- if (host.find(":") == std::string::npos || is_zero(host.find("[")))
- return host;
-
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
- return (boost::format("[%1%]") % host).str();
- BC_POP_WARNING()
-}
-
-// host: [2001:db8::2] or 2001:db8::2 or 1.2.240.1
-static std::string to_text(const std::string& host,
- uint16_t port) THROWS
-{
- std::stringstream authority;
- authority << to_host_name(host);
- if (!is_zero(port))
- authority << ":" << port;
-
- return authority.str();
-}
-
-static std::string to_ipv6(const std::string& ipv4_address) NOEXCEPT
-{
- return std::string("::ffff:") + ipv4_address;
-}
-
-static ipv6 to_ipv6(const ipv4& ipv4_address) NOEXCEPT
-{
- boost::system::error_code ignore;
-
- // Create an IPv6 mapped IPv4 address via serialization.
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
- const auto ipv6 = to_ipv6(ipv4_address.to_string());
- return ipv6::from_string(ipv6, ignore);
- BC_POP_WARNING()
-}
-
-static ipv6 to_ipv6(const ip& ip_address) NOEXCEPT
-{
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
-
- if (ip_address.is_v6())
- return ip_address.to_v6();
-
- BC_ASSERT_MSG(ip_address.is_v4(), "Address must be either IPv4 or IPv6.");
- return to_ipv6(ip_address.to_v4());
-
- BC_POP_WARNING()
-}
-
-static std::string to_ipv4_hostname(const ip& ip_address) NOEXCEPT
-{
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
-
- // C++11: use std::regex.
- // std::regex requires gcc 4.9, so we are using boost::regex for now.
- static const boost::regex regular("^::ffff:([0-9\\.]+)$");
-
- const auto address = ip_address.to_string();
- boost::sregex_iterator it(address.begin(), address.end(), regular), end;
- if (it == end)
- return {};
-
- const auto& match = *it;
- return match[1];
-
- BC_POP_WARNING()
-}
-
-static std::string to_ipv6_hostname(const ip& ip_address) NOEXCEPT
-{
- // IPv6 URLs use a bracketed IPv6 address, see rfc2732.
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
- return (boost::format("[%1%]") % to_ipv6(ip_address)).str();
- BC_POP_WARNING()
-}
-
-BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
-authority::authority() NOEXCEPT
- : ip_(null_ip_address), port_(0)
-BC_POP_WARNING()
-{
-}
-
-// authority: [2001:db8::2]:port or 1.2.240.1:port
-authority::authority(const std::string& value) THROWS
- : authority()
-{
- std::stringstream(value) >> *this;
-}
-
-// host: [2001:db8::2] or 2001:db8::2 or 1.2.240.1
-authority::authority(const std::string& host, uint16_t port) THROWS
- : authority()
-{
- std::stringstream(to_text(host, port)) >> *this;
-}
-
-authority::operator bool() const NOEXCEPT
-{
- return !is_zero(port_);
-}
-
-const ipv6& authority::ip() const NOEXCEPT
-{
- return ip_;
-}
-
-uint16_t authority::port() const NOEXCEPT
-{
- return port_;
-}
-
-std::string authority::to_hostname() const NOEXCEPT
-{
- auto ipv4_hostname = to_ipv4_hostname(ip_);
- return ipv4_hostname.empty() ? to_ipv6_hostname(ip_) : ipv4_hostname;
-}
-
-std::string authority::to_string() const NOEXCEPT
-{
- std::stringstream value;
- value << *this;
-
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
- return value.str();
- BC_POP_WARNING()
-}
-
-std::istream& operator>>(std::istream& input,
- authority& argument) THROWS
-{
- std::string value;
- input >> value;
-
- // C++11: use std::regex.
- // std::regex requires gcc 4.9, so we are using boost::regex for now.
- static const boost::regex regular(
- "^(([0-9\\.]+)|\\[([0-9a-f:\\.]+)])(:([0-9]{1,5}))?$");
-
- boost::sregex_iterator it(value.begin(), value.end(), regular), end;
- if (it == end)
- throw istream_exception(value);
-
- const auto& match = *it;
- std::string port(match[5]);
- std::string ip_address(match[3]);
- if (ip_address.empty())
- ip_address = to_ipv6(match[2]);
-
- try
- {
- argument.ip_ = ipv6::from_string(ip_address);
- }
- catch (const std::exception&)
- {
- throw istream_exception(value);
- }
-
- if (port.empty())
- argument.port_ = 0;
- else if (!system::deserialize(argument.port_, port))
- throw istream_exception(value);
-
- return input;
-}
-
-std::ostream& operator<<(std::ostream& output,
- const authority& argument) NOEXCEPT
-{
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
- output << to_text(argument.to_hostname(), argument.port());
- BC_POP_WARNING()
-
- return output;
-}
-
-} // namespace protocol
-} // namespace libbitcoin
diff --git a/src/config/endpoint.cpp b/src/config/endpoint.cpp
deleted file mode 100644
index 9751007..0000000
--- a/src/config/endpoint.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
- *
- * This file is part of libbitcoin.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-#include
-
-#include
-#include
-#include
-#include
-
-namespace libbitcoin {
-namespace protocol {
-
-using namespace bc::system;
-
-BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
-endpoint::endpoint() NOEXCEPT
- : scheme_(), host_("localhost"), port_(0)
-BC_POP_WARNING()
-{
-}
-
-endpoint::endpoint(const std::string& uri) THROWS
- : scheme_(), host_(), port_(0)
-{
- std::stringstream(uri) >> *this;
-}
-
-BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
-endpoint::endpoint(const authority& authority) NOEXCEPT
- : endpoint(authority.to_string())
-BC_POP_WARNING()
-{
-}
-
-endpoint::endpoint(const std::string& host, uint16_t port) NOEXCEPT
- : scheme_(), host_(host), port_(port)
-{
-}
-
-endpoint::endpoint(const std::string& scheme, const std::string& host,
- uint16_t port) NOEXCEPT
- : scheme_(scheme), host_(host), port_(port)
-{
-}
-
-const std::string& endpoint::scheme() const NOEXCEPT
-{
- return scheme_;
-}
-
-const std::string& endpoint::host() const NOEXCEPT
-{
- return host_;
-}
-
-uint16_t endpoint::port() const NOEXCEPT
-{
- return port_;
-}
-
-std::string endpoint::to_string() const NOEXCEPT
-{
- std::stringstream value;
- value << *this;
-
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
- return value.str();
- BC_POP_WARNING()
-}
-
-endpoint endpoint::to_local() const NOEXCEPT
-{
- const auto host = (host_ == "*" ? "localhost" : host_);
- return endpoint(scheme_, host, port_);
-}
-
-endpoint::operator bool() const NOEXCEPT
-{
- return !scheme_.empty();
-}
-
-std::istream& operator>>(std::istream& input,
- endpoint& argument) THROWS
-{
- std::string value;
- input >> value;
-
- // C++11: use std::regex.
- // std::regex requires gcc 4.9, so we are using boost::regex for now.
- static const boost::regex regular("^((tcp|udp|http|https|inproc):\\/\\/)?"
- "(\\[([0-9a-f:\\.]+)]|([^:]+))(:([0-9]{1,5}))?$");
-
- boost::sregex_iterator it(value.begin(), value.end(), regular), end;
- if (it == end)
- throw istream_exception(value);
-
- const auto& match = *it;
- argument.scheme_ = match[2];
- argument.host_ = match[3];
- std::string port(match[7]);
-
- if (port.empty())
- argument.port_ = 0;
- else if (!system::deserialize(argument.port_, port))
- throw istream_exception(value);
-
- return input;
-}
-
-std::ostream& operator<<(std::ostream& output,
- const endpoint& argument) NOEXCEPT
-{
- BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
- if (!argument.scheme().empty())
- output << argument.scheme() << "://";
-
- output << argument.host();
-
- if (!is_zero(argument.port()))
- output << ":" << argument.port();
- BC_POP_WARNING()
-
- return output;
-}
-
-} // namespace network
-} // namespace libbitcoin
diff --git a/src/zmq/authenticator.cpp b/src/zmq/authenticator.cpp
index 3945634..5773663 100644
--- a/src/zmq/authenticator.cpp
+++ b/src/zmq/authenticator.cpp
@@ -20,7 +20,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -35,7 +35,7 @@ namespace zmq {
using namespace bc::system;
// ZAP endpoint, see: rfc.zeromq.org/spec:27/ZAP
-const endpoint authenticator::authentication_point("inproc://zeromq.zap.01");
+const config::endpoint authenticator::authentication_point("inproc://zeromq.zap.01");
// There may be only one authenticator per process.
authenticator::authenticator(thread_priority priority) NOEXCEPT
@@ -333,7 +333,7 @@ void authenticator::allow(const hash_digest& public_key) NOEXCEPT
BC_POP_WARNING()
}
-void authenticator::allow(const authority& address) NOEXCEPT
+void authenticator::allow(const config::authority& address) NOEXCEPT
{
BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
///////////////////////////////////////////////////////////////////////////
@@ -343,12 +343,12 @@ void authenticator::allow(const authority& address) NOEXCEPT
require_allow_ = true;
// Due to emplace behavior, first writer wins allow/deny conflict.
- adresses_.emplace(address.to_hostname(), true);
+ adresses_.emplace(address.to_host(), true);
///////////////////////////////////////////////////////////////////////////
BC_POP_WARNING()
}
-void authenticator::deny(const authority& address) NOEXCEPT
+void authenticator::deny(const config::authority& address) NOEXCEPT
{
BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
///////////////////////////////////////////////////////////////////////////
@@ -357,7 +357,7 @@ void authenticator::deny(const authority& address) NOEXCEPT
// Denial is effective independent of whitelisting.
// Due to emplace behavior, first writer wins allow/deny conflict.
- adresses_.emplace(address.to_hostname(), false);
+ adresses_.emplace(address.to_host(), false);
///////////////////////////////////////////////////////////////////////////
BC_POP_WARNING()
}
diff --git a/src/zmq/socket.cpp b/src/zmq/socket.cpp
index 67a4d08..2419b78 100644
--- a/src/zmq/socket.cpp
+++ b/src/zmq/socket.cpp
@@ -20,7 +20,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -193,17 +193,17 @@ identifier socket::id() const NOEXCEPT
return identifier_;
}
-error::code socket::bind(const endpoint& address) NOEXCEPT
+error::code socket::bind(const config::endpoint& address) NOEXCEPT
{
- if (zmq_bind(self_, address.to_string().c_str()) == zmq_fail)
+ if (zmq_bind(self_, address.to_uri().c_str()) == zmq_fail)
return error::get_last_error();
return error::success;
}
-error::code socket::connect(const endpoint& address) NOEXCEPT
+error::code socket::connect(const config::endpoint& address) NOEXCEPT
{
- if (zmq_connect(self_, address.to_string().c_str()) == zmq_fail)
+ if (zmq_connect(self_, address.to_uri().c_str()) == zmq_fail)
return error::get_last_error();
return error::success;
@@ -272,14 +272,17 @@ bool socket::set_private_key(const sodium& key) NOEXCEPT
// to generate an arbitrary client certificate for a secure socket.
bool socket::set_certificate(const certificate& certificate) NOEXCEPT
{
+ BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
return certificate &&
set_public_key(certificate.public_key().to_string()) &&
set_private_key(certificate.private_key().to_string());
+ BC_POP_WARNING()
}
-bool socket::set_socks_proxy(const authority& socks_proxy) NOEXCEPT
+bool socket::set_socks_proxy(const config::authority& socks_proxy) NOEXCEPT
{
- return socks_proxy && set(ZMQ_SOCKS_PROXY, socks_proxy.to_string());
+ return is_nonzero(socks_proxy.port()) &&
+ set(ZMQ_SOCKS_PROXY, socks_proxy.to_string());
}
bool socket::set_subscription(const data_chunk& filter) NOEXCEPT