mirror of https://github.com/wg-easy/wg-easy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
319 B
10 lines
319 B
export function isPeerConnected(client: { latestHandshakeAt: Date | null }) {
|
|
if (!client.latestHandshakeAt) {
|
|
return false;
|
|
}
|
|
|
|
const lastHandshakeMs = Date.now() - client.latestHandshakeAt.getTime();
|
|
|
|
// connected if last handshake was less than 10 minutes ago
|
|
return lastHandshakeMs < 1000 * 60 * 10;
|
|
}
|
|
|