├── META-INF └── com │ └── google │ └── android │ ├── updater-script │ └── update-binary ├── Update.json ├── .gitattributes ├── mmrl.json ├── module.prop ├── service.sh ├── system.prop ├── README.md ├── post-fs-data.sh ├── config.sh └── LICENSE /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /Update.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.7f", 3 | "versionCode": "27", 4 | "zipUrl": "https://github.com/Magisk-Modules-Alt-Repo/AdGuardDNS4Magisk-IPv6/releases/download/2.7f/AdGuardDNS4Magisk-v2.7f.zip", 5 | "changelog": "Update for Magisk v24+" 6 | } 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Declare files that will always have LF line endings on checkout. 2 | META-INF/** text eol=lf 3 | *.prop text eol=lf 4 | *.sh text eol=lf 5 | *.md text eol=lf 6 | 7 | # Denote all files that are truly binary and should not be modified. 8 | system/** binary 9 | -------------------------------------------------------------------------------- /mmrl.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "TukangM", 3 | "contributors": ["xerta555"], 4 | "cover": "https://i.postimg.cc/nhM0RMkp/adguard.png", 5 | "categories": [ 6 | "Adblocking and Hosts Files", 7 | "Privacy Enhancements", 8 | "DNS Enchantment" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=AdGuardDNS4Magisk-IPv6 2 | name=AdGuardDNS4Magisk-IPv6 3 | version=v2.7f 4 | versionCode=27 5 | author=Rom, TukangM 6 | description=Using the "AdGuard DNS" DNS system-lessly! As simple as that and block ads and trackers. 7 | updateJson=https://raw.githubusercontent.com/Magisk-Modules-Alt-Repo/AdGuardDNS4Magisk-IPv6/main/Update.json 8 | support=https://forum.xda-developers.com/t/module-cloudflaredns4magisk.3772375/ 9 | donate=https://www.paypal.com/paypalme/romfr 10 | -------------------------------------------------------------------------------- /service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... 3 | # This will make your scripts compatible even if Magisk change its mount point in the future 4 | MODDIR=${0%/*} 5 | 6 | # This script will be executed in late_start service mode 7 | # More info in the main Magisk thread 8 | 9 | ip6tables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to destination 2a10:50c0::ad1:ff 10 | ip6tables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to destination 2a10:50c0::ad2:ff 11 | ip6tables -t nat -I OUTPUT -p tcp --dport 53 -j DNAT --to-destination 2a10:50c0::ad1:ff 12 | ip6tables -t nat -I OUTPUT -p udp --dport 53 -j DNAT --to-destination 2a10:50c0::ad2:ff 13 | -------------------------------------------------------------------------------- /system.prop: -------------------------------------------------------------------------------- 1 | # This file will be read by resetprop 2 | # Example: Change dpi 3 | # ro.sf.lcd_density=320 4 | 5 | resetprop -n net.eth0.dns1=2a10:50c0::ad1:ff 6 | resetprop -n net.eth0.dns2=2a10:50c0::ad2:ff 7 | 8 | resetprop -n net.dns1=2a10:50c0::ad1:ff 9 | resetprop -n net.dns2=2a10:50c0::ad2:ff 10 | 11 | resetprop -n net.ppp0.dns1=2a10:50c0::ad1:ff 12 | resetprop -n net.ppp0.dns2=2a10:50c0::ad2:ff 13 | 14 | resetprop -n net.rmnet0.dns1=2a10:50c0::ad1:ff 15 | resetprop -n net.rmnet0.dns2=2a10:50c0::ad2:ff 16 | 17 | resetprop -n net.rmnet1.dns1=2a10:50c0::ad1:ff 18 | resetprop -n net.rmnet1.dns2=2a10:50c0::ad2:ff 19 | 20 | resetprop -n net.pdpbr1.dns1=2a10:50c0::ad1:ff 21 | resetprop -n net.pdpbr1.dns2=2a10:50c0::ad2:ff 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fork from [xerta555/CloudflareDNS4Magisk](https://github.com/xerta555/CloudflareDNS4Magisk-IPv6) 2 |

