Skip to content
Snippets Groups Projects

Expose and collect bootstrap status information from tor-chanmgr and tor-dirmgr

Merged Nick Mathewson requested to merge nickm/arti:bootstrap_reporting into main
3 unresolved threads

This branch adds functionality, based on postage::watch, to export bootstrap status information from tor-dirmgr and tor-chanmgr. I expect that the content of the information will change in the future, so I've made the interfaces somewhat opaque.

Implements a first cut of #96 (closed), though we will need to refine it in the future.

Some of the information that we collect in this branch is more than strictly needed for the bootstrap data that we expose right now. I hope this isn't confusing: I think that in the future we'll probably move to collect less, or use the data that we collect in a more sophisticated way, or some of each.

I've done a trick in tor-chanmgr to avoid creating events too frequently, since otherwise it would lead to many spurious changes. If we decide to make that change elsewhere too, I think we can safely do so in a later commit.

As it stands, this branch isn't completely useful on its own, since there is no way currently to get an un-bootstrapped TorClient. It will require #293 (closed) for that. (@eta, please let me know if the changes this makes to TorClient will conflict with your plans there.)

NOTE: Please see the individual commit messages for more information about design rationale, tradeoffs, and future work.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
113 114 /// How should we get the consensus from the cache, if at all?
114 115 cache_usage: CacheUsage,
115 116
117 /// If present, a time that we want our consensus to have been published.
  • Contributor
    Suggested change
    117 /// If present, a time that we want our consensus to have been published.
    117 /// If present, a time after which we want our consensus to have been published.
  • Please register or sign in to reply
  • eta
    eta @eta started a thread on commit c162e57e
  • 36 /// Return true if this status is equal to `other`.
    37 ///
    38 /// Note:(This would just be a PartialEq implementation, but I'm not sure I
    39 /// want to expose that PartialEq for this struct.)
    40 fn eq(&self, other: &ConnStatus) -> bool {
    41 self.online == other.online && self.tls_works == other.tls_works
    42 }
    43
    44 /// Return true if this status indicates that we can successfully open Tor channels.
    45 pub fn usable(&self) -> bool {
    46 self.online == Some(true) && self.tls_works == Some(true)
    47 }
    48
    49 /// Return a float representing "how bootstrapped" we are with respect to
    50 /// connecting to the Tor network, where 0 is "not at all" and 1 is
    51 /// "successful".
    • Comment on lines +49 to +51
      Contributor

      should this doc comment also have the "the fractions are not stable" warning?

    • Please register or sign in to reply
  • eta
    eta @eta started a thread on commit c162e57e
  • 1 //! Code for exporting events from the channel manager.
    2 #![allow(dead_code, unreachable_pub)]
    3
    4 use futures::{Stream, StreamExt};
    5 use postage::watch;
    6 use std::{
    7 fmt,
    8 time::{Duration, Instant},
    9 };
    10
    11 /// The status of our connection to the internet.
    12 #[derive(Default, Debug, Clone)]
    13 pub struct ConnStatus {
    14 /// True if we've been able to make outgoing connections recently.
    15 /// False if we've definitely been failing.
  • Contributor

    Looks good (was a fair deal to read through!). My only comments are about documentation; the overall structure here seems really solid. Feel free to merge once you've fixed the minor doc tweaks!

  • eta approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading