diff --git a/.gitmodules b/.gitmodules index 9b49fa876..ddf50410d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -35,4 +35,7 @@ [submodule "external/ngtcp2"] path = external/ngtcp2 url = https://github.com/ngtcp2/ngtcp2.git - branch = v0.1.0 \ No newline at end of file + branch = v0.1.0 +[submodule "external/oxen-encoding"] + path = external/oxen-encoding + url = https://github.com/oxen-io/oxen-encoding.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c6bc125b..8cdd74719 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,6 @@ include(cmake/target_link_libraries_system.cmake) include(cmake/add_import_library.cmake) include(cmake/add_log_tag.cmake) include(cmake/libatomic.cmake) -include(cmake/link_dep_libs.cmake) if (STATIC_LINK) set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) @@ -180,15 +179,24 @@ if(NOT TARGET sodium) export(TARGETS sodium NAMESPACE sodium:: FILE sodium-exports.cmake) endif() +option(FORCE_OXENC_SUBMODULE "force using oxen-encoding submodule" OFF) +if(NOT FORCE_OXENC_SUBMODULE) + pkg_check_modules(OXENC liboxenc>=1.0.1 IMPORTED_TARGET) +endif() +if(OXENC_FOUND) + add_library(oxenc::oxenc ALIAS PkgConfig::OXENC) + message(STATUS "Found system liboxenc ${OXENC_VERSION}") +else() + message(STATUS "using oxen-encoding submodule") + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/oxen-encoding) +endif() + option(FORCE_OXENMQ_SUBMODULE "force using oxenmq submodule" OFF) if(NOT FORCE_OXENMQ_SUBMODULE) - pkg_check_modules(OXENMQ liboxenmq>=1.2.4) + pkg_check_modules(OXENMQ liboxenmq>=1.2.4 IMPORTED_TARGET) endif() if(OXENMQ_FOUND) - add_library(oxenmq INTERFACE) - link_dep_libs(oxenmq INTERFACE "${OXENMQ_LIBRARY_DIRS}" ${OXENMQ_LIBRARIES}) - target_include_directories(oxenmq INTERFACE ${OXENMQ_INCLUDE_DIRS}) - add_library(oxenmq::oxenmq ALIAS oxenmq) + add_library(oxenmq::oxenmq ALIAS PkgConfig::OXENMQ) message(STATUS "Found system liboxenmq ${OXENMQ_VERSION}") else() message(STATUS "using oxenmq submodule") diff --git a/cmake/link_dep_libs.cmake b/cmake/link_dep_libs.cmake deleted file mode 100644 index 14e4b4f16..000000000 --- a/cmake/link_dep_libs.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# Properly links a target to a list of library names by finding the given libraries. Takes: -# - a target -# - a linktype (e.g. INTERFACE, PUBLIC, PRIVATE) -# - a library search path (or "" for defaults) -# - any number of library names -function(link_dep_libs target linktype libdirs) - foreach(lib ${ARGN}) - find_library(link_lib-${lib} NAMES ${lib} PATHS ${libdirs}) - if(link_lib-${lib}) - target_link_libraries(${target} ${linktype} ${link_lib-${lib}}) - endif() - endforeach() -endfunction() diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 8f7c49d84..0f935161b 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -22,6 +22,7 @@ if(SUBMODULE_CHECK) check_submodule(pybind11) check_submodule(sqlite_orm) check_submodule(oxen-mq) + check_submodule(oxen-encoding) check_submodule(uvw) check_submodule(cpr) check_submodule(ngtcp2) diff --git a/external/oxen-encoding b/external/oxen-encoding new file mode 160000 index 000000000..077cbff7a --- /dev/null +++ b/external/oxen-encoding @@ -0,0 +1 @@ +Subproject commit 077cbff7a38ce5c538d9653ffb119855151791c5 diff --git a/external/oxen-mq b/external/oxen-mq index 51754037e..5c72a57ec 160000 --- a/external/oxen-mq +++ b/external/oxen-mq @@ -1 +1 @@ -Subproject commit 51754037ea19204610751c2ea8ae72b7ed6c1818 +Subproject commit 5c72a57eca120750ecf557ce5a668fb38242956b diff --git a/llarp/crypto/types.cpp b/llarp/crypto/types.cpp index 3db017647..b2f190b83 100644 --- a/llarp/crypto/types.cpp +++ b/llarp/crypto/types.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include @@ -20,14 +20,14 @@ namespace llarp { if (str.size() != 2 * size()) return false; - oxenmq::from_hex(str.begin(), str.end(), begin()); + oxenc::from_hex(str.begin(), str.end(), begin()); return true; } std::string PubKey::ToString() const { - return oxenmq::to_hex(begin(), end()); + return oxenc::to_hex(begin(), end()); } bool diff --git a/llarp/dht/messages/findname.cpp b/llarp/dht/messages/findname.cpp index 929db0ed7..049cc0724 100644 --- a/llarp/dht/messages/findname.cpp +++ b/llarp/dht/messages/findname.cpp @@ -1,5 +1,5 @@ #include "findname.hpp" -#include +#include #include #include "gotname.hpp" #include @@ -16,7 +16,7 @@ namespace llarp::dht bool FindNameMessage::BEncode(llarp_buffer_t* buf) const { - const auto data = oxenmq::bt_serialize(oxenmq::bt_dict{ + const auto data = oxenc::bt_serialize(oxenc::bt_dict{ {"A", "N"sv}, {"H", std::string_view{(char*)NameHash.data(), NameHash.size()}}, {"T", TxID}}); diff --git a/llarp/dht/messages/gotname.cpp b/llarp/dht/messages/gotname.cpp index 47efe5854..2f1720938 100644 --- a/llarp/dht/messages/gotname.cpp +++ b/llarp/dht/messages/gotname.cpp @@ -1,5 +1,5 @@ #include "gotname.hpp" -#include +#include #include #include #include @@ -19,8 +19,8 @@ namespace llarp::dht GotNameMessage::BEncode(llarp_buffer_t* buf) const { const std::string nonce((const char*)result.nonce.data(), result.nonce.size()); - const auto data = oxenmq::bt_serialize( - oxenmq::bt_dict{{"A", "M"sv}, {"D", result.ciphertext}, {"N", nonce}, {"T", TxID}}); + const auto data = oxenc::bt_serialize( + oxenc::bt_dict{{"A", "M"sv}, {"D", result.ciphertext}, {"N", nonce}, {"T", TxID}}); return buf->write(data.begin(), data.end()); } diff --git a/llarp/dns/srv_data.cpp b/llarp/dns/srv_data.cpp index 883d9c68c..e46b90732 100644 --- a/llarp/dns/srv_data.cpp +++ b/llarp/dns/srv_data.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include "llarp/util/bencode.h" #include "llarp/util/types.hpp" @@ -106,7 +106,7 @@ namespace llarp::dns bool SRVData::BEncode(llarp_buffer_t* buf) const { - const std::string data = oxenmq::bt_serialize(toTuple()); + const std::string data = oxenc::bt_serialize(toTuple()); return buf->write(data.begin(), data.end()); } @@ -122,11 +122,11 @@ namespace llarp::dns try { SRVTuple tuple{}; - oxenmq::bt_deserialize(srvString, tuple); + oxenc::bt_deserialize(srvString, tuple); *this = fromTuple(std::move(tuple)); return IsValid(); } - catch (const oxenmq::bt_deserialize_invalid&) + catch (const oxenc::bt_deserialize_invalid&) { return false; }; diff --git a/llarp/endpoint_base.hpp b/llarp/endpoint_base.hpp index ce13786ac..e924ab523 100644 --- a/llarp/endpoint_base.hpp +++ b/llarp/endpoint_base.hpp @@ -14,7 +14,7 @@ #include #include #include -#include "oxenmq/variant.h" +#include "oxenc/variant.h" namespace llarp { diff --git a/llarp/ev/vpn.hpp b/llarp/ev/vpn.hpp index ede6b0acd..64da9f50d 100644 --- a/llarp/ev/vpn.hpp +++ b/llarp/ev/vpn.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include namespace llarp { diff --git a/llarp/handlers/tun.cpp b/llarp/handlers/tun.cpp index 4a4ad117f..afaf9b5c3 100644 --- a/llarp/handlers/tun.cpp +++ b/llarp/handlers/tun.cpp @@ -274,7 +274,7 @@ namespace llarp { std::string_view bdata{data.data(), data.size()}; LogDebug(Name(), " parsing address map data: ", bdata); - const auto parsed = oxenmq::bt_deserialize(bdata); + const auto parsed = oxenc::bt_deserialize(bdata); for (const auto& [key, value] : parsed) { huint128_t ip{}; @@ -1011,7 +1011,7 @@ namespace llarp addrmap[ip.ToString()] = a.ToString(); } } - const auto data = oxenmq::bt_serialize(addrmap); + const auto data = oxenc::bt_serialize(addrmap); maybe->write(data.data(), data.size()); } } diff --git a/llarp/iwp/session.cpp b/llarp/iwp/session.cpp index 6eefcfc71..a58de4065 100644 --- a/llarp/iwp/session.cpp +++ b/llarp/iwp/session.cpp @@ -768,7 +768,7 @@ namespace llarp pos += sizeof(rxid); auto p2 = pos + ShortHash::SIZE; assert(p2 == data.data() + XMITOverhead); - LogTrace("rxid=", rxid, " sz=", sz, " h=", oxenmq::to_hex(pos, p2), " from ", m_RemoteAddr); + LogTrace("rxid=", rxid, " sz=", sz, " h=", oxenc::to_hex(pos, p2), " from ", m_RemoteAddr); m_LastRX = m_Parent->Now(); { // check for replay diff --git a/llarp/lokinet_shared.cpp b/llarp/lokinet_shared.cpp index 9e9c57ff9..2075ba421 100644 --- a/llarp/lokinet_shared.cpp +++ b/llarp/lokinet_shared.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include #include @@ -823,7 +823,7 @@ extern "C" lokinet_hex_to_base32z(const char* hex) { std::string_view hexview{hex}; - if (not oxenmq::is_hex(hexview)) + if (not oxenc::is_hex(hexview)) return nullptr; const size_t byte_len = hexview.size() / 2; @@ -834,9 +834,9 @@ extern "C" // Write the bytes into the *end* of the buffer so that when we rewrite the final b32z chars // into the buffer we won't overwrite any byte values until after we've consumed them. char* bytepos = end - byte_len; - oxenmq::from_hex(hexview.begin(), hexview.end(), bytepos); + oxenc::from_hex(hexview.begin(), hexview.end(), bytepos); // In-place conversion into the buffer - oxenmq::to_base32z(bytepos, end, buf.get()); + oxenc::to_base32z(bytepos, end, buf.get()); return buf.release(); // leak the buffer to the caller } diff --git a/llarp/net/ip_range.cpp b/llarp/net/ip_range.cpp index 4b83e9d02..08d234584 100644 --- a/llarp/net/ip_range.cpp +++ b/llarp/net/ip_range.cpp @@ -1,6 +1,6 @@ #include "ip_range.hpp" -#include "oxenmq/bt_serialize.h" +#include "oxenc/bt_serialize.h" #include "llarp/util/bencode.h" @@ -9,7 +9,7 @@ namespace llarp bool IPRange::BEncode(llarp_buffer_t* buf) const { - const auto str = oxenmq::bt_serialize(ToString()); + const auto str = oxenc::bt_serialize(ToString()); return buf->write(str.begin(), str.end()); } @@ -24,7 +24,7 @@ namespace llarp std::string str; try { - oxenmq::bt_deserialize(data, str); + oxenc::bt_deserialize(data, str); } catch (std::exception&) { diff --git a/llarp/nodedb.cpp b/llarp/nodedb.cpp index 671ad2fc3..22feb80f3 100644 --- a/llarp/nodedb.cpp +++ b/llarp/nodedb.cpp @@ -93,7 +93,7 @@ namespace llarp fs::path NodeDB::GetPathForPubkey(RouterID pubkey) const { - std::string hexString = oxenmq::to_hex(pubkey.begin(), pubkey.end()); + std::string hexString = oxenc::to_hex(pubkey.begin(), pubkey.end()); std::string skiplistDir; const llarp::RouterID r{pubkey}; diff --git a/llarp/peerstats/types.cpp b/llarp/peerstats/types.cpp index e66918b57..89b0129cc 100644 --- a/llarp/peerstats/types.cpp +++ b/llarp/peerstats/types.cpp @@ -1,7 +1,7 @@ #include "types.hpp" #include -#include +#include #include namespace llarp @@ -103,7 +103,7 @@ namespace llarp { if (not buf) throw std::runtime_error("PeerStats: Can't use null buf"); - const oxenmq::bt_dict data = { + const oxenc::bt_dict data = { {NumConnectionAttemptsKey, numConnectionAttempts}, {NumConnectionSuccessesKey, numConnectionSuccesses}, {NumConnectionRejectionsKey, numConnectionRejections}, @@ -120,7 +120,7 @@ namespace llarp {LeastRCRemainingLifetimeKey, leastRCRemainingLifetime.count()}, {LastRCUpdatedKey, lastRCUpdated.count()}, }; - const auto serialized = oxenmq::bt_serialize(data); + const auto serialized = oxenc::bt_serialize(data); if (not buf->write(serialized.begin(), serialized.end())) throw std::runtime_error("PeerStats: buffer too small"); } diff --git a/llarp/quic/client.cpp b/llarp/quic/client.cpp index dd01e4dc0..a2a081edf 100644 --- a/llarp/quic/client.cpp +++ b/llarp/quic/client.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/llarp/quic/connection.cpp b/llarp/quic/connection.cpp index 778908385..fed88401e 100644 --- a/llarp/quic/connection.cpp +++ b/llarp/quic/connection.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include extern "C" { @@ -35,7 +35,7 @@ namespace llarp::quic std::ostream& operator<<(std::ostream& o, const ConnectionID& c) { - return o << oxenmq::to_hex(c.data, c.data + c.datalen); + return o << oxenc::to_hex(c.data, c.data + c.datalen); } ConnectionID @@ -297,7 +297,7 @@ namespace llarp::quic conn.endpoint.make_stateless_reset_token(cid, token); LogDebug( "make stateless reset token ", - oxenmq::to_hex(token, token + NGTCP2_STATELESS_RESET_TOKENLEN)); + oxenc::to_hex(token, token + NGTCP2_STATELESS_RESET_TOKENLEN)); return 0; } @@ -1093,7 +1093,7 @@ namespace llarp::quic uint16_t port; try { - oxenmq::bt_dict_consumer meta{lokinet_metadata}; + oxenc::bt_dict_consumer meta{lokinet_metadata}; // '#' contains the port the client wants us to forward to if (!meta.skip_until("#")) { @@ -1108,7 +1108,7 @@ namespace llarp::quic } LogDebug("decoded lokinet tunnel port = ", port); } - catch (const oxenmq::bt_deserialize_invalid& c) + catch (const oxenc::bt_deserialize_invalid& c) { LogWarn("transport params lokinet metadata is invalid: ", c.what()); return NGTCP2_ERR_TRANSPORT_PARAM; @@ -1191,7 +1191,7 @@ namespace llarp::quic // reserved field code that QUIC parsers must ignore); currently we only include the port in // here (from the client to tell the server what it's trying to reach, and reflected from // the server for the client to verify). - std::string lokinet_metadata = bt_serialize(oxenmq::bt_dict{ + std::string lokinet_metadata = bt_serialize(oxenc::bt_dict{ {"#", tunnel_port}, }); copy_and_advance(buf, lokinet_metadata_code); diff --git a/llarp/quic/endpoint.cpp b/llarp/quic/endpoint.cpp index d53ab4880..037011883 100644 --- a/llarp/quic/endpoint.cpp +++ b/llarp/quic/endpoint.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include extern "C" { diff --git a/llarp/quic/server.cpp b/llarp/quic/server.cpp index 369426699..690a97fac 100644 --- a/llarp/quic/server.cpp +++ b/llarp/quic/server.cpp @@ -2,8 +2,7 @@ #include #include -#include -#include +#include #include #include diff --git a/llarp/quic/stream.hpp b/llarp/quic/stream.hpp index 20caa51c3..176a2ab84 100644 --- a/llarp/quic/stream.hpp +++ b/llarp/quic/stream.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/llarp/quic/tunnel.cpp b/llarp/quic/tunnel.cpp index fa5e22029..6954e20f4 100644 --- a/llarp/quic/tunnel.cpp +++ b/llarp/quic/tunnel.cpp @@ -170,7 +170,7 @@ namespace llarp::quic { LogWarn( "Remote connection returned invalid initial byte (0x", - oxenmq::to_hex(bdata.begin(), bdata.begin() + 1), + oxenc::to_hex(bdata.begin(), bdata.begin() + 1), "); dropping connection"); stream.close(tunnel::ERROR_BAD_INIT); client.close(); diff --git a/llarp/router_contact.cpp b/llarp/router_contact.cpp index a4c7ff1a9..dabbeae85 100644 --- a/llarp/router_contact.cpp +++ b/llarp/router_contact.cpp @@ -10,7 +10,7 @@ #include "util/printer.hpp" #include "util/time.hpp" -#include +#include #include #include "util/fs.hpp" @@ -267,7 +267,7 @@ namespace llarp try { std::string_view buf_view(reinterpret_cast(buf->cur), buf->size_left()); - oxenmq::bt_list_consumer btlist(buf_view); + oxenc::bt_list_consumer btlist(buf_view); uint64_t outer_version = btlist.consume_integer(); @@ -301,7 +301,7 @@ namespace llarp } bool - RouterContact::DecodeVersion_1(oxenmq::bt_list_consumer& btlist) + RouterContact::DecodeVersion_1(oxenc::bt_list_consumer& btlist) { auto signature_string = btlist.consume_string_view(); signed_bt_dict = btlist.consume_dict_data(); diff --git a/llarp/router_contact.hpp b/llarp/router_contact.hpp index bb500dfba..ccac70d67 100644 --- a/llarp/router_contact.hpp +++ b/llarp/router_contact.hpp @@ -18,10 +18,10 @@ #define MAX_RC_SIZE (1024) #define NICKLEN (32) -namespace oxenmq +namespace oxenc { class bt_list_consumer; -} // namespace oxenmq +} // namespace oxenc namespace llarp { @@ -226,7 +226,7 @@ namespace llarp DecodeVersion_0(llarp_buffer_t* buf); bool - DecodeVersion_1(oxenmq::bt_list_consumer& btlist); + DecodeVersion_1(oxenc::bt_list_consumer& btlist); }; inline std::ostream& diff --git a/llarp/router_id.cpp b/llarp/router_id.cpp index c6e3b3e33..987525137 100644 --- a/llarp/router_id.cpp +++ b/llarp/router_id.cpp @@ -1,5 +1,5 @@ #include "router_id.hpp" -#include +#include namespace llarp { @@ -8,7 +8,7 @@ namespace llarp std::string RouterID::ToString() const { - std::string b32 = oxenmq::to_base32z(begin(), end()); + std::string b32 = oxenc::to_base32z(begin(), end()); b32 += SNODE_TLD; return b32; } @@ -17,7 +17,7 @@ namespace llarp RouterID::ShortString() const { // 5 bytes produces exactly 8 base32z characters: - return oxenmq::to_base32z(begin(), begin() + 5); + return oxenc::to_base32z(begin(), begin() + 5); } util::StatusObject @@ -38,9 +38,9 @@ namespace llarp // - must end in a 1-bit value: 'o' or 'y' (i.e. 10000 or 00000) // - must have 51 preceeding base32z chars // - thus we get 51*5+1 = 256 bits = 32 bytes of output - if (str.size() != 52 || !oxenmq::is_base32z(str) || !(str.back() == 'o' || str.back() == 'y')) + if (str.size() != 52 || !oxenc::is_base32z(str) || !(str.back() == 'o' || str.back() == 'y')) return false; - oxenmq::from_base32z(str.begin(), str.end(), begin()); + oxenc::from_base32z(str.begin(), str.end(), begin()); return true; } } // namespace llarp diff --git a/llarp/rpc/lokid_rpc_client.cpp b/llarp/rpc/lokid_rpc_client.cpp index ea7122e79..ae76e93c4 100644 --- a/llarp/rpc/lokid_rpc_client.cpp +++ b/llarp/rpc/lokid_rpc_client.cpp @@ -334,8 +334,8 @@ namespace llarp { service::EncryptedName result; const auto j = nlohmann::json::parse(data[1]); - result.ciphertext = oxenmq::from_hex(j["encrypted_value"].get()); - const auto nonce = oxenmq::from_hex(j["nonce"].get()); + result.ciphertext = oxenc::from_hex(j["encrypted_value"].get()); + const auto nonce = oxenc::from_hex(j["nonce"].get()); if (nonce.size() != result.nonce.size()) { throw std::invalid_argument(stringify( @@ -392,7 +392,7 @@ namespace llarp } std::vector routerIdStrings; - oxenmq::bt_deserialize(msg.data[0], routerIdStrings); + oxenc::bt_deserialize(msg.data[0], routerIdStrings); std::vector routerIds; routerIds.reserve(routerIdStrings.size()); diff --git a/llarp/service/address.cpp b/llarp/service/address.cpp index 7166f1ca6..940658c28 100644 --- a/llarp/service/address.cpp +++ b/llarp/service/address.cpp @@ -1,6 +1,6 @@ #include "address.hpp" #include -#include +#include #include namespace llarp::service @@ -26,7 +26,7 @@ namespace llarp::service str = subdomain; str += '.'; } - str += oxenmq::to_base32z(begin(), end()); + str += oxenc::to_base32z(begin(), end()); str += tld; return str; } @@ -56,10 +56,10 @@ namespace llarp::service // - must end in a 1-bit value: 'o' or 'y' (i.e. 10000 or 00000) // - must have 51 preceeding base32z chars // - thus we get 51*5+1 = 256 bits = 32 bytes of output - if (str.size() != 52 || !oxenmq::is_base32z(str) || !(str.back() == 'o' || str.back() == 'y')) + if (str.size() != 52 || !oxenc::is_base32z(str) || !(str.back() == 'o' || str.back() == 'y')) return false; - oxenmq::from_base32z(str.begin(), str.end(), begin()); + oxenc::from_base32z(str.begin(), str.end(), begin()); return true; } diff --git a/llarp/service/endpoint.hpp b/llarp/service/endpoint.hpp index 48308a525..e7364d1f3 100644 --- a/llarp/service/endpoint.hpp +++ b/llarp/service/endpoint.hpp @@ -20,14 +20,12 @@ #include #include #include -#include +#include #include "endpoint_types.hpp" #include "llarp/endpoint_base.hpp" #include "auth.hpp" -#include - #include // minimum time between introset shifts diff --git a/llarp/service/endpoint_state.hpp b/llarp/service/endpoint_state.hpp index 704cba110..c256acf88 100644 --- a/llarp/service/endpoint_state.hpp +++ b/llarp/service/endpoint_state.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include namespace llarp { diff --git a/llarp/service/intro_set.cpp b/llarp/service/intro_set.cpp index ca6e58414..e0deda9e4 100644 --- a/llarp/service/intro_set.cpp +++ b/llarp/service/intro_set.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include namespace llarp::service { @@ -235,9 +235,9 @@ namespace llarp::service try { - oxenmq::bt_deserialize(srvString, SRVs); + oxenc::bt_deserialize(srvString, SRVs); } - catch (const oxenmq::bt_deserialize_invalid& err) + catch (const oxenc::bt_deserialize_invalid& err) { LogError("Error decoding SRV records from IntroSet: ", err.what()); return false; @@ -321,7 +321,7 @@ namespace llarp::service // srv records if (not SRVs.empty()) { - std::string serial = oxenmq::bt_serialize(SRVs); + std::string serial = oxenc::bt_serialize(SRVs); if (!bencode_write_bytestring(buf, "s", 1)) return false; if (!buf->write(serial.begin(), serial.end())) diff --git a/llarp/service/lns_tracker.hpp b/llarp/service/lns_tracker.hpp index 9aa65904f..aba31c509 100644 --- a/llarp/service/lns_tracker.hpp +++ b/llarp/service/lns_tracker.hpp @@ -8,7 +8,7 @@ #include "address.hpp" #include -#include +#include namespace llarp::service { diff --git a/llarp/util/aligned.hpp b/llarp/util/aligned.hpp index d588d154a..713220614 100644 --- a/llarp/util/aligned.hpp +++ b/llarp/util/aligned.hpp @@ -5,7 +5,7 @@ #include #include "printer.hpp" -#include +#include #include #include @@ -72,7 +72,7 @@ namespace llarp friend std::ostream& operator<<(std::ostream& out, const AlignedBuffer& self) { - return out << oxenmq::to_hex(self.begin(), self.end()); + return out << oxenc::to_hex(self.begin(), self.end()); } /// bitwise NOT @@ -270,21 +270,21 @@ namespace llarp std::string ToHex() const { - return oxenmq::to_hex(begin(), end()); + return oxenc::to_hex(begin(), end()); } std::string ShortHex() const { - return oxenmq::to_hex(begin(), begin() + 4); + return oxenc::to_hex(begin(), begin() + 4); } bool FromHex(std::string_view str) { - if (str.size() != 2 * size() || !oxenmq::is_hex(str)) + if (str.size() != 2 * size() || !oxenc::is_hex(str)) return false; - oxenmq::from_hex(str.begin(), str.end(), begin()); + oxenc::from_hex(str.begin(), str.end(), begin()); return true; } diff --git a/llarp/vpn/linux.hpp b/llarp/vpn/linux.hpp index b682ae15b..9f9ffbe0f 100644 --- a/llarp/vpn/linux.hpp +++ b/llarp/vpn/linux.hpp @@ -416,10 +416,10 @@ namespace llarp::vpn if (parts[1].find_first_not_of('0') == std::string::npos and parts[0] != ifname) { const auto& ip = parts[2]; - if ((ip.size() == sizeof(uint32_t) * 2) and oxenmq::is_hex(ip)) + if ((ip.size() == sizeof(uint32_t) * 2) and oxenc::is_hex(ip)) { huint32_t x{}; - oxenmq::from_hex(ip.begin(), ip.end(), reinterpret_cast(&x.h)); + oxenc::from_hex(ip.begin(), ip.end(), reinterpret_cast(&x.h)); gateways.emplace_back(x); } } diff --git a/pybind/llarp/router_id.cpp b/pybind/llarp/router_id.cpp index 2612c531f..1cb2c56b7 100644 --- a/pybind/llarp/router_id.cpp +++ b/pybind/llarp/router_id.cpp @@ -11,9 +11,9 @@ namespace llarp .def( "FromHex", [](RouterID* r, const std::string& hex) { - if (hex.size() != 2 * r->size() || !oxenmq::is_hex(hex)) + if (hex.size() != 2 * r->size() || !oxenc::is_hex(hex)) throw std::runtime_error("FromHex requires a 64-digit hex string"); - oxenmq::from_hex(hex.begin(), hex.end(), r->data()); + oxenc::from_hex(hex.begin(), hex.end(), r->data()); }) .def("__repr__", &RouterID::ToString) .def("__str__", &RouterID::ToString)