mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
Crit logging
- TODO: discuss authentication for nodes connecting to bootstrap seed - crit log num connected/RC's, conn open/closed, etc
This commit is contained in:
parent
950ebfe2df
commit
4b426f52e9
@ -172,15 +172,25 @@ namespace llarp
|
||||
tls_creds->set_key_verify_callback([this](const ustring_view& key, const ustring_view&) {
|
||||
bool result = false;
|
||||
RouterID other{key.data()};
|
||||
|
||||
if (auto itr = rids_pending_verification.find(other); itr != rids_pending_verification.end())
|
||||
{
|
||||
rids_pending_verification.erase(itr);
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (_router.node_db()->has_rc(other))
|
||||
result = true;
|
||||
|
||||
log::critical(logcat, "{}uccessfully verified connection to {}!", result ? "S" : "Un", other);
|
||||
// TODO: discuss pubkey verification for bootstraps connecting to seed node
|
||||
if (_router.is_bootstrap_seed())
|
||||
{
|
||||
log::warning(logcat, "Allowing connection -- we are bootstrap seed");
|
||||
result = true;
|
||||
}
|
||||
|
||||
log::critical(
|
||||
logcat, "{}uccessfully verified connection to {}!", result ? "S" : "Uns", other);
|
||||
return result;
|
||||
});
|
||||
if (_router.is_service_node())
|
||||
@ -405,7 +415,7 @@ namespace llarp
|
||||
_router.loop()->call([this, &conn_interface = ci, error_code = ec]() {
|
||||
const auto& scid = conn_interface.scid();
|
||||
|
||||
log::debug(quic_cat, "Purging quic connection CID:{} (ec: {})", scid, error_code);
|
||||
log::critical(quic_cat, "Purging quic connection CID:{} (ec: {})", scid, error_code);
|
||||
|
||||
if (const auto& c_itr = ep.connid_map.find(scid); c_itr != ep.connid_map.end())
|
||||
{
|
||||
@ -423,7 +433,7 @@ namespace llarp
|
||||
|
||||
ep.connid_map.erase(c_itr);
|
||||
|
||||
log::debug(quic_cat, "Quic connection CID:{} purged successfully", scid);
|
||||
log::critical(quic_cat, "Quic connection CID:{} purged successfully", scid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -414,6 +414,8 @@ namespace llarp
|
||||
connid_map.emplace(conn_interface->scid(), rc.router_id());
|
||||
auto [itr, b] = conns.emplace(rc.router_id(), nullptr);
|
||||
|
||||
log::critical(logcat, "Establishing connection to {}...", rc.router_id());
|
||||
|
||||
auto control_stream = conn_interface->template get_new_stream<oxen::quic::BTRequestStream>(
|
||||
[](oxen::quic::Stream& s, uint64_t error_code) {
|
||||
log::warning(
|
||||
@ -422,6 +424,7 @@ namespace llarp
|
||||
error_code);
|
||||
s.conn.close_connection(error_code);
|
||||
});
|
||||
|
||||
itr->second = std::make_shared<link::Connection>(conn_interface, control_stream, rc);
|
||||
|
||||
return true;
|
||||
|
@ -666,7 +666,12 @@ namespace llarp
|
||||
|
||||
clear_bad_rcs();
|
||||
|
||||
if (_bootstrap_rc_list->empty() and not conf.bootstrap.seednode)
|
||||
_bootstrap_seed = conf.bootstrap.seednode;
|
||||
|
||||
if (_bootstrap_seed)
|
||||
log::critical(logcat, "We are a bootstrap seed node!");
|
||||
|
||||
if (_bootstrap_rc_list->empty() and not _bootstrap_seed)
|
||||
{
|
||||
log::warning(logcat, "Warning: bootstrap list is empty and we are not a seed node");
|
||||
|
||||
@ -698,9 +703,6 @@ namespace llarp
|
||||
|
||||
node_db()->set_bootstrap_routers(std::move(_bootstrap_rc_list));
|
||||
|
||||
if (conf.bootstrap.seednode)
|
||||
log::critical(logcat, "We are a bootstrap seed node!");
|
||||
|
||||
// TODO: RC refactor here
|
||||
if (_is_service_node)
|
||||
init_inbounds();
|
||||
@ -765,7 +767,8 @@ namespace llarp
|
||||
Router::report_stats()
|
||||
{
|
||||
const auto now = llarp::time_now_ms();
|
||||
log::info(
|
||||
|
||||
log::critical(
|
||||
logcat,
|
||||
"{} RCs loaded with {} bootstrap peers and {} router connections!",
|
||||
_node_db->num_rcs(),
|
||||
@ -774,15 +777,17 @@ namespace llarp
|
||||
|
||||
if (is_service_node())
|
||||
{
|
||||
log::info(
|
||||
log::critical(
|
||||
logcat,
|
||||
"Local service node has {} client connections since last RC update ({} to expiry)",
|
||||
num_client_connections(),
|
||||
router_contact.age(now),
|
||||
router_contact.time_to_expiry(now));
|
||||
}
|
||||
|
||||
if (_last_stats_report > 0s)
|
||||
log::info(logcat, "Last reported stats time {}", now - _last_stats_report);
|
||||
|
||||
_last_stats_report = now;
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,7 @@ namespace llarp
|
||||
|
||||
bool _testnet = false;
|
||||
bool _testing_disabled = false;
|
||||
bool _bootstrap_seed = false;
|
||||
|
||||
consensus::reachability_testing router_testing;
|
||||
|
||||
@ -157,6 +158,12 @@ namespace llarp
|
||||
std::chrono::system_clock::time_point next_bootstrap_attempt{last_rc_gossip};
|
||||
|
||||
public:
|
||||
bool
|
||||
is_bootstrap_seed() const
|
||||
{
|
||||
return _bootstrap_seed;
|
||||
}
|
||||
|
||||
int
|
||||
required_num_client_conns() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user