remove pointers to net.IPNet
This commit is contained in:
parent
40007fc115
commit
2b9d354580
8
main.go
8
main.go
|
@ -28,7 +28,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
type route struct {
|
type route struct {
|
||||||
Dst *net.IPNet
|
Dst net.IPNet
|
||||||
Counter uint
|
Counter uint
|
||||||
UnreachableDuration time.Duration
|
UnreachableDuration time.Duration
|
||||||
UnreachableSince time.Time
|
UnreachableSince time.Time
|
||||||
|
@ -74,7 +74,7 @@ func newRouteStats() *routeStats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func dstIPNet(rm rtnetlink.RouteMessage) *net.IPNet {
|
func dstIPNet(rm rtnetlink.RouteMessage) net.IPNet {
|
||||||
var zeros int
|
var zeros int
|
||||||
switch rm.Family {
|
switch rm.Family {
|
||||||
case unix.AF_INET:
|
case unix.AF_INET:
|
||||||
|
@ -84,7 +84,7 @@ func dstIPNet(rm rtnetlink.RouteMessage) *net.IPNet {
|
||||||
default:
|
default:
|
||||||
fmt.Fprintf(os.Stderr, "unexpected family %q", rm.Family)
|
fmt.Fprintf(os.Stderr, "unexpected family %q", rm.Family)
|
||||||
}
|
}
|
||||||
return &net.IPNet{
|
return net.IPNet{
|
||||||
IP: rm.Attributes.Dst,
|
IP: rm.Attributes.Dst,
|
||||||
Mask: net.CIDRMask(int(rm.DstLength), zeros),
|
Mask: net.CIDRMask(int(rm.DstLength), zeros),
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ func render(w io.Writer, rs []route) error {
|
||||||
{{- if not .UnreachableSince.IsZero }}unreachable{{end -}}
|
{{- if not .UnreachableSince.IsZero }}unreachable{{end -}}
|
||||||
{{- if .Noise $now }} noise{{end -}}
|
{{- if .Noise $now }} noise{{end -}}
|
||||||
">
|
">
|
||||||
<td class="dst">{{.Dst}}</td>
|
<td class="dst">{{.Dst.String}}</td>
|
||||||
<td class="hostname">{{with .Hostname}}<a href="//{{.}}" target="_blank">{{.}}</a>{{end}}</td>
|
<td class="hostname">{{with .Hostname}}<a href="//{{.}}" target="_blank">{{.}}</a>{{end}}</td>
|
||||||
<td class="counter">{{.Counter}}</td>
|
<td class="counter">{{.Counter}}</td>
|
||||||
<td class="downtime">{{.Downtime $now | printf "%.3f%%"}}</td>
|
<td class="downtime">{{.Downtime $now | printf "%.3f%%"}}</td>
|
||||||
|
|
Loading…
Reference in New Issue