Bug fix - peer Up calculation
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user