Logging
This commit is contained in:
25
peer/app.go
25
peer/app.go
@@ -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())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user