mirror of https://github.com/dnomd343/ClearDNS
dnomd343
4 years ago
8 changed files with 124 additions and 91 deletions
@ -1,17 +1,12 @@ |
|||||
FROM alpine as tools |
FROM alpine as asset |
||||
COPY . /tmp/cleardns |
COPY ./asset.sh / |
||||
RUN apk --update add --no-cache curl wget && \ |
RUN apk --update add --no-cache curl wget && \ |
||||
sh /tmp/cleardns/tools.sh |
sh /asset.sh |
||||
|
|
||||
FROM alpine |
FROM alpine |
||||
COPY . /tmp/cleardns |
COPY ./init.sh / |
||||
COPY --from=tools /tmp/tools/ /usr/bin/ |
COPY ./overture /etc/overture/ |
||||
RUN mv /tmp/cleardns/overture/ /etc/ && \ |
COPY --from=asset /tmp/asset/ /usr/bin/ |
||||
mv /tmp/cleardns/smartdns/ /etc/ && \ |
RUN mkdir -p /etc/cleardns && \ |
||||
mkdir -p /opt/AdGuardHome && \ |
sed -i '$i\0\t2\t*\t*\t*\t/etc/overture/update.sh' /var/spool/cron/crontabs/root |
||||
mkdir -p /etc/smartdns/expose && \ |
|
||||
mkdir /etc/cleardns && \ |
|
||||
mv /tmp/cleardns/init.sh / && \ |
|
||||
rm -rf /tmp/cleardns && \ |
|
||||
sed -i '$i\0\t0\t*\t*\t*\t/etc/overture/update.sh' /var/spool/cron/crontabs/root |
|
||||
CMD ["sh","/init.sh"] |
CMD ["sh","/init.sh"] |
||||
|
@ -0,0 +1,81 @@ |
|||||
|
get_github_latest_version() { |
||||
|
VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); |
||||
|
} |
||||
|
|
||||
|
get_architecture() { |
||||
|
case "$(uname -m)" in |
||||
|
'i386' | 'i686') |
||||
|
MACHINE='i386' |
||||
|
;; |
||||
|
'amd64' | 'x86_64') |
||||
|
MACHINE='amd64' |
||||
|
;; |
||||
|
'armv7' | 'armv7l') |
||||
|
MACHINE='arm' |
||||
|
;; |
||||
|
'armv8' | 'aarch64') |
||||
|
MACHINE='arm64' |
||||
|
;; |
||||
|
*) |
||||
|
echo "The architecture is not supported." |
||||
|
exit 1 |
||||
|
;; |
||||
|
esac |
||||
|
} |
||||
|
|
||||
|
ASSET_DIR="/tmp/asset" |
||||
|
PKG_DIR="$ASSET_DIR/pkg" |
||||
|
mkdir -p $PKG_DIR |
||||
|
|
||||
|
get_architecture |
||||
|
case "$MACHINE" in |
||||
|
'i386') |
||||
|
AGH_PKG_NAME="AdGuardHome_linux_386.tar.gz" |
||||
|
OVERTURE_FILE_NAME="overture-linux-386" |
||||
|
OVERTURE_PKG_NAME="$OVERTURE_FILE_NAME.zip" |
||||
|
DNSPROXY_FOLDER_NAME="linux-386" |
||||
|
DNSPROXY_PKG_PREFIX="dnsproxy-$DNSPROXY_FOLDER_NAME-" |
||||
|
;; |
||||
|
'amd64') |
||||
|
AGH_PKG_NAME="AdGuardHome_linux_amd64.tar.gz" |
||||
|
OVERTURE_FILE_NAME="overture-linux-amd64" |
||||
|
OVERTURE_PKG_NAME="$OVERTURE_FILE_NAME.zip" |
||||
|
DNSPROXY_FOLDER_NAME="linux-amd64" |
||||
|
DNSPROXY_PKG_PREFIX="dnsproxy-$DNSPROXY_FOLDER_NAME-" |
||||
|
;; |
||||
|
'arm') |
||||
|
AGH_PKG_NAME="AdGuardHome_linux_armv7.tar.gz" |
||||
|
OVERTURE_FILE_NAME="overture-linux-arm" |
||||
|
OVERTURE_PKG_NAME="$OVERTURE_FILE_NAME.zip" |
||||
|
DNSPROXY_FOLDER_NAME="linux-arm6" |
||||
|
DNSPROXY_PKG_PREFIX="dnsproxy-$DNSPROXY_FOLDER_NAME-" |
||||
|
;; |
||||
|
'arm64') |
||||
|
AGH_PKG_NAME="AdGuardHome_linux_arm64.tar.gz" |
||||
|
OVERTURE_FILE_NAME="overture-linux-arm64" |
||||
|
OVERTURE_PKG_NAME="$OVERTURE_FILE_NAME.zip" |
||||
|
DNSPROXY_FOLDER_NAME="linux-arm64" |
||||
|
DNSPROXY_PKG_PREFIX="dnsproxy-$DNSPROXY_FOLDER_NAME-" |
||||
|
;; |
||||
|
*) |
||||
|
exit 1 |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
get_github_latest_version "AdguardTeam/AdGuardHome" |
||||
|
wget -P $PKG_DIR "https://github.com/AdguardTeam/AdGuardHome/releases/download/$VERSION/$AGH_PKG_NAME" |
||||
|
tar xf $PKG_DIR/$AGH_PKG_NAME -C $PKG_DIR |
||||
|
mv $PKG_DIR/AdGuardHome/AdGuardHome $ASSET_DIR/ |
||||
|
|
||||
|
get_github_latest_version "shawn1m/overture" |
||||
|
wget -P $PKG_DIR "https://github.com/shawn1m/overture/releases/download/$VERSION/$OVERTURE_PKG_NAME" |
||||
|
unzip $PKG_DIR/$OVERTURE_PKG_NAME -d $PKG_DIR |
||||
|
mv $PKG_DIR/$OVERTURE_FILE_NAME $ASSET_DIR/overture |
||||
|
|
||||
|
get_github_latest_version "AdguardTeam/dnsproxy" |
||||
|
DNSPROXY_PKG_NAME="$DNSPROXY_PKG_PREFIX$VERSION.tar.gz" |
||||
|
wget -P $PKG_DIR "https://github.com/AdguardTeam/dnsproxy/releases/download/$VERSION/$DNSPROXY_PKG_NAME" |
||||
|
tar xf $PKG_DIR/$DNSPROXY_PKG_NAME -C $PKG_DIR |
||||
|
mv $PKG_DIR/$DNSPROXY_FOLDER_NAME/dnsproxy $ASSET_DIR |
||||
|
|
||||
|
rm -rf $PKG_DIR |
@ -1,8 +1,26 @@ |
|||||
[ ! -s "/etc/cleardns/custom.sh" ] && touch /etc/cleardns/custom.sh |
[ -f "/etc/cleardns/custom.sh" ] && sh /etc/cleardns/custom.sh |
||||
sh /etc/cleardns/custom.sh |
|
||||
sh /etc/smartdns/load.sh |
mkdir -p /etc/cleardns/list |
||||
|
mkdir -p /etc/cleardns/upstream |
||||
|
mkdir -p /etc/cleardns/AdGuardHome |
||||
|
|
||||
|
[ ! -s "/etc/cleardns/upstream/domestic.conf" ] && echo -e "223.5.5.5\n119.29.29.29\n114.114.114.114" > /etc/cleardns/upstream/domestic.conf |
||||
|
[ ! -s "/etc/cleardns/upstream/foreign.conf" ] && echo -e "8.8.4.4\n8.8.8.8" > /etc/cleardns/upstream/foreign.conf |
||||
|
|
||||
|
cmd="dnsproxy -p 4053" |
||||
|
while read -r raw |
||||
|
do |
||||
|
cmd="$cmd -u $raw" |
||||
|
done < /etc/cleardns/upstream/domestic.conf |
||||
|
eval "$cmd --cache --all-servers > /dev/null 2>&1 &" |
||||
|
|
||||
|
cmd="dnsproxy -p 6053" |
||||
|
while read -r raw |
||||
|
do |
||||
|
cmd="$cmd -u $raw" |
||||
|
done < /etc/cleardns/upstream/foreign.conf |
||||
|
eval "$cmd --cache --all-servers > /dev/null 2>&1 &" |
||||
|
|
||||
sh /etc/overture/update.sh |
sh /etc/overture/update.sh |
||||
/usr/sbin/crond |
/usr/sbin/crond |
||||
smartdns -c /etc/smartdns/config.conf |
/usr/bin/AdGuardHome -p 80 -w /etc/cleardns/AdGuardHome |
||||
overture -c /etc/overture/config.yml > /dev/null 2>&1 & |
|
||||
/usr/bin/AdGuardHome -w /opt/AdGuardHome |
|
||||
|
@ -1,14 +1,14 @@ |
|||||
OVERTURE_DIR="/etc/overture" |
LIST_DIR="/etc/cleardns/list" |
||||
TEMP_DIR="$OVERTURE_DIR/list/temp" |
TEMP_DIR="$LIST_DIR/temp" |
||||
[ -f "$OVERTURE_DIR/list/no_auto_update" ] && exit |
[ -f "$LIST_DIR/no_auto_update" ] && exit |
||||
rm -rf $TEMP_DIR |
rm -rf $TEMP_DIR |
||||
mkdir -p $TEMP_DIR |
mkdir -p $TEMP_DIR |
||||
wget -P $TEMP_DIR https://res.343.re/Share/chinalist/chinalist.txt |
wget -P $TEMP_DIR https://res.343.re/Share/chinalist/chinalist.txt |
||||
wget -P $TEMP_DIR https://res.343.re/Share/gfwlist/gfwlist.txt |
wget -P $TEMP_DIR https://res.343.re/Share/gfwlist/gfwlist.txt |
||||
wget -P $TEMP_DIR https://raw.fastgit.org/17mon/china_ip_list/master/china_ip_list.txt |
wget -P $TEMP_DIR https://raw.fastgit.org/17mon/china_ip_list/master/china_ip_list.txt |
||||
[ -s "$TEMP_DIR/chinalist.txt" ] && mv -f $TEMP_DIR/chinalist.txt $OVERTURE_DIR/list/ |
[ -s "$TEMP_DIR/chinalist.txt" ] && mv -f $TEMP_DIR/chinalist.txt $LIST_DIR/ |
||||
[ -s "$TEMP_DIR/gfwlist.txt" ] && mv -f $TEMP_DIR/gfwlist.txt $OVERTURE_DIR/list/ |
[ -s "$TEMP_DIR/gfwlist.txt" ] && mv -f $TEMP_DIR/gfwlist.txt $LIST_DIR/ |
||||
[ -s "$TEMP_DIR/china_ip_list.txt" ] && mv -f $TEMP_DIR/china_ip_list.txt $OVERTURE_DIR/list/ |
[ -s "$TEMP_DIR/china_ip_list.txt" ] && mv -f $TEMP_DIR/china_ip_list.txt $LIST_DIR/ |
||||
rm -rf $TEMP_DIR |
rm -rf $TEMP_DIR |
||||
ps -ef | grep overture | grep -v grep | grep -v sh | awk '{print $1}' | xargs kill -9 |
ps -ef | grep overture | grep -v grep | grep -v sh | awk '{print $1}' | xargs kill -9 |
||||
overture -c /etc/overture/config.yml > /dev/null 2>&1 & |
/usr/bin/overture -c /etc/overture/config.yml > /dev/null 2>&1 & |
||||
|
@ -1,8 +0,0 @@ |
|||||
bind :4053 |
|
||||
bind-tcp :4053 |
|
||||
bind :6053 -group foreign |
|
||||
bind-tcp :6053 -group foreign |
|
||||
log-level info |
|
||||
cache-size 65535 |
|
||||
log-size 32MB |
|
||||
log-file /etc/smartdns/expose/smartdns.log |
|
@ -1,27 +0,0 @@ |
|||||
load_domestic(){ |
|
||||
cat>/etc/smartdns/expose/domestic.conf<<EOF |
|
||||
server 223.5.5.5 |
|
||||
server 223.6.6.6 |
|
||||
server 119.29.29.29 |
|
||||
server 119.28.28.28 |
|
||||
server 114.114.114.114 |
|
||||
server 114.114.115.115 |
|
||||
EOF |
|
||||
} |
|
||||
|
|
||||
load_foreign(){ |
|
||||
cat>/etc/smartdns/expose/foreign.conf<<EOF |
|
||||
server-tls 223.5.5.5:853 |
|
||||
server-https https://doh.pub/dns-query |
|
||||
EOF |
|
||||
} |
|
||||
|
|
||||
mkdir -p /etc/smartdns/expose/ |
|
||||
[ ! -s "/etc/smartdns/expose/domestic.conf" ] && load_domestic |
|
||||
[ ! -s "/etc/smartdns/expose/foreign.conf" ] && load_foreign |
|
||||
cat /etc/smartdns/base.conf > /etc/smartdns/config.conf |
|
||||
cat /etc/smartdns/expose/domestic.conf >> /etc/smartdns/config.conf |
|
||||
while read -r raw |
|
||||
do |
|
||||
echo "$raw -group foreign -exclude-default-group" >> /etc/smartdns/config.conf |
|
||||
done < /etc/smartdns/expose/foreign.conf |
|
@ -1,26 +0,0 @@ |
|||||
get_github_latest_version() { |
|
||||
VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); |
|
||||
} |
|
||||
|
|
||||
TARGET_DIR="/tmp/tools" |
|
||||
mkdir -p $TARGET_DIR |
|
||||
|
|
||||
get_github_latest_version "AdguardTeam/AdGuardHome" |
|
||||
wget -P /tmp/tools "https://hub.fastgit.org/AdguardTeam/AdGuardHome/releases/download/$VERSION/AdGuardHome_linux_arm64.tar.gz" |
|
||||
get_github_latest_version "shawn1m/overture" |
|
||||
wget -P /tmp/tools "https://hub.fastgit.org/shawn1m/overture/releases/download/$VERSION/overture-linux-arm64.zip" |
|
||||
get_github_latest_version "pymumu/smartdns" |
|
||||
wget -P /tmp/tools "https://hub.fastgit.org/pymumu/smartdns/releases/download/$VERSION/smartdns-aarch64" |
|
||||
|
|
||||
mkdir $TARGET_DIR/AdGuard |
|
||||
tar xf $TARGET_DIR/AdGuardHome_linux_arm64.tar.gz -C $TARGET_DIR/AdGuard |
|
||||
unzip $TARGET_DIR/overture-linux-arm64.zip -d $TARGET_DIR/overture |
|
||||
mv $TARGET_DIR/AdGuard/AdGuardHome/AdGuardHome $TARGET_DIR/AdGuardHome |
|
||||
mv $TARGET_DIR/overture/overture-linux-arm64 $TARGET_DIR/overture-linux-arm64 |
|
||||
rm -rf $TARGET_DIR/AdGuard |
|
||||
rm -rf $TARGET_DIR/overture |
|
||||
mv $TARGET_DIR/overture-linux-arm64 $TARGET_DIR/overture |
|
||||
mv $TARGET_DIR/smartdns-aarch64 $TARGET_DIR/smartdns |
|
||||
chmod +x $TARGET_DIR/smartdns |
|
||||
rm -f $TARGET_DIR/AdGuardHome_linux_arm64.tar.gz |
|
||||
rm -f $TARGET_DIR/overture-linux-arm64.zip |
|
Loading…
Reference in new issue