From 13b94cc4d7e10fda332c21702005554747aa35b5 Mon Sep 17 00:00:00 2001 From: Simeng He Date: Tue, 18 May 2021 12:47:29 -0400 Subject: [PATCH] Added new Addresses / AllowedIPs fields to testcontrol when creating new &tailcfg.Node Signed-off-by: Simeng He --- tstest/integration/testcontrol/testcontrol.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tstest/integration/testcontrol/testcontrol.go b/tstest/integration/testcontrol/testcontrol.go index 0b37b5a95..ce2af6eff 100644 --- a/tstest/integration/testcontrol/testcontrol.go +++ b/tstest/integration/testcontrol/testcontrol.go @@ -307,6 +307,10 @@ func (s *Server) serveRegister(w http.ResponseWriter, r *http.Request, mkey tail machineAuthorized := true // TODO: add Server.RequireMachineAuth + allowedIPs := []netaddr.IPPrefix{ + netaddr.MustParseIPPrefix(fmt.Sprintf("100.64.%d.%d/32", uint8(tailcfg.NodeID(user.ID)>>8), uint8(tailcfg.NodeID(user.ID)))), + } + s.nodes[req.NodeKey] = &tailcfg.Node{ ID: tailcfg.NodeID(user.ID), StableID: tailcfg.StableNodeID(fmt.Sprintf("TESTCTRL%08x", int(user.ID))), @@ -314,6 +318,8 @@ func (s *Server) serveRegister(w http.ResponseWriter, r *http.Request, mkey tail Machine: mkey, Key: req.NodeKey, MachineAuthorized: machineAuthorized, + Addresses: allowedIPs, + AllowedIPs: allowedIPs, } requireAuth := s.RequireAuth if requireAuth && s.nodeKeyAuthed[req.NodeKey] {