Last active
July 28, 2016 08:49
-
-
Save quchao/8d82310c358854ffdc3030c3fdf57280 to your computer and use it in GitHub Desktop.
Convert .conf files in dnsmasq format to unbound format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CN_DNS="182.254.116.116" # DNSPod Shenzhen | |
CN_DNS_2="114.114.114.114" # 114DNS | |
cat dnsmasq.conf | grep -v '^#' | sed -e "s|^server=/\([^0-9].*\)/[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}$|forward-zone:\n\tname: \"\1\"\n\tforward-addr: ${CN_DNS}\n\tforward-addr: ${CN_DNS_2}\n\tforward-first: yes|g" -e "s|^address=/\([^0-9].*\)/\([0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}\)$|local-zone: \"\1 A \2\"|g" > unbound.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment