Module hsdir_ring

Source
Available on crate feature hs-common only.
Expand description

Functions and type for implementing the onion service directory ring.

The onion service directory ring is an ordered ring of the all of relays in the consensus with the HsDir flag. The HSDirs change their position in this index every [TimePeriod], and every time that the shared random value in the consensus changes. (These events are typically synchronized, for reasonable network configurations.)

Each onion service is also (semi-privately) associated with “N” positions on the ring based on its blinded ID and the current time period. When upload or downloading an onion service descriptor descriptor, we look at the ring at each of these positions, and consider the “S” relays that fall at that position or later. (“N” is a “number of replicas” parameter, and “S” is a “Spread” parameter.)

Structs§

HsDirIndex 🔒
A sort key determining a position in the onion service directory ring.
HsDirPos 🔒
Position in the hsdir hash ring
HsDirRing 🔒
A hash ring as used in NetDir.

Functions§

relay_hsdir_index 🔒
Compute the HsDirIndex for a given relay.
service_hsdir_index 🔒
Compute the starting HsDirIndex for a given descriptor replica.