Skip to content

Commit

Permalink
refactor: revert dns server add logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kuoruan committed May 29, 2020
1 parent 7975dfc commit fdf8a0d
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions public/root/etc/init.d/v2ray
Original file line number Diff line number Diff line change
Expand Up @@ -742,38 +742,42 @@ add_dns_settings() {
continue
fi

json_add_object ""
json_add_string "address" "$address"

if [ -n "$port" ] ; then
json_add_int "port" "$port"
if [ -z "${port}${domains}${expect_ips}" ] ; then
json_add_string "" "$address"
else
json_add_int "port" "53"
fi
json_add_object ""
json_add_string "address" "$address"

if [ -n "$domains" ] ; then
json_add_array "domains"
if [ -n "$port" ] ; then
json_add_int "port" "$port"
else
json_add_int "port" "53"
fi

local d
for d in $domains ; do
json_add_string "" "$d"
done
if [ -n "$domains" ] ; then
json_add_array "domains"

json_close_array # domains
fi
local d
for d in $domains ; do
json_add_string "" "$d"
done

if [ -n "$expect_ips" ] ; then
json_add_array "expectIPs"
json_close_array # domains
fi

local e
for e in $expect_ips ; do
json_add_string "" "$e"
done
if [ -n "$expect_ips" ] ; then
json_add_array "expectIPs"

json_close_array # expectIPs
fi
local e
for e in $expect_ips ; do
json_add_string "" "$e"
done

json_close_object
json_close_array # expectIPs
fi

json_close_object
fi
fi
done

Expand Down

0 comments on commit fdf8a0d

Please sign in to comment.