MCPcopy Index your code
hub / github.com/tailscale/tailscale / GetVIPServiceIPMap

Method GetVIPServiceIPMap

types/netmap/netmap.go:107–121  ·  view source on GitHub ↗

GetVIPServiceIPMap returns a map of service names to the slice of VIP addresses that correspond to the service. The service names are with the prefix "svc:". TODO(tailscale/corp##25997): cache the result of decoding the capmap so that we don't have to decode it multiple times after each netmap upda

()

Source from the content-addressed store, hash-verified

105// TODO(tailscale/corp##25997): cache the result of decoding the capmap so that
106// we don't have to decode it multiple times after each netmap update.
107func (nm *NetworkMap) GetVIPServiceIPMap() tailcfg.ServiceIPMappings {
108 if nm == nil {
109 return nil
110 }
111 if !nm.SelfNode.Valid() {
112 return nil
113 }
114
115 ipMaps, err := tailcfg.UnmarshalNodeCapViewJSON[tailcfg.ServiceIPMappings](nm.SelfNode.CapMap(), tailcfg.NodeAttrServiceHost)
116 if len(ipMaps) != 1 || err != nil {
117 return nil
118 }
119
120 return ipMaps[0]
121}
122
123// GetIPVIPServiceMap returns a map of VIP addresses to the service
124// names that has the VIP address. The service names are with the

Callers 4

GetIPVIPServiceMapMethod · 0.95
UpdateNetstackIPsMethod · 0.80
PeerCapsForServiceMethod · 0.80

Calls 3

UnmarshalNodeCapViewJSONFunction · 0.92
CapMapMethod · 0.80
ValidMethod · 0.65

Tested by

no test coverage detected