Expand description
Code implementing version 1 proof-of-work for onion service hosts.
Spec links:
StructsΒ§
- PowManager
Generic π - This is responsible for rotating Proof-of-Work seeds and doing verification of PoW solves.
- PowManager
State πRecord - On-disk record of
PowManagerGeneric
state. - Rend
Request πOrdBy Effort - Wrapper around
RendRequest
that implementsstd::cmp::Ord
to sort by [Effort
] and time. - Rend
Request πReceiver - Implements
Stream
for incomingRendRequest
s, using a priority queue system to dequeue high-[Effort
] requests first. - Rend
Request πReceiver Inner - Inner implementation for
RendRequestReceiver
. - Seeds
ForTime πPeriod - Information about the current and previous [
Seed
] for a givenTimePeriod
. - State π
- Internal state for
PowManagerGeneric
.
EnumsΒ§
- PowError
- Error within the PoW subsystem.
- PowSolve
Error π - A PoW solve was invalid.
ConstantsΒ§
- EXPIRATION_
TIME_ πMINS_ MAX - Maximum seed expiration time in minutes. See: https://spec.torproject.org/hspow-spec/v1-equix.html#parameter-descriptor
- EXPIRATION_
TIME_ πMINS_ MIN - Minimum seed expiration time in minutes. See: https://spec.torproject.org/hspow-spec/v1-equix.html#parameter-descriptor
- HS_
UPDATE_ πPERIOD - How frequently the suggested effort should be recalculated.
- PUBLISHER_
UPDATE_ πQUEUE_ DEPTH - Depth of the queue used to signal the publisher that it needs to update a given time period.
- SEED_
EARLY_ πROTATION_ TIME - How soon before a seedβs expiration time we should rotate it and publish a new seed.
- SUGGESTED_
EFFORT_ πDEADZONE - When the suggested effort has changed by less than this much, we donβt republish it.
TraitsΒ§
- Mockable
PowManager π - Trait to allow mocking PowManagerGeneric in tests.
- Mockable
Rend πRequest - Trait to allow mocking RendRequest in tests.
Type AliasesΒ§
- PowManager π
- Proof-of-Work manager type alias for production, using concrete
RendRequest
.