Пример #1
0
func (dests ServiceDests) get(ipvsDest ipvs.Dest) Dest {
	if dest, exists := dests[ipvsDest.String()]; exists {
		return dest
	} else {
		dest := Dest{
			Dest: ipvsDest,
		}

		dests[dest.String()] = dest

		return dest
	}
}
Пример #2
0
func (dests ServiceDests) config(ipvsDest ipvs.Dest) {
	dest, exists := dests[ipvsDest.String()]
	if exists {
		// merge
		dest.Weight += ipvsDest.Weight

	} else {
		dest = Dest{
			Dest: ipvsDest,
		}
	}

	dests[ipvsDest.String()] = dest
}