Pull request: hup-reload

Merge in DNS/adguard-home from hup-reload to master

Squashed commit of the following:

commit 5cd4ab85bdc7544a4eded2a61f5a5571175daa44
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Oct 7 19:58:17 2022 +0300

    next: imp signal hdlr

commit 8fd18e749fec46982d26fc408e661bd802586c37
Merge: a8780455 f1dd3334
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Oct 7 19:46:48 2022 +0300

    Merge branch 'master' into hup-reload

commit a87804550e15d7fe3d9ded2e5a736c395f96febd
Merge: 349dbe54 960a7a75
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Oct 7 15:49:23 2022 +0300

    Merge branch 'master' into hup-reload

commit 349dbe54fe27eeaf56776c73c3cc5649018d4c60
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Oct 7 15:43:52 2022 +0300

    next: imp docs, names

commit 7287a86d283489127453009267911003cea5227e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Oct 7 13:39:44 2022 +0300

    WIP all: impl dynamic reconfiguration
This commit is contained in:
Ainar Garipov
2022-10-10 14:05:24 +03:00
parent f1dd33346a
commit f5602d9c46
18 changed files with 417 additions and 70 deletions

View File

@@ -12,6 +12,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/next/agh"
"github.com/AdguardTeam/AdGuardHome/internal/next/dnssvc"
"github.com/AdguardTeam/AdGuardHome/internal/next/websvc"
"github.com/AdguardTeam/golibs/testutil"
@@ -34,20 +35,20 @@ var _ websvc.ConfigManager = (*configManager)(nil)
// configManager is a [websvc.ConfigManager] for tests.
type configManager struct {
onDNS func() (svc websvc.ServiceWithConfig[*dnssvc.Config])
onWeb func() (svc websvc.ServiceWithConfig[*websvc.Config])
onDNS func() (svc agh.ServiceWithConfig[*dnssvc.Config])
onWeb func() (svc agh.ServiceWithConfig[*websvc.Config])
onUpdateDNS func(ctx context.Context, c *dnssvc.Config) (err error)
onUpdateWeb func(ctx context.Context, c *websvc.Config) (err error)
}
// DNS implements the [websvc.ConfigManager] interface for *configManager.
func (m *configManager) DNS() (svc websvc.ServiceWithConfig[*dnssvc.Config]) {
func (m *configManager) DNS() (svc agh.ServiceWithConfig[*dnssvc.Config]) {
return m.onDNS()
}
// Web implements the [websvc.ConfigManager] interface for *configManager.
func (m *configManager) Web() (svc websvc.ServiceWithConfig[*websvc.Config]) {
func (m *configManager) Web() (svc agh.ServiceWithConfig[*websvc.Config]) {
return m.onWeb()
}
@@ -64,8 +65,8 @@ func (m *configManager) UpdateWeb(ctx context.Context, c *websvc.Config) (err er
// newConfigManager returns a *configManager all methods of which panic.
func newConfigManager() (m *configManager) {
return &configManager{
onDNS: func() (svc websvc.ServiceWithConfig[*dnssvc.Config]) { panic("not implemented") },
onWeb: func() (svc websvc.ServiceWithConfig[*websvc.Config]) { panic("not implemented") },
onDNS: func() (svc agh.ServiceWithConfig[*dnssvc.Config]) { panic("not implemented") },
onWeb: func() (svc agh.ServiceWithConfig[*websvc.Config]) { panic("not implemented") },
onUpdateDNS: func(_ context.Context, _ *dnssvc.Config) (err error) {
panic("not implemented")
},