summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/util.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: add a backend to detect reported clock skew.Nick Mathewson2022-03-231-0/+1
| | | | | | | | | | | | | | | | NETINFO cells, which are sent in every handshake, may contain timestamps. This patch adds an accessor for the timestamp in the Netinfo messages, and teaches the tor-proto code how to compute the minimum clock skew in the code. The computation isn't terribly precise, but it doesn't need to be: Tor should work fine if your clock is accurate to within a few hours. This patch also notes a Y2038 problem in the protocol: see torspec#80. Part of #405.
* Make coarsetime dependency and traffic-timestamping non-optional.Nick Mathewson2022-02-251-1/+0
| | | | | | | | | | | | | | Previously coarsetime and the traffic-timestamp feature were enabled, since they were only required for a small corner of the guardmgr algorithm. But in 1.0 and beyond we'll be adding a bunch of other features (eg, netflow padding, DoS prevention) that will need coarsetime all over the place. And since we're going to be doing coarsetime all over the place, the previous justification for making traffic-timestamping optional (the tiny performance hit) is no longer relevant.
* Use coarsetime to build an incoming traffic timestamp.Nick Mathewson2021-11-021-0/+2
| | | | | | | | | | | | | | | | We need this for the circuit timeout estimator (#57). It needs to know "how recently have we got some incoming traffic", so that it can tell whether a circuit has truly timed out, or whether the entire network is down. I'm implementing this with coarsetime, since we need to update these in response to every single incoming cell, and we need the timestamp operation to be _fast_. (This reinstates an earlier commit, f30b2280, which I reverted because we didn't need it at the time.) Closes #179.
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+4
This will cause some pain for now, but now is really the best time to do this kind of thing.