libquic bump

pull/2232/head
dr7ana 11 months ago
parent 472fcc7d1a
commit d35073cc58

@ -1 +1 @@
Subproject commit 6ee6ed398d00043d862466a56279b5c502513bff Subproject commit 3ced484e8cc543b90c5fc554ccc0ea2e54ec8d37

@ -961,9 +961,8 @@ namespace llarp
maybe = oxen::quic::Address{std::string{h}, p}; maybe = oxen::quic::Address{std::string{h}, p};
// TODO: unfuck llarp/net if (maybe->is_loopback())
// if (net_ptr->IsLoopbackAddress(addr->port())) throw std::invalid_argument{fmt::format("{} is a loopback address", arg)};
// throw std::invalid_argument{fmt::format("{} is a loopback address", arg)};
} }
if (not maybe) if (not maybe)
{ {
@ -1103,34 +1102,40 @@ namespace llarp
}); });
conf.add_undeclared_handler( conf.add_undeclared_handler(
"bind", [this, net_ptr](std::string_view, std::string_view key, std::string_view val) { "bind", [this](std::string_view, std::string_view key, std::string_view val) {
if (using_new_api) if (using_new_api)
throw std::runtime_error{"USE THE NEW API -- SPECIFY LOCAL ADDRESS UNDER [LISTEN]"}; throw std::runtime_error{"USE THE NEW API -- SPECIFY LOCAL ADDRESS UNDER [LISTEN]"};
log::warning( log::warning(logcat, "Please update your config to use [bind]:listen instead");
logcat, "Using the [bind] section is beyond deprecated; use [listen] instead");
uint16_t port{0};
if (auto rv = llarp::parse_int<uint16_t>(val, port); not rv)
throw std::runtime_error{"Could not parse port; stop using this deprecated handler"};
port = port == 0 ? DEFAULT_LISTEN_PORT : port;
// special case: wildcard for outbound // special case: wildcard for outbound
if (key == "*") if (key == "*")
{ {
uint16_t port{0}; addr = oxen::quic::Address{port};
if (auto rv = llarp::parse_int<uint16_t>(val, port); not rv)
log::warning(
logcat, "Could not parse port; stop using this deprecated handler you nonce");
addr = oxen::quic::Address{"", port}; // TODO: drop the "" after bumping libquic
return; return;
} }
oxen::quic::Address temp; oxen::quic::Address temp;
// try as interface name first
auto saddr = net_ptr->GetInterfaceAddr(key, AF_INET);
if (saddr and net_ptr->IsLoopbackAddress(saddr->getIP()))
throw std::invalid_argument{fmt::format("{} is a loopback interface", key)};
temp = oxen::quic::Address{saddr->in()}; try
{
temp = oxen::quic::Address{std::string{key}, port};
}
catch (const std::exception& e)
{
throw std::runtime_error{fmt::format(
"Could not parse address {}; please update your config to use [bind]:listen "
"instead: {}",
key,
e.what())};
}
if (temp.is_addressable()) if (temp.is_addressable())
{ {
@ -1138,10 +1143,10 @@ namespace llarp
return; return;
} }
log::warning( throw std::runtime_error{fmt::format(
logcat, "Invalid address: {}; stop using this deprecated handler, update your config to use "
"Could not parse address values; stop using this deprecated handler you nonce"); "[bind]:listen instead PLEASE",
addr = oxen::quic::Address{""s, DEFAULT_LISTEN_PORT}; temp)};
}); });
} }

@ -314,7 +314,9 @@ namespace llarp
// TODO: confirm remote end is using the expected pubkey (RouterID). // TODO: confirm remote end is using the expected pubkey (RouterID).
// TODO: ALPN for "client" vs "relay" (could just be set on endpoint creation) // TODO: ALPN for "client" vs "relay" (could just be set on endpoint creation)
if (auto rv = ep.establish_connection(remote_addr, rc); rv) if (auto rv = ep.establish_connection(
oxen::quic::RemoteAddress{rc.router_id().ToView(), remote_addr}, rc);
rv)
{ {
log::info(quic_cat, "Connection to {} successfully established!", remote_addr); log::info(quic_cat, "Connection to {} successfully established!", remote_addr);
return; return;

@ -71,7 +71,8 @@ namespace llarp
template <typename... Opt> template <typename... Opt>
bool bool
establish_connection(const oxen::quic::Address& remote, const RemoteRC& rc, Opt&&... opts); establish_connection(
const oxen::quic::RemoteAddress& remote, const RemoteRC& rc, Opt&&... opts);
void void
for_each_connection(std::function<void(link::Connection&)> func); for_each_connection(std::function<void(link::Connection&)> func);
@ -364,7 +365,7 @@ namespace llarp
template <typename... Opt> template <typename... Opt>
bool bool
Endpoint::establish_connection( Endpoint::establish_connection(
const oxen::quic::Address& remote, const RemoteRC& rc, Opt&&... opts) const oxen::quic::RemoteAddress& remote, const RemoteRC& rc, Opt&&... opts)
{ {
try try
{ {

@ -12,32 +12,6 @@
namespace llarp namespace llarp
{ {
// RouterContact::RouterContact(std::string buf)
// {
// try
// {
// oxenc::bt_list_consumer btlc{buf};
// // signature.from_string(btlc.consume_string());
// signed_bt_dict = btlc.consume_string();
// // TODO: parse bt dict
// }
// catch (...)
// {
// log::warning(llarp_cat, "Error: RouterContact failed to populate bt encoded contents!");
// }
// }
// std::string
// RouterContact::bt_encode() const
// {
// oxenc::bt_dict_producer btdp;
// bt_encode(btdp);
// return std::move(btdp).str();
// }
void void
RouterContact::bt_load(oxenc::bt_dict_consumer& data) RouterContact::bt_load(oxenc::bt_dict_consumer& data)
{ {

@ -244,7 +244,7 @@ namespace llarp
void void
clear() override clear() override
{ {
_addr = {}; _addr = oxen::quic::Address{};
_addr6.reset(); _addr6.reset();
_router_id.Zero(); _router_id.Zero();
_timestamp = {}; _timestamp = {};
@ -338,7 +338,7 @@ namespace llarp
void void
clear() override clear() override
{ {
_addr = {}; _addr = oxen::quic::Address{};
_addr6.reset(); _addr6.reset();
_router_id.Zero(); _router_id.Zero();
_timestamp = {}; _timestamp = {};

Loading…
Cancel
Save