Create a status model for a Tor network node
In onionoo we have status documents of a Tor node that together give us a snapshot of the network.
These documents are accessible in json format. The information contained in a document describe the state of that node at the time the document was published:
| nickname | "seele" |
|------------------------------|--------------------------------------------|
| fingerprint | "000A10D43011EA4928A35F610405F92B4433B4DC" |
| or_addresses | […] |
| last_seen | "2022-09-27 12:00:00" |
| last_changed_address_or_port | "2022-01-04 00:00:00" |
| first_seen | "2014-08-23 06:00:00" |
| running | true |
| flags | […] |
| country | "us" |
| country_name | "United States of America" |
| as | "AS7018" |
| as_name | "ATT-INTERNET4" |
| consensus_weight | 350 |
| verified_host_names | […] |
| last_restarted | "2022-09-07 07:46:09" |
| bandwidth_rate | 1048576 |
| bandwidth_burst | 2097152 |
| observed_bandwidth | 1099572 |
| advertised_bandwidth | 1048576 |
| exit_policy | […] |
| exit_policy_summary | {…} |
| contact | "Nicolas Noble <pixel@nobis-crew.org>" |
| platform | "Tor 0.4.7.10 on Linux" |
| version | "0.4.7.10" |
| version_status | "recommended" |
| effective_family | […] |
| consensus_weight_fraction | 0.0000029817709 |
| guard_probability | 0 |
| middle_probability | 0.000008380878 |
| exit_probability | 0 |
| recommended_version | true |
| measured | true |
We need a way to have the same status document in our database.
An interesting mechanism of timescale would be the continuous aggregate feature. This is basically a materialized view that the DB itself takes care of updating on a chosen time interval.
This would recreate the status document that we are now using in onionoo.
We might want to think how we want to have snapshot of these status document too. A possible mechanism could be to create a status history table where we copy over the data from the status table and we pick as primary key the vector (digest, fingerprint, nickname, timestamp).