tor-proto: add PaddingState channel padding logic
This implements a set of completely isolated logic to figure out what
the channel padding state should be, based on some input variables
(PaddingVariables
) and a boolean indicating whether the channel's
usage would imply padding should be used.
The fact that the logic is essentially a pure function from padding variables to padding behaviour makes it very easy to unit-test, as well as embed inside the channel reactor to make padding decisions.
This duplicates the functionality implemented in !657 (merged), as part of a gradual effort to refactor it.
cc @Diziet