mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-23 01:27:13 +02:00
internal/router: add UniFi Gateway support
UniFi Gateway (USG) uses its own DNS forwarding rule, which is configured default in /etc/dnsmasq.conf file. Adding ctrld own config in /etc/dnsmasq.d won't take effects. Instead, we must make changes directly to /etc/dnsmasq.conf, configuring ctrld as the only upstream.
This commit is contained in:
@@ -220,8 +220,10 @@ func distroName() string {
|
||||
case bytes.HasPrefix(unameO(), []byte("Tomato")):
|
||||
return Tomato
|
||||
case haveDir("/config/scripts/post-config.d"):
|
||||
checkUSG()
|
||||
return EdgeOS
|
||||
case haveFile("/etc/ubnt/init/vyatta-router"):
|
||||
checkUSG()
|
||||
return EdgeOS // For 2.x
|
||||
case isPfsense():
|
||||
return Pfsense
|
||||
@@ -253,3 +255,8 @@ func isPfsense() bool {
|
||||
b, err := os.ReadFile("/etc/platform")
|
||||
return err == nil && bytes.HasPrefix(b, []byte("pfSense"))
|
||||
}
|
||||
|
||||
func checkUSG() {
|
||||
out, _ := exec.Command("mca-cli-op", "info").Output()
|
||||
isUSG = bytes.Contains(out, []byte("UniFi-Gateway-"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user