cloudflare / boringtun

Userspace WireGuard® Implementation in Rust
BSD 3-Clause "New" or "Revised" License
5.92k stars 396 forks source link

Make queue size configurable & drop oldest packets first #405

Open copy opened 2 months ago

copy commented 2 months ago

This PR contains three commits:

  1. Make the queue size configurable. In my program, the server sometime starts on-demand, and the client buffers a significant number of packets by default, which causes a bit of flooding
  2. Replaces a conditional with an assertion. I'd happily revert if this desired by maintainers. This code would probably be a bit more readable if dequeue_packet and requeue_packet were inlined into their callsite, which I'd also happily contribute
  3. Drop oldest packets first. I believe this is reasonable (think TCP retransmits), but I'd be happy to keep the current behaviour if wanted

Side-note: Is there a way to run only tests that don't required sudo?