@@ -27,6 +27,8 @@ red=$(tput setaf 1)
2727green=$( tput setaf 2)
2828reset=$( tput sgr0)
2929
30+ alias curl=' "curl" --retry 5 --retry-delay 10 --retry-max-time 60 --false-start --http2 --tlsv1.2 -L'
31+
3032check_if_running_as_root () {
3133 # If you want to run as another user, please modify $UID to be owned by this user
3234 if [[ " $UID " -ne ' 0' ]]; then
@@ -170,7 +172,7 @@ judgment_parameters() {
170172
171173install_software () {
172174 COMPONENT=" $1 "
173- command -v " $COMPONENT " > /dev/null 2>&1 && return
175+ command -v " $COMPONENT " > /dev/null 2>&1 && return
174176 if ${PACKAGE_MANAGEMENT_INSTALL} " $COMPONENT " ; then
175177 echo " info: $COMPONENT is installed."
176178 else
@@ -211,7 +213,7 @@ get_version() {
211213 TMP_FILE=" $( mktemp) "
212214 install_software curl
213215 # DO NOT QUOTE THESE `${PROXY}` VARIABLES!
214- if ! " curl" ${PROXY} -sSL -H " Accept: application/vnd.github.v3+json" -o " $TMP_FILE " ' https://api.github.com/repos/v2fly/v2ray-core/releases/latest' ; then
216+ 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
215217 " rm" " $TMP_FILE "
216218 echo ' error: Failed to get release list, please check your network.'
217219 exit 1
@@ -254,12 +256,12 @@ get_version() {
254256download_v2ray () {
255257 DOWNLOAD_LINK=" https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION /v2ray-linux-$MACHINE .zip"
256258 echo " Downloading V2Ray archive: $DOWNLOAD_LINK "
257- if ! " curl" ${PROXY} -sSLR -H " Accept: application/vnd.github.v3+json " -H ' Cache-Control: no-cache' -o " $ZIP_FILE " " $DOWNLOAD_LINK " ; then
259+ if ! curl ${PROXY} -R -H ' Cache-Control: no-cache' -o " $ZIP_FILE " " $DOWNLOAD_LINK " ; then
258260 echo ' error: Download failed! Please check your network or try again.'
259261 return 1
260262 fi
261263 echo " Downloading verification file for V2Ray archive: $DOWNLOAD_LINK .dgst"
262- if ! " curl" ${PROXY} -L -H ' Cache-Control: no-cache' -o " $ZIP_FILE .dgst" " $DOWNLOAD_LINK .dgst" ; then
264+ if ! curl ${PROXY} -sSR -H ' Cache-Control: no-cache' -o " $ZIP_FILE .dgst" " $DOWNLOAD_LINK .dgst" ; then
263265 echo ' error: Download failed! Please check your network or try again.'
264266 return 1
265267 fi
@@ -312,7 +314,7 @@ install_v2ray() {
312314 # Install V2Ray configuration file to $JSON_PATH
313315 if [[ -z " $JSONS_PATH " ]] && [[ ! -d " $JSON_PATH " ]]; then
314316 install -d " $JSON_PATH "
315- echo " {}" > " ${JSON_PATH} /config.json"
317+ echo " {}" > " ${JSON_PATH} /config.json"
316318 CONFIG_NEW=' 1'
317319 fi
318320
0 commit comments