Cleanup - audit
This commit is contained in:
@@ -2,6 +2,7 @@ package peer
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
"vppn/peer/control"
|
||||
@@ -28,6 +29,12 @@ func (a *App) onTick() {
|
||||
}
|
||||
|
||||
switch p.State {
|
||||
case StateRelayed:
|
||||
// If we have an ep to probe, add it.
|
||||
if ep := p.PreferredEndpoint(); ep.IsValid() {
|
||||
a.devAddProbe(p, ep)
|
||||
}
|
||||
|
||||
case StateProbing:
|
||||
// Promote probing peers to direct once alive (direct path confirmed
|
||||
// working).
|
||||
@@ -39,9 +46,13 @@ func (a *App) onTick() {
|
||||
if p.IsPublic || a.isPublic || p.Up() {
|
||||
break
|
||||
}
|
||||
// Stale non-public direct peer: demote to probing so WireGuard
|
||||
// resumes handshake attempts on the direct path.
|
||||
a.devAddProbe(p, p.PreferredEndpoint())
|
||||
|
||||
// Stale non-public direct peer: demote to relayed and wait for new IP
|
||||
// information.
|
||||
p.EndpointV4 = netip.AddrPort{}
|
||||
p.EndpointV6 = netip.AddrPort{}
|
||||
p.EndpointLAN = netip.AddrPort{}
|
||||
a.devAddPeer(p)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user