Example #1
0
// DeleteDestination deletes the specified destination from the IPVS table.
func DeleteDestination(svc Service, dst Destination) error {
	ic := &ipvsCommand{
		Service:     newIPVSService(&svc),
		Destination: newIPVSDestination(&dst),
	}
	return netlink.SendMessageMarshalled(C.IPVS_CMD_DEL_DEST, family, 0, ic)
}
Example #2
0
// AddService adds the specified service to the IPVS table. Any destinations
// associated with the given service will also be added.
func AddService(svc Service) error {
	ic := &ipvsCommand{Service: newIPVSService(&svc)}
	if err := netlink.SendMessageMarshalled(C.IPVS_CMD_NEW_SERVICE, family, 0, ic); err != nil {
		return err
	}
	for _, dst := range svc.Destinations {
		if err := AddDestination(svc, *dst); err != nil {
			return err
		}
	}
	return nil
}
Example #3
0
// DeleteService deletes the specified service from the IPVS table.
func DeleteService(svc Service) error {
	ic := &ipvsCommand{Service: newIPVSService(&svc)}
	return netlink.SendMessageMarshalled(C.IPVS_CMD_DEL_SERVICE, family, 0, ic)
}