ipvsDestination returns an IPVS Destination for the given destination.
()
| 188 | |
| 189 | // ipvsDestination returns an IPVS Destination for the given destination. |
| 190 | func (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. |