Explicit print out the first success handshake time

This commit is contained in:
Zoltán Papp
2025-09-03 14:06:28 +02:00
parent 1d83fccd9c
commit fd13247d66
2 changed files with 11 additions and 0 deletions

View File

@@ -394,6 +394,13 @@ func toLastHandshake(stringVar string) (time.Time, error) {
if err != nil {
return time.Time{}, fmt.Errorf("parse handshake sec: %w", err)
}
// If sec is 0 (Unix epoch), return zero time instead
// This indicates no handshake has occurred
if sec == 0 {
return time.Time{}, nil
}
return time.Unix(sec, 0), nil
}

View File

@@ -101,6 +101,10 @@ func (w *WGWatcher) periodicHandshakeCheck(ctx context.Context, ctxCancel contex
onDisconnectedFn()
return
}
if lastHandshake.IsZero() {
w.log.Infof("first wg handshake detected at: %s", handshake)
}
lastHandshake = *handshake
resetTime := time.Until(handshake.Add(checkPeriod))