Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
kevin/allow_service_host_access_hosted_service
KevinLiang10 1 day ago
parent 58df21feef
commit 7ddce4786e

@ -7380,8 +7380,31 @@ func TestRouteAllDisabled(t *testing.T) {
cfg := &wgcfg.Config{
Peers: tt.peers,
}
ServiceIPMappings := tailcfg.ServiceIPMappings{
"svc:test-service": []netip.Addr{
netip.MustParseAddr("100.64.1.2"),
netip.MustParseAddr("fd7a:abcd:1234::1"),
},
}
svcIPMapJSON, err := json.Marshal(ServiceIPMappings)
if err != nil {
t.Fatalf("failed to marshal ServiceIPMappings: %v", err)
}
nm := &netmap.NetworkMap{
SelfNode: (&tailcfg.Node{
Name: "test-node",
Addresses: []netip.Prefix{
pp("100.64.1.1/32"),
},
CapMap: tailcfg.NodeCapMap{
tailcfg.NodeAttrServiceHost: []tailcfg.RawMessage{
tailcfg.RawMessage(svcIPMapJSON),
},
},
}).View(),
}
rcfg := lb.routerConfigLocked(cfg, prefs.View(), false)
rcfg := lb.routerConfigLocked(cfg, prefs.View(), nm, false)
for _, p := range rcfg.Routes {
found := false
for _, r := range tt.wantEndpoints {

Loading…
Cancel
Save