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
@@ -49,6 +49,9 @@ func (o *Openwrt) PreRun() error {
}
func (o *Openwrt) Setup() error {
if o.cfg.FirstListener().IsDirectDnsListener() {
return nil
}
data, err := dnsmasq.ConfTmpl(dnsmasq.ConfigContentTmpl, o.cfg)
if err != nil {
return err
@@ -68,6 +71,9 @@ func (o *Openwrt) Setup() error {
}
func (o *Openwrt) Cleanup() error {
if o.cfg.FirstListener().IsDirectDnsListener() {
return nil
}
// Remove the custom dnsmasq config
if err := os.Remove(openwrtDNSMasqConfigPath); err != nil {
return err