Created
June 4, 2016 09:02
-
-
Save ahupowerdns/600d272dc68e464047e7cd35e35a6aa2 to your computer and use it in GitHub Desktop.
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
| googleset = newDS() | |
| -- https://www.google.com/supported_domains | |
| -- (echo 'return{' ; for a in $(curl https://www.google.com/supported_domains | sed s/^\\.//) ; do echo \"$a\",; done ; echo '}') > googledomains.lua | |
| googleset:add(dofile("googledomains.lua")) | |
| function handleSafeSearch(dq) | |
| if(googleset:check(dq.qname)) then | |
| dq:addAnswer(pdns.CNAME, "forcesafesearch.google.com") | |
| dq.rcode=0 | |
| dq.followupFunction="followCNAMERecords" | |
| return true | |
| end | |
| return false | |
| end | |
| function preresolve(dq) | |
| if(handleSafeSearch(dq)) then | |
| return true; | |
| end | |
| return false; | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment