Bug fix - peer Up calculation

This commit is contained in:
jdl
2026-06-15 06:17:52 +02:00
parent 797ab8bdef
commit d02f47cce6
2 changed files with 4 additions and 2 deletions

View File

@@ -7,7 +7,6 @@ import (
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"vppn/peer/control"
"vppn/peer/wginterface"
)
type PeerState string
@@ -29,6 +28,7 @@ type Peer struct {
EndpointLAN netip.AddrPort // Discovered via multicast.
EndpointWG netip.AddrPort // Current wireguard endpoint.
RTT time.Duration // Round-trip time.
LastPing time.Time // Last time we had a ping.
ProbeStart time.Time // When we started probing.
State PeerState // Current routing state; updated on each devXxx call.
Role control.Role // Role in relation to the local application.
@@ -57,7 +57,7 @@ func (p *Peer) LastHandshakeTime() time.Time {
}
func (p *Peer) Up() bool {
return time.Since(p.wgPeer.LastHandshakeTime) < wginterface.SessionTimeout
return time.Since(p.LastPing) > 3*PingInterval
}
func (p *Peer) CanRelay() bool {