3 | 4 |
5 |
6 | 7 | 8 | Hello, 9 | 10 | ### DNS ?? Gne ?? What's this ? 11 | 12 | To make it short: a DNS server listen and give you the corresponding IP address of your website request, and its domain name (forum.xda-developers.com for example). 13 | 14 | For the long version a little reading is necessary: https://en.wikipedia.org/wiki/Domain_Name_System 15 | 16 | ### The purpose of this module? 17 | Forward all mobile data via their servers and AdGuard DNS help block annoying ads and trackers. 18 | 19 | 20 | #### Warning: 21 | 22 | Please note that your web provider can purely block all requests if you use customs DNS servers address. I can't do anything for that. 23 | 24 | ### Requirements: 25 | - An android device (something tells me if you're here it's because you have one..) 26 | - Magisk installed (v17+ at least) 27 | - five minutes of your free-times (and a little piece of your brain (just in case)) 28 | 29 | ### If you trust them, so install this module, restart and enjoy ! :) 30 | -------------------------------------------------------------------------------- /post-fs-data.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... 3 | # This will make your scripts compatible even if Magisk change its mount point in the future 4 | MODDIR=${0%/*} 5 | 6 | # This script will be executed in post-fs-data mode 7 | # More info in the main Magisk thread 8 | 9 | # Set CF DNS servers address 10 | resetprop -n net.eth0.dns1 2a10:50c0::ad1:ff 11 | resetprop -n net.eth0.dns2 2a10:50c0::ad2:ff 12 | 13 | resetprop -n net.dns1 2a10:50c0::ad1:ff 14 | resetprop -n net.dns2 2a10:50c0::ad2:ff 15 | 16 | resetprop -n net.ppp0.dns1 2a10:50c0::ad1:ff 17 | resetprop -n net.ppp0.dns2 2a10:50c0::ad2:ff 18 | 19 | resetprop -n net.rmnet0.dns1 2a10:50c0::ad1:ff 20 | resetprop -n net.rmnet0.dns2 2a10:50c0::ad2:ff 21 | 22 | resetprop -n net.rmnet1.dns1 2a10:50c0::ad1:ff 23 | resetprop -n net.rmnet1.dns2 2a10:50c0::ad2:ff 24 | 25 | resetprop -n net.pdpbr1.dns1 2a10:50c0::ad1:ff 26 | resetprop -n net.pdpbr1.dns2 2a10:50c0::ad2:ff 27 | 28 | resetprop -n 2a10:50c0::ad1:ff 29 | resetprop -n 2a10:50c0::ad2:ff 30 | 31 | 32 | 33 | # Edit the resolv conf file if it exist 34 | 35 | if [ -a /system/etc/resolv.conf ]; then 36 | mkdir -p $MODDIR/system/etc/ 37 | printf "nameserver 1.1.1.1\nnameserver 1.0.0.1" >> $MODDIR/system/etc/resolv.conf 38 | chmod 644 $MODDIR/system/etc/resolv.conf 39 | fi -------------------------------------------------------------------------------- /config.sh: -------------------------------------------------------------------------------- 1 | ########################################################################################## 2 | # 3 | # Magisk Module Template Config Script 4 | # by topjohnwu 5 | # 6 | ########################################################################################## 7 | ########################################################################################## 8 | # 9 | # Instructions: 10 | # 11 | # 1. Place your files into system folder (delete the placeholder file) 12 | # 2. Fill in your module's info into module.prop 13 | # 3. Configure the settings in this file (config.sh) 14 | # 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh 15 | # 5. Add your additional or modified system properties into common/system.prop 16 | # 17 | ########################################################################################## 18 | 19 | ########################################################################################## 20 | # Configs 21 | ########################################################################################## 22 | 23 | # Set to true if you need to enable Magic Mount 24 | # Most mods would like it to be enabled 25 | AUTOMOUNT=false 26 | 27 | # Set to true if you need to load system.prop 28 | PROPFILE=true 29 | 30 | # Set to true if you need post-fs-data script 31 | POSTFSDATA=false 32 | 33 | # Set to true if you need late_start service script 34 | LATESTARTSERVICE=true 35 | 36 | ########################################################################################## 37 | # Installation Message 38 | ########################################################################################## 39 | 40 | # Set what you want to show when installing your mod 41 | 42 | print_modname() { 43 | ui_print "******************************************" 44 | ui_print " AdGuardDNS4Magisk " 45 | ui_print " 2.7f " 46 | ui_print " By TukangM fork from Rom for Magisk v17+ " 47 | ui_print "******************************************" 48 | } 49 | 50 | ########################################################################################## 51 | # Replace list 52 | ########################################################################################## 53 | 54 | # List all directories you want to directly replace in the system 55 | # Check the documentations for more info about how Magic Mount works, and why you need this 56 | 57 | # This is an example 58 | REPLACE=" 59 | /system/app/Youtube 60 | /system/priv-app/SystemUI 61 | /system/priv-app/Settings 62 | /system/framework 63 | " 64 | 65 | # Construct your own list here, it will override the example above 66 | # !DO NOT! remove this if you don't need to replace anything, leave it empty as it is now 67 | REPLACE=" 68 | " 69 | 70 | ########################################################################################## 71 | # Permissions 72 | ########################################################################################## 73 | 74 | set_permissions() { 75 | # Only some special files require specific permissions 76 | # The default permissions should be good enough for most cases 77 | 78 | # Here are some examples for the set_perm functions: 79 | 80 | # set_perm_recursive (default: u:object_r:system_file:s0) 81 | # set_perm_recursive $MODPATH/system/lib 0 0 0755 0644 82 | 83 | # set_perm (default: u:object_r:system_file:s0) 84 | # set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0 85 | # set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0 86 | # set_perm $MODPATH/system/lib/libart.so 0 0 0644 87 | 88 | # The following is default permissions, DO NOT remove 89 | set_perm_recursive $MODPATH 0 0 0755 0644 90 | } 91 | 92 | ########################################################################################## 93 | # Custom Functions 94 | ########################################################################################## 95 | 96 | # This file (config.sh) will be sourced by the main flash script after util_functions.sh 97 | # If you need custom logic, please add them here as functions, and call these functions in 98 | # update-binary. Refrain from adding code directly into update-binary, as it will make it 99 | # difficult for you to migrate your modules to newer template versions. 100 | # Make update-binary as clean as possible, try to only do function calls in it. 101 | 102 | # Edit the resolv conf file if it exist 103 | resolve_conf() { 104 | mount /system 2>/dev/null 105 | 106 | if [ -a /system/etc/resolv.conf ]; then 107 | mkdir -p $MODPATH/system/etc/ 108 | printf "nameserver 94.140.14.14\nnameserver 94.140.15.15" >> $MODPATH/system/etc/resolv.conf 109 | touch $MODPATH/auto_mount 110 | fi 111 | } 112 | -------------------------------------------------------------------------------- /META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | ########################################################################################## 3 | # 4 | # Magisk Module Template Install Script 5 | # by topjohnwu 6 | # 7 | ########################################################################################## 8 | 9 | # Detect whether in boot mode 10 | ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false 11 | $BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true 12 | 13 | TMPDIR=/dev/tmp 14 | INSTALLER=$TMPDIR/install 15 | MAGISKBIN=/data/adb/magisk 16 | 17 | # Default permissions 18 | umask 022 19 | 20 | # Initial cleanup 21 | rm -rf $TMPDIR 2>/dev/null 22 | mkdir -p $INSTALLER 23 | 24 | # echo before loading util_functions 25 | ui_print() { echo "$1"; } 26 | 27 | require_new_magisk() { 28 | ui_print "*******************************" 29 | ui_print " Please install Magisk v15.0+! " 30 | ui_print "*******************************" 31 | exit 1 32 | } 33 | 34 | ########################################################################################## 35 | # Environment 36 | ########################################################################################## 37 | 38 | OUTFD=$2 39 | ZIP=$3 40 | 41 | mount /data 2>/dev/null 42 | 43 | # Utility functions must exist 44 | [ -f $MAGISKBIN/util_functions.sh ] || require_new_magisk 45 | # Load utility fuctions 46 | . $MAGISKBIN/util_functions.sh 47 | 48 | # We can't alter magisk image live, use alternative image if required 49 | $BOOTMODE && IMG=/data/adb/magisk_merge.img 50 | # Always mount under tmp 51 | MOUNTPATH=$TMPDIR/magisk_img 52 | 53 | # Preperation for flashable zips 54 | get_outfd 55 | 56 | # Mount partitions 57 | mount_partitions 58 | 59 | # Detect version and architecture 60 | api_level_arch_detect 61 | 62 | # You can get the Android API version from $API, the CPU architecture from $ARCH 63 | # Useful if you are creating Android version / platform dependent mods 64 | 65 | # Setup busybox and binaries 66 | $BOOTMODE && boot_actions || recovery_actions 67 | 68 | ########################################################################################## 69 | # Preparation 70 | ########################################################################################## 71 | 72 | # Extract common files 73 | unzip -o "$ZIP" module.prop config.sh resolv.conf 'common/*' -d $INSTALLER >&2 74 | 75 | [ ! -f $INSTALLER/config.sh ] && abort "! Unable to extract zip file!" 76 | # Load configurations 77 | . $INSTALLER/config.sh 78 | 79 | # Check the installed magisk version 80 | MIN_VER=`grep_prop minMagisk $INSTALLER/module.prop` 81 | [ ! -z $MAGISK_VER_CODE -a $MAGISK_VER_CODE -ge $MIN_VER ] || require_new_magisk 82 | MODID=`grep_prop id $INSTALLER/module.prop` 83 | MODPATH=$MOUNTPATH/$MODID 84 | 85 | # Print mod name 86 | print_modname 87 | 88 | # Please leave this message in your flashable zip for credits :) 89 | ui_print "******************************" 90 | ui_print "Powered by Magisk (@topjohnwu)" 91 | ui_print "******************************" 92 | 93 | ########################################################################################## 94 | # Install 95 | ########################################################################################## 96 | 97 | # Get the variable reqSizeM. Use your own method to determine reqSizeM if needed 98 | request_zip_size_check "$ZIP" 99 | 100 | # This function will mount $IMG to $MOUNTPATH, and resize the image based on $reqSizeM 101 | mount_magisk_img 102 | 103 | # Create mod paths 104 | rm -rf $MODPATH 2>/dev/null 105 | mkdir -p $MODPATH 106 | 107 | # Extract files to system. Use your own method if needed 108 | ui_print "- Extracting module files" 109 | unzip -o "$ZIP" 'system/*' -d $MODPATH >&2 110 | 111 | # Remove placeholder 112 | rm -f $MODPATH/system/placeholder 2>/dev/null 113 | 114 | # Handle replace folders 115 | for TARGET in $REPLACE; do 116 | mktouch $MODPATH$TARGET/.replace 117 | done 118 | 119 | # Auto Mount 120 | $AUTOMOUNT && touch $MODPATH/auto_mount 121 | 122 | # prop files 123 | $PROPFILE && cp -af $INSTALLER/common/system.prop $MODPATH/system.prop 124 | 125 | # Module info 126 | cp -af $INSTALLER/module.prop $MODPATH/module.prop 127 | if $BOOTMODE; then 128 | # Update info for Magisk Manager 129 | mktouch /sbin/.core/img/$MODID/update 130 | cp -af $INSTALLER/module.prop /sbin/.core/img/$MODID/module.prop 131 | fi 132 | 133 | # post-fs-data mode scripts 134 | $POSTFSDATA && cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh 135 | 136 | # service mode scripts 137 | $LATESTARTSERVICE && cp -af $INSTALLER/common/service.sh $MODPATH/service.sh 138 | 139 | ui_print "- Setting permissions" 140 | set_permissions 141 | 142 | ########################################################################################## 143 | # Finalizing 144 | ########################################################################################## 145 | 146 | # Unmount magisk image and shrink if possible 147 | unmount_magisk_img 148 | 149 | $BOOTMODE || recovery_cleanup 150 | rm -rf $TMPDIR 151 | 152 | ui_print "- Done" 153 | exit 0 154 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | --------------------------------------------------------------------------------