Skip to content

Commit

Permalink
qzeleza#256 единообразный вывод списка
Browse files Browse the repository at this point in the history
  • Loading branch information
AltGrF13 authored and AltGrF13 committed Dec 27, 2024
1 parent 2216d07 commit 744b670
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions opt/bin/libs/debug
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,50 @@ dnscrypt_proxy_debug() {
#
# ------------------------------------------------------------------------------------------
debug__list() {
result=$(cat < "${KVAS_LIST_FILE}" | sed 's/^\(.*\)\(#.*\)/\2/; s/^...../*****/; /^#/d; /^$/d')
echo_debug "Защищенный список /opt/etc/kvas.list (все записи)" "${result}"
if ! [ -f "${KVAS_LIST_FILE}" ] ; then
error "Не найден файл списка ${KVAS_LIST_FILE}"
return
fi

ready 'Количество записей' && when_ok "$(wc -l < ${KVAS_LIST_FILE})"

if grep -Fq 'myip2.ru' "${KVAS_LIST_FILE}" ; then
output='есть'
else
output='нет'
fi
ready 'myip2.ru' && when_ok "${output}"

if grep -Fq 'ifconfig.me' "${KVAS_LIST_FILE}" ; then
output='есть'
else
output='нет'
fi
ready 'ifconfig.me' && when_ok "${output}"

echo
local count
local output

count=$(grep -Evc -- "${IP_FILTER}" "${KVAS_LIST_FILE}")
if [ "$count" -eq 0 ]; then
output='Не используются домены.'
else
output=$(grep -Ev -- "${IP_FILTER}" "${KVAS_LIST_FILE}" | head -n 6)

count="${count}:"
fi
echo_debug "Доменов ${count}" "${output}"

count=$(grep -Ec -- "${IP_FILTER}" "${KVAS_LIST_FILE}")
if [ "$count" -eq 0 ]; then
output='Не используются IP или диапазоны.'
else
output=$(grep -E -- "${IP_FILTER}" "${KVAS_LIST_FILE}" | head -n 6)

count="${count}:"
fi
echo_debug "IP ${count}" "${output}"
}

hide_num_letters(){
Expand Down

0 comments on commit 744b670

Please sign in to comment.