DefGuard / DefGuard/defguard

Simplify VPN client disconnect process

Open
#1,333 2 comments 0 reactions 0 assignees View on GitHub
refactoring
Dominant language
Rust
Stars
2.8k
Forks
115
Avg merge
1d 4h
Merged PRs (30d)
51

Description

Currently we have at least 3 places where a determination is made whether a VPN client is connected/disconnected:
- peer stats in network overview
- when receiving network stats in order to generate connected/disconnected events for the activity log
- in the periodic peer disconnect for MFA-enabled locations

Some of those use different time thresholds and run at different times, so they can generate conflicting results.

We should migrate to a unified solution that would handle all of those use-cases.

My proposal is to put all of this logic into a dedicated service whose purpose it would be to handle wireguard peer stats updates. Aside from determining whether a client is connected or not (and storing those sessions in the DB) we could also use it to pre-process incoming stats to avoid using expensive views for generating traffic stats.

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.