Skip to content

Commit

Permalink
qzeleza#222 получение IP в обёртке
Browse files Browse the repository at this point in the history
  • Loading branch information
AltGrF13 authored and AltGrF13 committed Dec 12, 2024
1 parent 6553565 commit 061d0e8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions opt/bin/libs/main
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,21 @@ is_dns_server_online(){
DNS_ENABLE=false
DNS_DEFAULT=''

dns__get_ips_by_domain() {
if [ -z "${1}" ]; then
error "[${FUNCNAME}] Не передан обязательный параметр — имя домена"
return
fi
local host=${1}

get_iplist_from_domain "${host}" | grep -Eo "${IP_FILTER}" | grep -v '0.0.0.0'
}

add_host_by_iplist_to_ipset() {
# удаление * если есть
host=${1//\*/}

# получаем список из адресов от текущего dns сервера
# и исключаем из списка адреса типа 0.0.0.0
ip_list=$(get_iplist_from_domain "${host}" \
| grep -Eo "${IP_FILTER}" \
| grep -v '0.0.0.0' )

local ip_list=$( dns__get_ips_by_domain "${host}" )
if [ -z "${ip_list}" ]; then
return
fi
Expand Down

0 comments on commit 061d0e8

Please sign in to comment.