small refactoring

This commit is contained in:
Vladimir Avtsenov 2024-09-06 14:52:42 +03:00
parent e04f651868
commit 319e75fd15
2 changed files with 5 additions and 5 deletions

View File

@ -82,7 +82,7 @@ func (g *Group) Disable() []error {
g.Enabled = false
return nil
return errs
}
func (a *App) AddGroup(group *models.Group) error {

View File

@ -84,8 +84,8 @@ func (a *App) Listen(ctx context.Context) []error {
a.dnsOverrider = a.NetfilterHelper.PortRemap(fmt.Sprintf("%sDNSOVERRIDER", a.Config.ChainPostfix), 53, a.Config.ListenPort)
err := a.dnsOverrider.Enable()
for idx, _ := range a.Groups {
err = a.Groups[idx].Enable()
for _, group := range a.Groups {
err = group.Enable()
if err != nil {
handleError(fmt.Errorf("failed to enable group: %w", err))
return errs
@ -108,8 +108,8 @@ func (a *App) Listen(ctx context.Context) []error {
handleErrors(errs2)
}
for idx, _ := range a.Groups {
errs2 = a.Groups[idx].Disable()
for _, group := range a.Groups {
errs2 = group.Disable()
if errs2 != nil {
handleErrors(errs2)
}