Huge refactor to support man-in-the-middle

- All packets can now be read from and written to streams
- Refactored packet structure
- Some additional work still needed to accept client connections