fabis-ralph-loop 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,18 +27,15 @@ try {
|
|
|
27
27
|
const resolv = execSync('cat /etc/resolv.conf', { encoding: 'utf-8' })
|
|
28
28
|
const upstream = resolv.match(/^\s*nameserver\s+(\S+)/m)?.[1] ?? '8.8.8.8'
|
|
29
29
|
|
|
30
|
-
//
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
'listen-address=127.0.0.1',
|
|
34
|
-
'bind-interfaces',
|
|
35
|
-
...blockedDomains.map((d) =>
|
|
36
|
-
].join('
|
|
37
|
-
|
|
38
|
-
execSync(`
|
|
39
|
-
|
|
40
|
-
// Start dnsmasq and point resolver to it
|
|
41
|
-
execSync('sudo dnsmasq', { stdio: 'pipe' })
|
|
30
|
+
// Start dnsmasq with CLI flags (conf-dir is commented out by default in Debian)
|
|
31
|
+
const dnsmasqArgs = [
|
|
32
|
+
`--server=${upstream}`,
|
|
33
|
+
'--listen-address=127.0.0.1',
|
|
34
|
+
'--bind-interfaces',
|
|
35
|
+
...blockedDomains.map((d) => `--address=/${d}/0.0.0.0`),
|
|
36
|
+
].join(' ')
|
|
37
|
+
|
|
38
|
+
execSync(`sudo dnsmasq ${dnsmasqArgs}`, { stdio: 'pipe' })
|
|
42
39
|
execSync(`echo 'nameserver 127.0.0.1' | sudo tee /etc/resolv.conf > /dev/null`, { stdio: 'pipe' })
|
|
43
40
|
|
|
44
41
|
console.log(`Blocked ${blockedDomains.length} domain(s) via dnsmasq: ${blockedDomains.join(', ')}`)
|