Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package configmgr defines the AdGuard Home on-disk configuration entities and configuration manager.
TODO(a.garipov): Add tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
	// BaseLogger is used to create loggers for other entities.  It must not be
	// nil.
	BaseLogger *slog.Logger
	// Logger is used for logging the operation of the configuration manager.
	// It must not be nil.
	Logger *slog.Logger
	// Frontend is the filesystem with the frontend files.
	Frontend fs.FS
	// WebAddr is the initial or override address for the Web UI.  It is not
	// written to the configuration file.
	WebAddr netip.AddrPort
	// Start is the time of start of AdGuard Home.
	Start time.Time
	// FileName is the path to the configuration file.
	FileName string
}
    Config contains the configuration parameters for the configuration manager.
type Manager ¶
type Manager struct {
	// contains filtered or unexported fields
}
    Manager handles full and partial changes in the configuration, persisting them to disk if necessary.
TODO(a.garipov): Support missing configs and default values.
func New ¶
New creates a new *Manager that persists changes to the file pointed to by c.FileName. It reads the configuration file and populates the service fields. c must not be nil.
func (*Manager) DNS ¶
func (m *Manager) DNS() (dns agh.ServiceWithConfig[*dnssvc.Config])
DNS returns the current DNS service. It is safe for concurrent use.
func (*Manager) UpdateDNS ¶
UpdateDNS implements the websvc.ConfigManager interface for *Manager. The fields of c must not be modified after calling UpdateDNS.
func (*Manager) UpdateWeb ¶
UpdateWeb implements the websvc.ConfigManager interface for *Manager. The fields of c must not be modified after calling UpdateWeb.