all: make router setup/cleanup works more generally

This commit is contained in:
Cuong Manh Le
2023-07-17 18:57:30 +00:00
committed by Cuong Manh Le
parent 66cb7cc21d
commit 9ed8e49a08
13 changed files with 115 additions and 34 deletions
+6
View File
@@ -54,6 +54,9 @@ func (f *Firewalla) PreRun() error {
}
func (f *Firewalla) Setup() error {
if f.cfg.FirstListener().IsDirectDnsListener() {
return nil
}
data, err := dnsmasq.FirewallaConfTmpl(dnsmasq.ConfigContentTmpl, f.cfg)
if err != nil {
return fmt.Errorf("generating dnsmasq config: %w", err)
@@ -71,6 +74,9 @@ func (f *Firewalla) Setup() error {
}
func (f *Firewalla) Cleanup() error {
if f.cfg.FirstListener().IsDirectDnsListener() {
return nil
}
// Removing current config.
if err := os.Remove(firewallaDNSMasqConfigPath); err != nil {
return fmt.Errorf("removing ctrld config: %w", err)