@@ -171,11 +171,10 @@ judgment_parameters() {
171
171
break
172
172
;;
173
173
' -p' | ' --proxy' )
174
- if ! echo " ${2:? undefine var} " | grep -qEo ' ^(https?|socks4a?|socks5h?):\/\/' ; then
175
- echo ' error: Please specify the correct proxy server address.'
174
+ if [[ -z " ${2:? error: Please specify the proxy server address.} " ]]; then
176
175
exit 1
177
176
fi
178
- PROXY=" -x $2 "
177
+ PROXY=" $2 "
179
178
shift
180
179
;;
181
180
* )
@@ -229,8 +228,7 @@ get_version() {
229
228
fi
230
229
# Get V2Ray release version number
231
230
TMP_FILE=" $( mktemp) "
232
- # DO NOT QUOTE THESE `${PROXY}` VARIABLES!
233
- if ! curl ${PROXY} -sS -H " Accept: application/vnd.github.v3+json" -o " $TMP_FILE " ' https://api.github.com/repos/v2fly/v2ray-core/releases/latest' ; then
231
+ if ! curl -x " ${PROXY} " -sS -H " Accept: application/vnd.github.v3+json" -o " $TMP_FILE " ' https://api.github.com/repos/v2fly/v2ray-core/releases/latest' ; then
234
232
" rm" " $TMP_FILE "
235
233
echo ' error: Failed to get release list, please check your network.'
236
234
exit 1
@@ -273,12 +271,12 @@ get_version() {
273
271
download_v2ray () {
274
272
DOWNLOAD_LINK=" https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION /v2ray-linux-$MACHINE .zip"
275
273
echo " Downloading V2Ray archive: $DOWNLOAD_LINK "
276
- if ! curl ${PROXY} -R -H ' Cache-Control: no-cache' -o " $ZIP_FILE " " $DOWNLOAD_LINK " ; then
274
+ if ! curl -x " ${PROXY} " -R -H ' Cache-Control: no-cache' -o " $ZIP_FILE " " $DOWNLOAD_LINK " ; then
277
275
echo ' error: Download failed! Please check your network or try again.'
278
276
return 1
279
277
fi
280
278
echo " Downloading verification file for V2Ray archive: $DOWNLOAD_LINK .dgst"
281
- if ! curl ${PROXY} -sSR -H ' Cache-Control: no-cache' -o " $ZIP_FILE .dgst" " $DOWNLOAD_LINK .dgst" ; then
279
+ if ! curl -x " ${PROXY} " -sSR -H ' Cache-Control: no-cache' -o " $ZIP_FILE .dgst" " $DOWNLOAD_LINK .dgst" ; then
282
280
echo ' error: Download failed! Please check your network or try again.'
283
281
return 1
284
282
fi
0 commit comments