From 343843f0cbb51a43c914cfcde30a5c14d9678e1b Mon Sep 17 00:00:00 2001 From: Samuel Huang Date: Wed, 25 Sep 2024 21:47:30 +1000 Subject: [PATCH] Fixing default routing issue --- run.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/run.sh b/run.sh index b9b6b5d..92b77ea 100755 --- a/run.sh +++ b/run.sh @@ -153,13 +153,12 @@ done if [ -z "${PXCMD}" ]; then >&2 echo -e "Missing Xray connection option.\n"; usage; exit 1; fi -# Init root config -Jroot='{"outbounds":[{"tag":"direct","protocol":"freedom"},{"tag":"blocked","protocol":"blackhole"}]}' - # Add outbounds config Joutbound=`$PXCMD` if [ $? != 0 ]; then >&2 echo -e "${subcmd} Config failed: $PXCMD\n"; exit 2; fi -Jroot=`echo $Jroot|jq --argjson Joutbound "${Joutbound}" '.outbounds += [$Joutbound]'` +# First outbound will be the DEFAULT outbound +Jroot=`jq -nc --argjson Joutbound "${Joutbound}" '.outbounds += [$Joutbound]'` +Jroot=`echo $Jroot|jq '.outbounds += [{"tag":"direct","protocol":"freedom"},{"tag":"blocked","protocol":"blackhole"}]'` # Add inbounds config if [ -z "${DNS}" ]; then DNS="1.1.1.1"; fi