Added comments

This commit is contained in:
Gusher123 2018-08-11 15:14:45 +02:00 committed by GitHub
parent 3e5c6afaee
commit e58142b4ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -216,18 +216,23 @@ gravity_DownloadBlocklistFromUrl() {
str="Status:" str="Status:"
echo -ne " ${INFO} ${str} Pending..." echo -ne " ${INFO} ${str} Pending..."
# shellcheck disable=SC2086 # Determine if the domain is blocked by Pi-hole
if [ `dig $domain +short | grep 0.0.0.0 -c` -ge 1 ]; then if [ `dig $domain +short | grep 0.0.0.0 -c` -ge 1 ]; then
# If the domain is blocked by Pi-hole, use an alternate dns server to lookup the ip adres
ip=`dig @1.1.1.1 +short $domain` ip=`dig @1.1.1.1 +short $domain`
# Determine the port to be used by curl. If "https://" is not present, port 80 is asumed
if [ `echo $url | awk -F '://' '{print $1}'` = "https" ]; then if [ `echo $url | awk -F '://' '{print $1}'` = "https" ]; then
port=443; port=443;
else else
port=80 port=80
fi fi
# Print some extra info
echo -e "${OVER} ${CROSS} ${str} ${domain} is currently blocked by pi-hole. Circumventing pi-hole and trying again"; echo -e "${OVER} ${CROSS} ${str} ${domain} is currently blocked by pi-hole. Circumventing pi-hole and trying again";
echo -ne " ${INFO} ${str} Pending..." echo -ne " ${INFO} ${str} Pending..."
# Add extra options to $cmd_ext
cmd_ext="--resolve $domain:$port:$ip $cmd_ext" cmd_ext="--resolve $domain:$port:$ip $cmd_ext"
fi fi
# shellcheck disable=SC2086
httpCode=$(curl -s -L ${cmd_ext} ${heisenbergCompensator} -w "%{http_code}" -A "${agent}" "${url}" -o "${patternBuffer}" 2> /dev/null) httpCode=$(curl -s -L ${cmd_ext} ${heisenbergCompensator} -w "%{http_code}" -A "${agent}" "${url}" -o "${patternBuffer}" 2> /dev/null)
case $url in case $url in