ipn/ipnext: add NodeBackend.NodeBy{Addr,ID}

The immediate use case is feature/conn25 identifying the connector peer
node that responds to a DoH request.

Updates tailscale/corp#46169

Signed-off-by: Michael Ben-Ami <mzb@tailscale.com>
This commit is contained in:
Michael Ben-Ami authored and mzbenami committed 2026-10-16 12:45:54 -04:00
1 parent e915ebc42a
commit e310c02787
1 file changed
+8
+8
View File
@@ -557,6 +557,14 @@ type NodeBackend interface {
// Self returns the current node.
Self() tailcfg.NodeView
// NodeByAddr returns the ID of the node that owns
// the given IP address, or ok=false if there is none.
NodeByAddr(netip.Addr) (_ tailcfg.NodeID, ok bool)
// NodeByID returns the node with the given ID,
// or ok=false if there is none.
NodeByID(tailcfg.NodeID) (_ tailcfg.NodeView, ok bool)
// AppendMatchingPeers appends all peers that match the predicate
// to the base slice and returns it.
AppendMatchingPeers(base []tailcfg.NodeView, pred func(tailcfg.NodeView) bool) []tailcfg.NodeView