MCPcopy
hub / github.com/google/seesaw / expandServices

Method expandServices

engine/vserver.go:301–336  ·  view source on GitHub ↗

expandServices returns a list of services that have been expanded from the vserver configuration.

()

Source from the content-addressed store, hash-verified

299// expandServices returns a list of services that have been expanded from the
300// vserver configuration.
301func (v *vserver) expandServices() map[serviceKey]*service {
302 if v.config.UseFWM {
303 return v.expandFWMServices()
304 }
305
306 svcs := make(map[serviceKey]*service)
307 for _, af := range seesaw.AFs() {
308 var ip net.IP
309 switch af {
310 case seesaw.IPv4:
311 ip = v.config.Host.IPv4Addr
312 case seesaw.IPv6:
313 ip = v.config.Host.IPv6Addr
314 }
315 if ip == nil {
316 continue
317 }
318 for _, entry := range v.config.Entries {
319 svc := &service{
320 serviceKey: serviceKey{
321 af: af,
322 proto: entry.Proto,
323 port: entry.Port,
324 },
325 ip: seesaw.NewIP(ip),
326 ventry: entry,
327 vserver: v,
328 dests: make(map[destinationKey]*destination, 0),
329 stats: &seesaw.ServiceStats{},
330 }
331 svc.ipvsSvc = svc.ipvsService()
332 svcs[svc.serviceKey] = svc
333 }
334 }
335 return svcs
336}
337
338// expandFWMServices returns a list of services that have been expanded from the
339// vserver configuration for a firewall mark based vserver.

Callers 4

configInitMethod · 0.95
configUpdateMethod · 0.95
TestExpandServicesFunction · 0.80
TestExpandFWMServicesFunction · 0.80

Calls 4

expandFWMServicesMethod · 0.95
ipvsServiceMethod · 0.95
AFsFunction · 0.92
NewIPFunction · 0.92

Tested by 2

TestExpandServicesFunction · 0.64
TestExpandFWMServicesFunction · 0.64