This commit is contained in:
jdl
2026-06-15 06:25:47 +02:00
parent b4320c9330
commit fa933ae029
2 changed files with 14 additions and 17 deletions

View File

@@ -134,23 +134,20 @@ func (a *App) logNetworkState() {
for _, p := range peers { for _, p := range peers {
ip := p.VPNIP.As4()[3] ip := p.VPNIP.As4()[3]
up := "DOWN"
if p.Up() {
up = "UP "
}
switch p.State { endpoint := p.WGEndpoint()
case StateDirect: if endpoint.IsValid() {
if p.Role == control.Client { fmt.Fprintf(&b, " %24s %03d %s %s seen=%s @ %s\n",
fmt.Fprintf(&b, " %24s %03d DIRECT @ %s rtt=%s\n", p.Name, ip, p.State, up, time.Since(p.LastPing).Round(time.Millisecond), endpoint)
p.Name, ip, p.WGEndpoint(), p.RTT.Round(time.Millisecond))
} else { } else {
fmt.Fprintf(&b, " %24s %03d DIRECT @ %s\n", fmt.Fprintf(&b, " %24s %03d %s %s seen=%s\n",
p.Name, ip, p.WGEndpoint()) p.Name, ip, p.State, up, time.Since(p.LastPing).Round(time.Millisecond))
}
} }
case StateProbing:
fmt.Fprintf(&b, " %24s %03d PROBING @ %s\n",
p.Name, ip, p.PreferredEndpoint())
case StateRelayed:
fmt.Fprintf(&b, " %24s %03d RELAYED\n", p.Name, ip)
}
}
log.Print(b.String()) log.Print(b.String())
} }

View File

@@ -12,8 +12,8 @@ import (
type PeerState string type PeerState string
const ( const (
StateRelayed = PeerState("RELAY") StateRelayed = PeerState("RELAY ")
StateProbing = PeerState("PROBE") StateProbing = PeerState("PROBE ")
StateDirect = PeerState("DIRECT") StateDirect = PeerState("DIRECT")
) )