Exemplo n.º 1
0
// IPVSGetServices gets the currently configured services from the IPVS table.
func (ncc *SeesawNCC) IPVSGetServices(in int, s *ncctypes.IPVSServices) error {
	ipvsMutex.Lock()
	defer ipvsMutex.Unlock()
	svcs, err := ipvs.GetServices()
	if err != nil {
		return err
	}
	s.Services = nil
	for _, svc := range svcs {
		s.Services = append(s.Services, svc)
	}
	return nil
}
Exemplo n.º 2
0
// IPVSGetService gets the currently configured service from the IPVS table,
// which matches the specified service.
func (ncc *SeesawNCC) IPVSGetService(si *ipvs.Service, s *ncctypes.IPVSServices) error {
	ipvsMutex.Lock()
	defer ipvsMutex.Unlock()
	so, err := ipvs.GetService(si)
	if err != nil {
		return err
	}
	s.Services = []*ipvs.Service{so}
	return nil
}