OOM DoS resistence measures from C tor
As part of our work on onion services in arti, we should provide some or all of the same OOM DoS mechanisms as used in C tor.
Subtasks:
- Memory DoS:
- Track memory consumption for each stream and circuit.
- Track total memory consumption for all streams and circuits.
- Track age of data on streams and circuits.
- Configure and/or guess a memory limit.
- Code to notice when we're low on memory and kill streams and circuits.
References:
- dos-spec.md
- tor-spec section 8.1
- The "sniper attack" paper by Jansen, Tschorsch, Johnson, and Scheuermann.
Edited by Nick Mathewson