torproject / nyx

Command-line monitor for Tor.
https://nyx.torproject.org/
GNU General Public License v3.0
113 stars 27 forks source link

Add hostnames and geoip to connection panel #3

Open atagar opened 4 years ago

atagar commented 4 years ago

Migrated from ticket 18547.

Many releases ago Nyx ​showed hostnames on the connection panel, but dropped this because it leaked our connections to our DNS provider. We can still get this information, but it must be on every relay or none at all.

Turns out Onionoo already supports exactly what we want! In particular here's the query we want.

Note that ​Onionoo supports gzip compression and we want to take advantage since it drops the size of our replies from 1.5 MB to 432.6 KB.

For this we want a new Daemon subclass in tracker.py. This class would have a single relay_details(fingerprint) method that returns a struct with these attributes. If we meet the following two constraints then it calls Onionoo to update our cache...

  1. We make a request for a fingerprint the cache doesn't have.
  2. It's been over an hour since the relays_published date in our last reply (like the consensus Onionoo updates hourly, so no point in requesting more frequently).

Note that we might not want all of these geoip fields (we'll need to fiddle with the panel to see what is nice to have).