mirror of
https://github.com/juanfont/headscale.git
synced 2025-11-10 01:20:58 +01:00
types: NodeView CanAccess uses internal
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
d7a43a7cf1
commit
bd9cf42b96
@ -698,27 +698,11 @@ func (v NodeView) InIPSet(set *netipx.IPSet) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v NodeView) CanAccess(matchers []matcher.Match, node2 NodeView) bool {
|
func (v NodeView) CanAccess(matchers []matcher.Match, node2 NodeView) bool {
|
||||||
if !v.Valid() || !node2.Valid() {
|
if !v.Valid() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
src := v.IPs()
|
|
||||||
allowedIPs := node2.IPs()
|
|
||||||
|
|
||||||
for _, matcher := range matchers {
|
return v.ж.CanAccess(matchers, node2.AsStruct())
|
||||||
if !matcher.SrcsContainsIPs(src...) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if matcher.DestsContainsIP(allowedIPs...) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if matcher.DestsOverlapsPrefixes(node2.SubnetRoutes()...) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v NodeView) CanAccessRoute(matchers []matcher.Match, route netip.Prefix) bool {
|
func (v NodeView) CanAccessRoute(matchers []matcher.Match, route netip.Prefix) bool {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user