Changes between Initial Version and Version 1 of Ticket #12595, comment 10


Ignore:
Timestamp:
Aug 4, 2014, 12:35:51 PM (5 years ago)
Author:
asn
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12595, comment 10

    initial v1  
    1010
    1111I found it helpful to think of this as an OOP system. I thought of a
    12 class called 'Guard' and a class called 'GuardList':
     12class called `Guard` and a class called `GuardList`:
    1313
    14 A 'Guard' is basically a Tor node plus some metadata about it. Using
     14A `Guard` is basically a Tor node plus some metadata about it. Using
    1515the metadata you can answer questions like "is it fast?", "is it
    1616dir?", "was it unreachable?", "should we retry?", "is it too old?".
    1717
    18 A 'GuardList' contains many 'Guard' objects and knows how to select
     18A `GuardList` contains many `Guard` objects and knows how to select
    1919between them. It basically acts as a conveyor belt for them.
    2020
    2121The main interface to the guard subsystem that Tor needs to use are
    2222the functions that return entry guards and directory guards. In the
    23 current codebase, this is choose_random_entry_impl().
     23current codebase, this is `choose_random_entry_impl()`.
    2424
    25 We can imagine this function as a method of the GuardList that does
     25We can imagine this function as a method of the `GuardList` that does
    2626something similar to what was described in comment:9: it takes as
    2727input some restrictions (the type of the circuit, the exit node
     
    3232
    3333Some more methods of the guard list could be:
    34 - load_guards(), which loads guards from the torrc and state file.
    35 - save_guards(), which saves guards to the state file.
    36 - refresh(), which kills old/bad guards based on a newly arrived
    37              consensus (see entry_guards_compute_status())
    38 - network_is_back_up(), which is the "network up" trigger (see comment:5)
    39 - stuff like add_guard(), remove_guard(), get_num_guards(), etc.
     34- `load_guards()`, which loads guards from the torrc and state file.
     35- `save_guards()`, which saves guards to the state file.
     36- `refresh()`, which kills old/bad guards based on a newly arrived
     37             consensus (see `entry_guards_compute_status()`)
     38- `network_is_back_up()`, which is the "network up" trigger (see comment:5)
     39- stuff like `add_guard()`, `remove_guard()`, `get_num_guards()`, etc.
    4040
    4141Continuing with comment:9, the main methods of the Guard class would