Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. ## Existing Tor Guard Selection Algorithm
  2.  
  3. - ALL_GUARD_LIST = guard information from latest consensus
  4. - GUARD_LIST = guards persisted to our state file
  5. - DIRECTORY_GUARD = if we select guards with the V2Dir flag. Guards with the V2Dir Flag can be used as entry guards for both fetching information from directories as well as for standard entry guards.
  6.  
  7. ### ON_BOOTSTRAP (no existing guards)
  8. 1. RECEIVE_NEW_CONSENSUS
  9. 2. From listed guards in ALL_GUARD_LIST with DIRECTORY_GUARD=true:
  10. 1. 3 times do (default guard value on startup):
  11. 1. ADD_RANDOM_ENTRYGUARD to choose a guard
  12. 2. Add this new guard to GUARD_LIST
  13.  
  14. ### RECEIVE_NEW_CONSENSUS
  15. 1. Mark guards that are not listed in the latest consensus as "bad" in ALL_GUARD_LIST
  16. 2. Remove guards that have been dead for 30 days from GUARD_LIST and ALL_GUARD_LIST
  17. 3. Remove guards that were added more than 30 days ago from GUARD_LIST and ALL_GUARD_LIST
  18.  
  19. ### BUILD_NEW_CIRCUIT
  20. 1. First, CHOOSE_A_GUARD
  21. 2. Then CONNECT_ENTRY_GUARD with our chosen guard
  22.  
  23. ### CHOOSE_A_GUARD
  24. 1. Ensure that we have enough entry guards (only need 1)
  25. 1. If we do not:
  26. 1. Use the ADD_RANDOM_ENTRYGUARD algorithm to choose a new guard, DIRECTORY_GUARD=false
  27. 2. Add new guard to GUARD_LIST
  28. 2. From GUARD_LIST of entry guards:
  29. 1. Select only the live guards that are:
  30. 1. listed, except:
  31. 1. offline and previously tried
  32. 2. From this list of live guards
  33. 1. Choose one at random if the list contains:
  34. 1. Guards that we have not tried, or
  35. 2. Or the list contains at least the number that we needed (which is 1)
  36. 3. Otherwise (if the list of live guards contains only 1):
  37. 1. Relax our constraints (bandwidth, uptime, for directory, etc), and
  38. 2. Use the ADD_RANDOM_ENTRYGUARD algorithm to choose a new guard
  39. 3. Try to choose a new guard, starting over from b.
  40.  
  41.  
  42. ### ADD_RANDOM_ENTRYGUARD
  43. 1. Build weighted distribution of all guards based on bandwidth
  44. 2. Pick a guard at random from this distribution
  45.  
  46. ### CONNECT_ENTRY_GUARD
  47. 1. If we have never made contact with this guard before:
  48. 1. If we can connect:
  49. 1. Mark guard as we have made contact
  50. 2. Assume the network was down, and mark all guards in GUARD_LIST for retry (except the guard that we just connected)
  51. 2. If we cannot connect:
  52. 1. Remove it from GUARD_LIST
  53. 2. If we have made contact with this guard before:
  54. 1. If we cannot connect:
  55. 1. Mark this guard as offline
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement