implement stream isolation
should fix #73 (closed)
Use IsolationToken (glorified u64) to allow flexible isolation of unrelated streams from the API.
Also implement isolation in Arti (as in SocksProxy to Tor). The rules used are not configurable (yet), but similar to default rules for Tor (isolate by client addr, by listening port and by authentication if any)
Merge request reports
Activity
requested review from @nickm
294 295 } 295 296 } 296 297 298 /// This type represent a token used to isolate unrelated streams on different circuits. 299 #[derive(Clone, Copy, From, Debug, PartialEq, Eq, Default)] derive(From)
here is dangerous, since it lets callers create any authentication token they want. I think we should leave it out for now.I think
default
here may also give unexpected results: "all streams are isolated by default" is not necessarily what people would expect. (I'm not sure about that, however.)derive(From) was so one can create tokens the way they want, but I guess its a risk for almost nothing.
However for
Default
, I think it doesn't do what you think it does. It's required to be able derive Default on ConnectPrefs, and it's not actually isolating. Tokens created with Default will have id 0, so they are different from any token created withnew
(that's why the static counter in new start at 1, not 0), but every default token is equalEdited by trinity-1686achanged this line in version 2 of the diff
- Resolved by trinity-1686a
75 76 /// This type should stay internal to the circmgr crate for now: we'll probably 76 77 /// want to refactor it a lot. 77 78 #[derive(Clone, Debug)] 78 79 pub(crate) enum TargetCircUsage { - Resolved by trinity-1686a
- Resolved by trinity-1686a
Awesome! This is a good set of patches, and it looks like it should implement isolation well. I think we can use this as the basis for our isolation code going forward.
I've made some notes about issues to fix in the near term and in the long term: the near-term ones should get fixed before we merge, or immediately after. Please feel free to fix anything you want to, and I'll take on the rest once you're done.
Thanks again!
added Needs Revision label
added 1 commit
- 402662f0 - make isolation_group optional in SupportedCircUsage
I'm not sure how to separate
IsolationGroup
fromTarget/SupportedCircUsage
cleanly, so I guess I'm done.Edit: last commit to reexport IsolationToken in tor-client, to not make #118 (closed) worse.
Edited by trinity-1686aremoved Needs Revision label
mentioned in issue #150 (closed)