Skip to content

Commit

Permalink
feat: auto add server ip to direct list when custom config file used
Browse files Browse the repository at this point in the history
  • Loading branch information
kuoruan committed Nov 23, 2019
1 parent 240c5b7 commit d531646
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions root/etc/init.d/v2ray
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,23 @@ start_instance() {
return 1
fi

local file_content="$(cat "$config_file")"
local config_commands="$(get_commands_from_json "$file_content")"

local addr

for addr in $(echo "$config_commands" | sed -n "s/^json.*'address'[[:space:]]'\([^']*\)'.*/\1/p") ; do
local ipv4
for ipv4 in $(resolveip -4 -t 5 "$addr") ; do
append_server_ipv4 "$ipv4"
done

local ipv6
for ipv6 in $(resolveip -6 -t 5 "$addr") ; do
append_server_ipv6 "$ipv6"
done
done

temp_config="$config_file"
else
test -d "$CONFIG_FOLDER" || mkdir -p "$CONFIG_FOLDER"
Expand Down

0 comments on commit d531646

Please sign in to comment.