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

Method ipvsDestination

engine/vserver.go:190–210  ·  view source on GitHub ↗

ipvsDestination returns an IPVS Destination for the given destination.

()

Source from the content-addressed store, hash-verified

188
189// ipvsDestination returns an IPVS Destination for the given destination.
190func (d *destination) ipvsDestination() *ipvs.Destination {
191 var flags ipvs.DestinationFlags
192 switch d.service.ventry.Mode {
193 case seesaw.LBModeNone:
194 log.Warningf("%v: Unspecified LB mode", d)
195 case seesaw.LBModeDSR:
196 flags |= ipvs.DFForwardRoute
197 case seesaw.LBModeNAT:
198 flags |= ipvs.DFForwardMasq
199 case seesaw.LBModeTUN:
200 flags |= ipvs.DFForwardTunnel
201 }
202 return &ipvs.Destination{
203 Address: d.ip.IP(),
204 Port: d.service.port,
205 Weight: d.weight,
206 Flags: flags,
207 LowerThreshold: uint32(d.service.ventry.LThreshold),
208 UpperThreshold: uint32(d.service.ventry.UThreshold),
209 }
210}
211
212// ipvsEqual returns true if two destinations have the same IPVS configuration.
213// Transient state is ignored.

Callers 1

expandDestsMethod · 0.95

Calls 1

IPMethod · 0.45

Tested by

no test coverage detected