11#! /usr/bin/env bash
22
33# 当前脚本版本号
4- VERSION=' v1.2.17 (2025.05.19 )'
4+ VERSION=' v1.2.17 (2025.07.12 )'
55
66# 各变量默认值
7- GH_PROXY=' https://ghfast.top /'
7+ GH_PROXY=' gh-proxy.com /'
88TEMP_DIR=' /tmp/sing-box'
99WORK_DIR=' /etc/sing-box'
1010START_PORT_DEFAULT=' 8881'
@@ -263,7 +263,7 @@ text() { grep -q '\$' <<< "${E[$*]}" && eval echo "\$(eval echo "\${${L}[$*]}")"
263263
264264# 检测是否需要启用 Github CDN,如能直接连通,则不使用
265265check_cdn () {
266- [ -n " $GH_PROXY " ] && wget --server-response --quiet --output-document=/dev/null --no-check-certificate --tries=2 --timeout=3 https://raw.githubusercontent.com/fscarmen/sing-box/main/README.md > /dev/null 2>&1 && unset GH_PROXY
266+ [ -n " $GH_PROXY " ] && wget --server-response --quiet --output-document=/dev/null --no-check-certificate --tries=2 --timeout=3 https://${GH_PROXY} raw.githubusercontent.com/fscarmen/sing-box/main/README.md > /dev/null 2>&1 || unset GH_PROXY
267267}
268268
269269# 检测是否解锁 chatGPT,以决定是否使用 warp 链式代理或者是 direct out,此处判断改编自 https://github.com/lmc999/RegionRestrictionCheck
@@ -302,7 +302,7 @@ statistics_of_run-times() {
302302 local UPDATE_OR_GET=$1
303303 local SCRIPT=$2
304304 if grep -q ' update' <<< " $UPDATE_OR_GET" ; then
305- { wget -qO- --timeout=3 " https ://stat-api.netlify.app /updateStats?script=${SCRIPT} " > $TEMP_DIR /statistics 2> /dev/null || true ; }&
305+ { wget --no-check-certificate - qO- --timeout=3 " http ://stat.cloudflare.now.cc:4000/api /updateStats?script=${SCRIPT} " > $TEMP_DIR /statistics 2> /dev/null || true ; }&
306306 elif grep -q ' get' <<< " $UPDATE_OR_GET" ; then
307307 [ -s $TEMP_DIR /statistics ] && [[ $( cat $TEMP_DIR /statistics) =~ \" todayCount\" :([0-9]+),\" totalCount\" :([0-9]+) ]] && local TODAY=" ${BASH_REMATCH[1]} " && local TOTAL=" ${BASH_REMATCH[2]} " && rm -f $TEMP_DIR /statistics
308308 hint " \n*******************************************\n\n $( text 55) \n"
@@ -641,10 +641,10 @@ check_install() {
641641 {
642642 # 获取需要下载的 sing-box 版本
643643 local ONLINE=$( get_sing_box_version)
644- wget --no-check-certificate --continue ${GH_PROXY} https://github.com/SagerNet/sing-box/releases/download/v$ONLINE /sing-box-$ONLINE -linux-$SING_BOX_ARCH .tar.gz -qO- | tar xz -C $TEMP_DIR sing-box-$ONLINE -linux-$SING_BOX_ARCH /sing-box > /dev/null 2>&1
644+ wget --no-check-certificate --continue https://${GH_PROXY} github.com/SagerNet/sing-box/releases/download/v$ONLINE /sing-box-$ONLINE -linux-$SING_BOX_ARCH .tar.gz -qO- | tar xz -C $TEMP_DIR sing-box-$ONLINE -linux-$SING_BOX_ARCH /sing-box > /dev/null 2>&1
645645 [ -s $TEMP_DIR /sing-box-$ONLINE -linux-$SING_BOX_ARCH /sing-box ] && mv $TEMP_DIR /sing-box-$ONLINE -linux-$SING_BOX_ARCH /sing-box $TEMP_DIR
646- wget --no-check-certificate --continue -qO $TEMP_DIR /jq ${GH_PROXY} https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-$JQ_ARCH > /dev/null 2>&1 && chmod +x $TEMP_DIR /jq > /dev/null 2>&1
647- wget --no-check-certificate --continue -qO $TEMP_DIR /qrencode ${GH_PROXY} https://github.com/fscarmen/client_template/raw/main/qrencode-go/qrencode-go-linux-$QRENCODE_ARCH > /dev/null 2>&1 && chmod +x $TEMP_DIR /qrencode > /dev/null 2>&1
646+ wget --no-check-certificate --continue -qO $TEMP_DIR /jq https://${GH_PROXY} github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-$JQ_ARCH > /dev/null 2>&1 && chmod +x $TEMP_DIR /jq > /dev/null 2>&1
647+ wget --no-check-certificate --continue -qO $TEMP_DIR /qrencode https://${GH_PROXY} github.com/fscarmen/client_template/raw/main/qrencode-go/qrencode-go-linux-$QRENCODE_ARCH > /dev/null 2>&1 && chmod +x $TEMP_DIR /qrencode > /dev/null 2>&1
648648 }&
649649 fi
650650
@@ -681,7 +681,7 @@ check_install() {
681681 fi
682682
683683 # 下载 cloudflared 如果需要
684- [[ " ${STATUS[1]} " = " $( text 26) " || " $NONINTERACTIVE_INSTALL " = ' noninteractive_install' ]] && [ ! -s ${WORK_DIR} /cloudflared ] && { wget --no-check-certificate -qO $TEMP_DIR /cloudflared ${GH_PROXY} https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-$ARGO_ARCH > /dev/null 2>&1 && chmod +x $TEMP_DIR /cloudflared > /dev/null 2>&1 ; }&
684+ [[ " ${STATUS[1]} " = " $( text 26) " || " $NONINTERACTIVE_INSTALL " = ' noninteractive_install' ]] && [ ! -s ${WORK_DIR} /cloudflared ] && { wget --no-check-certificate -qO $TEMP_DIR /cloudflared https://${GH_PROXY} github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-$ARGO_ARCH > /dev/null 2>&1 && chmod +x $TEMP_DIR /cloudflared > /dev/null 2>&1 ; }&
685685}
686686
687687# 为了适配 alpine,定义 cmd_systemctl 的函数
@@ -792,15 +792,15 @@ check_system_info() {
792792# 获取 sing-box 最新版本
793793get_sing_box_version () {
794794 # FORCE_VERSION 用于在 sing-box 某个主程序出现 bug 时,强制为指定版本,以防止运行出错
795- local FORCE_VERSION=$( wget --no-check-certificate --tries=2 --timeout=3 -qO- ${GH_PROXY} https://raw.githubusercontent.com/fscarmen/sing-box/refs/heads/main/force_version | sed ' s/^[vV]//g; s/\r//g' )
795+ local FORCE_VERSION=$( wget --no-check-certificate --tries=2 --timeout=3 -qO- https://${GH_PROXY} raw.githubusercontent.com/fscarmen/sing-box/refs/heads/main/force_version | sed ' s/^[vV]//g; s/\r//g' )
796796 if grep -q ' .' <<< " $FORCE_VERSION" ; then
797797 local RESULT_VERSION=" $FORCE_VERSION "
798798 else
799799 # 先判断 github api 返回 http 状态码是否为 200,有时候 IP 会被限制,导致获取不到最新版本
800- local API_RESPONSE=$( wget --no-check-certificate --server-response --tries=2 --timeout=3 -qO- " ${GH_PROXY} https://api.github.com/repos/SagerNet/sing-box/releases" 2>&1 | grep -E ' ^[ ]+HTTP/|tag_name' )
800+ local API_RESPONSE=$( wget --no-check-certificate --server-response --tries=2 --timeout=3 -qO- " https://${GH_PROXY} api.github.com/repos/SagerNet/sing-box/releases" 2>&1 | grep -E ' ^[ ]+HTTP/|tag_name' )
801801 if grep -q ' HTTP.* 200' <<< " $API_RESPONSE" ; then
802802 local VERSION_LATEST=$( awk -F ' ["v-]' ' /tag_name/{print $5}' <<< " $API_RESPONSE" | sort -Vr | sed -n ' 1p' )
803- local RESULT_VERSION=$( wget --no-check-certificate --tries=2 --timeout=3 -qO- ${GH_PROXY} https://api.github.com/repos/SagerNet/sing-box/releases | awk -F ' ["v]' -v var=" tag_name.*$VERSION_LATEST " ' $0 ~ var {print $5; exit}' )
803+ local RESULT_VERSION=$( wget --no-check-certificate --tries=2 --timeout=3 -qO- https://${GH_PROXY} api.github.com/repos/SagerNet/sing-box/releases | awk -F ' ["v]' -v var=" tag_name.*$VERSION_LATEST " ' $0 ~ var {print $5; exit}' )
804804 else
805805 local RESULT_VERSION=" $DEFAULT_NEWEST_VERSION "
806806 fi
@@ -3274,7 +3274,7 @@ version() {
32743274
32753275 if [ " ${UPDATE,,} " = ' y' ]; then
32763276 check_system_info
3277- wget --no-check-certificate --continue ${GH_PROXY} https://github.com/SagerNet/sing-box/releases/download/v$ONLINE /sing-box-$ONLINE -linux-$SING_BOX_ARCH .tar.gz -qO- | tar xz -C $TEMP_DIR sing-box-$ONLINE -linux-$SING_BOX_ARCH /sing-box
3277+ wget --no-check-certificate --continue https://${GH_PROXY} github.com/SagerNet/sing-box/releases/download/v$ONLINE /sing-box-$ONLINE -linux-$SING_BOX_ARCH .tar.gz -qO- | tar xz -C $TEMP_DIR sing-box-$ONLINE -linux-$SING_BOX_ARCH /sing-box
32783278
32793279 if [ -s $TEMP_DIR /sing-box-$ONLINE -linux-$SING_BOX_ARCH /sing-box ]; then
32803280 cmd_systemctl disable sing-box
@@ -3381,11 +3381,11 @@ menu_setting() {
33813381 ACTION[4] () { change_argo; exit ; }
33823382 ACTION[5] () { change_start_port; exit ; }
33833383 ACTION[6] () { version; exit ; }
3384- ACTION[7] () { bash <( wget --no-check-certificate -qO- ${GH_PROXY} https://raw.githubusercontent.com/ylx2016/Linux-NetSpeed/master/tcp.sh) ; exit ; }
3384+ ACTION[7] () { bash <( wget --no-check-certificate -qO- https://${GH_PROXY} raw.githubusercontent.com/ylx2016/Linux-NetSpeed/master/tcp.sh) ; exit ; }
33853385 ACTION[8] () { change_protocols; exit ; }
33863386 ACTION[9] () { uninstall; exit ; }
3387- ACTION[10] () { bash <( wget --no-check-certificate -qO- ${GH_PROXY} https://raw.githubusercontent.com/fscarmen/argox/main/argox.sh) -$L ; exit ; }
3388- ACTION[11] () { bash <( wget --no-check-certificate -qO- ${GH_PROXY} https://raw.githubusercontent.com/fscarmen/sba/main/sba.sh) -$L ; exit ; }
3387+ ACTION[10] () { bash <( wget --no-check-certificate -qO- https://${GH_PROXY} raw.githubusercontent.com/fscarmen/argox/main/argox.sh) -$L ; exit ; }
3388+ ACTION[11] () { bash <( wget --no-check-certificate -qO- https://${GH_PROXY} raw.githubusercontent.com/fscarmen/sba/main/sba.sh) -$L ; exit ; }
33893389 ACTION[12] () { bash <( wget --no-check-certificate -qO- https://tcp.hy2.sh/) ; exit ; }
33903390 else
33913391 OPTION[1]=" 1. $( text 34) + Argo + $( text 80) $( text 89) "
@@ -3401,10 +3401,10 @@ menu_setting() {
34013401 ACTION[2] () { IS_SUB=no_sub; IS_ARGO=is_argo; install_sing-box; export_list install; create_shortcut; exit ; }
34023402 ACTION[3] () { IS_SUB=is_sub; IS_ARGO=no_argo; install_sing-box; export_list install; create_shortcut; exit ; }
34033403 ACTION[4] () { install_sing-box; export_list install; create_shortcut; exit ; }
3404- ACTION[5] () { bash <( wget --no-check-certificate -qO- ${GH_PROXY} https://raw.githubusercontent.com/ylx2016/Linux-NetSpeed/master/tcp.sh) ; exit ; }
3405- ACTION[6] () { bash <( wget --no-check-certificate -qO- ${GH_PROXY} https://raw.githubusercontent.com/fscarmen/argox/main/argox.sh) -$L ; exit ; }
3406- ACTION[7] () { bash <( wget --no-check-certificate -qO- ${GH_PROXY} https://raw.githubusercontent.com/fscarmen/sba/main/sba.sh) -$L ; exit ; }
3407- ACTION[8] () { bash <( wget --no-check-certificate -qO- ${GH_PROXY} https://tcp.hy2.sh/) ; exit ; }
3404+ ACTION[5] () { bash <( wget --no-check-certificate -qO- https://${GH_PROXY} raw.githubusercontent.com/ylx2016/Linux-NetSpeed/master/tcp.sh) ; exit ; }
3405+ ACTION[6] () { bash <( wget --no-check-certificate -qO- https://${GH_PROXY} raw.githubusercontent.com/fscarmen/argox/main/argox.sh) -$L ; exit ; }
3406+ ACTION[7] () { bash <( wget --no-check-certificate -qO- https://${GH_PROXY} raw.githubusercontent.com/fscarmen/sba/main/sba.sh) -$L ; exit ; }
3407+ ACTION[8] () { bash <( wget --no-check-certificate -qO- https://${GH_PROXY} tcp.hy2.sh/) ; exit ; }
34083408 fi
34093409
34103410 [ " ${# OPTION[@]} " -ge ' 10' ] && OPTION[0]=" 0 . $( text 35) " || OPTION[0]=" 0. $( text 35) "
@@ -3508,7 +3508,7 @@ for z in ${!ALL_PARAMETER[@]}; do
35083508 check_arch; version; exit 0
35093509 ;;
35103510 -B )
3511- bash <( wget --no-check-certificate -qO- ${GH_PROXY} https://raw.githubusercontent.com/ylx2016/Linux-NetSpeed/master/tcp.sh) ; exit
3511+ bash <( wget --no-check-certificate -qO- https://${GH_PROXY} raw.githubusercontent.com/ylx2016/Linux-NetSpeed/master/tcp.sh) ; exit
35123512 ;;
35133513 -R )
35143514 change_protocols; exit 0
0 commit comments