boringtun
boringtun copied to clipboard
Appetite for refactoring to be SANS-IO (including time?)
This library is basically SANS-IO except for calls to Instant::now. I was wondering what the appetite is for changing that?
- APIs like
encapsulateanddecapsulateshould likely take annow: Instantparameter to accurately reflect timestamps of last received packets. update_timersshould also take anow: Instantparameter.
update_timers can save the provided now timestamp as local state and all other functions can compute durations etc based on that timestamp. Thus, accuracy of that depends entirely on the user in how often they call update_timers.
We might want to consider renaming update_timers to something like handle_timeout or update_now.
For all those interested, this (and other things) are now included in our boringtun fork as of today: https://github.com/firezone/boringtun/pull/45.