cloudflare / cloudflare/boringtun

Appetite for refactoring to be SANS-IO (including time?)

Open
#391 1 comment 11 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
7.2k
Forks
532
PR merge metrics
No merged PRs in 30d

Description

This library is basically SANS-IO except for calls to `Instant::now`. I was wondering what the appetite is for changing that?

- APIs like `encapsulate` and `decapsulate` should likely take an `now: Instant` parameter to accurately reflect timestamps of last received packets.
- `update_timers` should also take a `now: Instant` parameter.

`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`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.