mirror of
https://github.com/hectorm/hblock.git
synced 2026-04-20 14:06:35 +05:30
Added DNS Response Policy Zone (RPZ) format
This commit is contained in:
parent
5c31cce7f8
commit
c57109002a
2 changed files with 50 additions and 3 deletions
29
Makefile
29
Makefile
|
|
@ -25,14 +25,32 @@ export DEFAULT_HOSTS
|
|||
|
||||
.PHONY: all \
|
||||
install uninstall \
|
||||
build build-hosts build-domains build-adblock build-dnsmasq build-unbound build-android build-windows \
|
||||
stats stats-tlds stats-suffixes \
|
||||
build \
|
||||
build-hosts \
|
||||
build-domains \
|
||||
build-adblock \
|
||||
build-rpz \
|
||||
build-dnsmasq \
|
||||
build-unbound \
|
||||
build-android \
|
||||
build-windows \
|
||||
stats \
|
||||
stats-tlds \
|
||||
stats-suffixes \
|
||||
index \
|
||||
clean
|
||||
|
||||
all: build index
|
||||
|
||||
build: build-hosts build-domains build-adblock build-dnsmasq build-unbound build-android build-windows
|
||||
build: \
|
||||
build-hosts \
|
||||
build-domains \
|
||||
build-adblock \
|
||||
build-rpz \
|
||||
build-dnsmasq \
|
||||
build-unbound \
|
||||
build-android \
|
||||
build-windows
|
||||
|
||||
build-hosts: dist/hosts
|
||||
dist/hosts:
|
||||
|
|
@ -47,6 +65,10 @@ build-adblock: build-hosts dist/hosts_adblock.txt
|
|||
dist/hosts_adblock.txt:
|
||||
"$(MKFILE_DIR)"/resources/alt-formats/adblock.sh dist/hosts > dist/hosts_adblock.txt
|
||||
|
||||
build-rpz: build-hosts dist/hosts_rpz.txt
|
||||
dist/hosts_rpz.txt:
|
||||
"$(MKFILE_DIR)"/resources/alt-formats/rpz.sh dist/hosts > dist/hosts_rpz.txt
|
||||
|
||||
build-dnsmasq: build-hosts dist/hosts_dnsmasq.conf
|
||||
dist/hosts_dnsmasq.conf:
|
||||
"$(MKFILE_DIR)"/resources/alt-formats/dnsmasq.sh dist/hosts > dist/hosts_dnsmasq.conf
|
||||
|
|
@ -108,6 +130,7 @@ clean:
|
|||
dist/hosts \
|
||||
dist/hosts_domains.txt \
|
||||
dist/hosts_adblock.txt \
|
||||
dist/hosts_rpz.txt \
|
||||
dist/hosts_dnsmasq.conf \
|
||||
dist/hosts_unbound.conf \
|
||||
dist/hosts_android.zip \
|
||||
|
|
|
|||
24
resources/alt-formats/rpz.sh
Executable file
24
resources/alt-formats/rpz.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Author: Héctor Molinero Fernández <hector@molinero.xyz>
|
||||
# Repository: https://github.com/hectorm/hblock
|
||||
# License: MIT, https://opensource.org/licenses/MIT
|
||||
|
||||
set -eu
|
||||
export LC_ALL=C
|
||||
|
||||
main() {
|
||||
hosts="${1:?}"
|
||||
|
||||
cat <<-'EOF'
|
||||
$TTL 2h
|
||||
@ IN SOA localhost. root.localhost. (1 6h 1h 1w 2h)
|
||||
IN NS localhost.
|
||||
EOF
|
||||
sed -n \
|
||||
-e '/^#.*<blocklist>/,/^#.*<\/blocklist>/!d;/^\s*#.*$/d' \
|
||||
-e 's/^\(.\{1,\}\)\s\{1,\}\(.\{1,\}\)\s*/\2 CNAME ./p' \
|
||||
"$hosts"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue