if [ -z "${WORKDIR}" ] ;
then
WORKDIR=/app
fi
echo "Updating rules ..."
TMPDIR=/tmp/lazydns
mkdir -p $TMPDIR
curl https://raw.githubusercontent.com/Loyalsoldier/geoip/release/text/cn.txt -s -o $TMPDIR/china-ip-list.txt
curl https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt -s -o $TMPDIR/reject-list.txt
curl https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt -s -o $TMPDIR/direct-list.txt
curl https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/proxy-list.txt -s -o $TMPDIR/proxy-list.txt
curl https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/apple-cn.txt -s -o $TMPDIR/apple-cn.txt
curl https://raw.githubusercontent.com/lazywalker/ghosts/refs/heads/master/hosts.mdns -s -o $TMPDIR/hosts-github.txt
cp -f $TMPDIR/*.txt $WORKDIR/
rm -rf $TMPDIR
ls -lah $WORKDIR/*.txt
echo "Update completed."