all: writing correct routers setup to config file

When running on routers, ctrld leverages default setup, let dnsmasq runs
on port 53, and forward queries to ctrld listener on port 5354. However,
this setup is not serialized to config file, causing confusion to users.

Fixing this by writing the correct routers setup to config file. While
at it, updating documentation to refelct that, and also adding note that
changing default router setup could break things.
This commit is contained in:
Cuong Manh Le authored and Cuong Manh Le committed 2023-08-09 23:54:23 +07:00
1 parent 350d8355b1
commit 50bfed706d
6 files changed
+41 -14

No files matched your search

+1 -1
View File
@@ -69,7 +69,7 @@ func cleanupFirewalla() error {
// Restart dnsmasq service.
if err := restartDNSMasq(); err != nil {
return fmt.Errorf("cleaupFirewalla: restartDNSMasq: %w", err)
return fmt.Errorf("cleanupFirewalla: restartDNSMasq: %w", err)
}
return nil
+9 -4
View File
@@ -214,16 +214,21 @@ func Cleanup(svc *service.Config) error {
return nil
}
// ListenAddress returns the listener address of ctrld on router.
func ListenAddress() string {
// ListenIP returns the listener IP of ctrld on router.
func ListenIP() string {
return "127.0.0.1"
}
// ListenPort returns the listener port of ctrld on router.
func ListenPort() int {
name := Name()
switch name {
case DDWrt, Firewalla, Merlin, OpenWrt, Synology, Tomato, Ubios:
return "127.0.0.1:5354"
return 5354
case Pfsense:
// On pfsense, we run ctrld as DNS resolver.
}
return ""
return 53
}
// Name returns name of the router platform.