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

Method expandDests

engine/vserver.go:388–412  ·  view source on GitHub ↗

expandDests returns a list of destinations that have been expanded from the vserver configuration and a given service.

(svc *service)

Source from the content-addressed store, hash-verified

386// expandDests returns a list of destinations that have been expanded from the
387// vserver configuration and a given service.
388func (v *vserver) expandDests(svc *service) map[destinationKey]*destination {
389 dsts := make(map[destinationKey]*destination, len(v.config.Backends))
390 for _, backend := range v.config.Backends {
391 var ip net.IP
392 switch svc.af {
393 case seesaw.IPv4:
394 ip = backend.Host.IPv4Addr
395 case seesaw.IPv6:
396 ip = backend.Host.IPv6Addr
397 }
398 if ip == nil {
399 continue
400 }
401 dst := &destination{
402 destinationKey: newDestinationKey(ip),
403 service: svc,
404 backend: backend,
405 weight: backend.Weight,
406 }
407 dst.ipvsDst = dst.ipvsDestination()
408 dst.stats = &seesaw.DestinationStats{}
409 dsts[dst.destinationKey] = dst
410 }
411 return dsts
412}
413
414// expandChecks returns a list of checks that have been expanded from the
415// vserver configuration.

Callers 4

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

Calls 2

ipvsDestinationMethod · 0.95
newDestinationKeyFunction · 0.85

Tested by 2

TestExpandServicesFunction · 0.64
TestExpandFWMServicesFunction · 0.64