nskinkel/oppy — pull request #76 by nskinkel (2014-12-04 00:58:18+00:00)
Title: Circuit control processing

This branch implements/upgrades the following functionality:

- Rudimentary circuit-level and stream-level flow control/link throttling. Note that not all cases are handled completely correctly, but I tried to make a sane default choice if handling it according to the spec was too complex to do right now. This includes buffering code that *really* needs further testing.
- Implement relaytruncatedcell, relaydropcell, and relaysendmecell.
- More intelligently tear down circuits and streams (i.e. send a DESTROY and RELAY_END cell when appropriate).
- Make circuit destroy itself if it gets a protocol-violating cell, log and drop all other weird/unexpected ones.
- Make all default circuits able to handle IPv6.
- Add decryptUntilRecognized() to handle relay cells from different hops
- Add encryptToTarget() to handle sending relay control cells to different hops
- Make connection unpack only "connection-level" cells and leave the rest of the work to the destination circuit.
- Fix a minor bug in netstatus where the cache file is occasionally overwritten.
- Minor crypto cleanup and removal of some timing attacks.

This branch closes #73, #72, #70, #69, #68, #66, #64, #63, and #52.

(Note: some of this code is kind of messy and not pretty to look at. It fixes a bunch of open issues and adds the ability to do things "correctly"...but it's not always pretty. This should be cleaned up later.)