all: make router setup/cleanup works more generally

This commit is contained in:
Cuong Manh Le
2023-08-09 23:54:23 +07:00
committed by Cuong Manh Le
parent 66cb7cc21d
commit 9ed8e49a08
13 changed files with 115 additions and 34 deletions
+6
View File
@@ -44,6 +44,9 @@ func (s *Synology) PreRun() error {
}
func (s *Synology) Setup() error {
if s.cfg.FirstListener().IsDirectDnsListener() {
return nil
}
data, err := dnsmasq.ConfTmpl(dnsmasq.ConfigContentTmpl, s.cfg)
if err != nil {
return err
@@ -61,6 +64,9 @@ func (s *Synology) Setup() error {
}
func (s *Synology) Cleanup() error {
if s.cfg.FirstListener().IsDirectDnsListener() {
return nil
}
// Remove the custom config files.
for _, f := range []string{synologyDNSMasqConfigPath, synologyDhcpdInfoPath} {
if err := os.Remove(f); err != nil {