cloudflare / boringtun

Userspace WireGuard® Implementation in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

First time connection takes too long to establish.

zaid3tech opened this issue · comments

Hi, I have observed a delay of 10-16 seconds when I try to connect for the very first time. Further connections work normally.

Context

  • I have deployed the boringtun master branch on a digital ocean droplet.
  • Almost 27000 peers are registered on WireGuard(boringtun) instance.
  • I am testing the connection from WireGuard MacOs and IOS client.
  • For a newly created peer, on testing it from WireGuard MacOs or IOS clients, data received remains constant i.e 92 bytes for 10 - 16 seconds with no browsing, and after this, a new handshake is initiated and the tunnel starts receiving data.

Boringtun logs
I can see the following logs until a new handshake is initiated and the tunnel starts receiving data.

Decapsulate error NoCurrentSession
Decapsulate error NoCurrentSession
Decapsulate error NoCurrentSession
Decapsulate error NoCurrentSession

https://github.com/cloudflare/boringtun/blob/master/boringtun/src/device/mod.rs#L710

Could that big number of peers i.e 27000 cause this delay? I have tested it with a smaller number of peers i.e 20 as well and it worked fine.

My bad observation..