This commit is contained in:
sha512sum 2024-11-15 13:16:40 +00:00
parent bcef65a0e2
commit bfcd0faef6

View file

@ -134,6 +134,11 @@ auto SendHeader(auto& sock, larra::xmpp::ServerStream stream) -> boost::cobalt::
co_await boost::asio::async_write(sock, boost::asio::buffer(data), boost::cobalt::use_op);
}
constexpr auto GetAddress(std::string_view addr) {
auto pos = addr.find(".xmpp");
return pos != std::string_view::npos ? addr.substr(pos + 1) : addr;
};
// NOLINTNEXTLINE
auto Process(auto socket, auto transform, const Options& options) -> boost::cobalt::detached {
try {
@ -141,7 +146,7 @@ auto Process(auto socket, auto transform, const Options& options) -> boost::coba
larra::xmpp::ServerStream header =
(co_await Cobaltify(stream.ReadOne()), co_await Cobaltify(stream.template ReadOne<larra::xmpp::ServerStream>()));
std::string_view address = header.to.value();
std::string_view address = GetAddress(header.to.value());
auto domain = Domain::Parse(address);
spdlog::debug("Got domain address {}. Tld: {}", address, domain.tld);
for(const auto& [tld, proxy] : options.data) {