types/view: add ContainsNonExitSubnetRoutes func
Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
(cherry picked from commit 5363a90272
)
net-audit-log/1.32
parent
a780929391
commit
f7c15dd0b0
|
@ -216,6 +216,17 @@ func (v IPPrefixSlice) ContainsExitRoutes() bool {
|
||||||
return tsaddr.ContainsExitRoutes(v.ж.ж)
|
return tsaddr.ContainsExitRoutes(v.ж.ж)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ContainsNonExitSubnetRoutes reports whether v contains Subnet
|
||||||
|
// Routes other than ExitNode Routes.
|
||||||
|
func (v IPPrefixSlice) ContainsNonExitSubnetRoutes() bool {
|
||||||
|
for i := 0; i < v.Len(); i++ {
|
||||||
|
if v.At(i).Bits() != 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// MarshalJSON implements json.Marshaler.
|
// MarshalJSON implements json.Marshaler.
|
||||||
func (v IPPrefixSlice) MarshalJSON() ([]byte, error) {
|
func (v IPPrefixSlice) MarshalJSON() ([]byte, error) {
|
||||||
return v.ж.MarshalJSON()
|
return v.ж.MarshalJSON()
|
||||||
|
|
Loading…
Reference in New Issue