torproject / stem

Python controller library for Tor
https://stem.torproject.org/
GNU Lesser General Public License v3.0
257 stars 75 forks source link

Add Descriptor validate() method #90

Open atagar opened 3 years ago

atagar commented 3 years ago

Our Descriptor class' construction and validation are coupled together, which complicates validation of individual descriptors (rather than whole files) as discussed on BridgeDB ticket 40006.

Stem evolved this way for performance. When read without validation we can lazily load content (parsing attributes on demand), whereas validation requires us to process the whole document up front.

We should move checks into a validate() method so all descriptors can be checked regardless of how they were constructed.