mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-06-09 00:53:53 +02:00
35 lines
970 B
Go
35 lines
970 B
Go
package router
|
|
|
|
const dnsMasqConfigContent = `# GENERATED BY ctrld - DO NOT MODIFY
|
|
no-resolv
|
|
server=127.0.0.1#5354
|
|
`
|
|
|
|
const merlinDNSMasqPostConfPath = "/jffs/scripts/dnsmasq.postconf"
|
|
const merlinDNSMasqPostConfMarker = `# GENERATED BY ctrld - EOF`
|
|
|
|
const merlinDNSMasqPostConf = `# GENERATED BY ctrld - DO NOT MODIFY
|
|
|
|
#!/bin/sh
|
|
|
|
config_file="$1"
|
|
. /usr/sbin/helper.sh
|
|
|
|
pid=$(cat /tmp/ctrld.pid 2>/dev/null)
|
|
if [ -n "$pid" ] && [ -f "/proc/${pid}/cmdline" ]; then
|
|
pc_delete "servers-file" "$config_file" # no WAN DNS settings
|
|
pc_append "no-resolv" "$config_file" # do not read /etc/resolv.conf
|
|
pc_append "server=127.0.0.1#5354" "$config_file" # use ctrld as upstream
|
|
|
|
|
|
# For John fork
|
|
pc_delete "resolv-file" "$config_file" # no WAN DNS settings
|
|
|
|
# Change /etc/resolv.conf, which may be changed by WAN DNS setup
|
|
pc_delete "nameserver" /etc/resolv.conf
|
|
pc_append "nameserver 127.0.0.1" /etc/resolv.conf
|
|
|
|
exit 0
|
|
fi
|
|
`
|