From 6c042416425b36881dd0c29529fad6d0d9402a13 Mon Sep 17 00:00:00 2001 From: cutelua <33216131+cutelua@users.noreply.github.com> Date: Tue, 2 Apr 2019 14:58:32 +0800 Subject: [PATCH] fix: stream network default value error --- src/jqcmd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jqcmd.sh b/src/jqcmd.sh index a8db9db..36ede48 100644 --- a/src/jqcmd.sh +++ b/src/jqcmd.sh @@ -101,7 +101,7 @@ jq_printvmess() { local _HOST=\"\" local _PATH=\"\" local _TLS=\"\" - local _NET=$(echo $IN | jq '.streamSettings.network|"tcp"') + local _NET=$(echo $IN | jq 'if (.streamSettings.network | length) > 0 then .streamSettings.network else "tcp" end') local _PORT=$(echo $IN | jq '.port') local _NETTRIM=${_NET//\"/} echo @@ -133,7 +133,7 @@ jq_printvmess() { for CLINTIDX in $(seq 0 $CLTLEN); do local EMAIL=$(echo $IN | jq 'if .settings.clients['${CLINTIDX}'].email then .settings.clients['${CLINTIDX}'].email else "DEFAULT" end') local _ps="${_MAKPREFIX}${ADDRESS}/${_NETTRIM}" - local _VMESS=$(echo "vmess://"$(echo $IN | jq -c '{"v":"2","ps":"'${_ps}'","add":"'${ADDRESS}'","port":.port,"id":.settings.clients['${CLINTIDX}'].id,"aid":.settings.clients['${CLINTIDX}'].alterId,"net":.streamSettings.network|"tcp","type":'${_TYPE}',"host":'${_HOST}',"path":'${_PATH}',"tls":'${_TLS}'}' | base64 -w0)) + local _VMESS=$(echo "vmess://"$(echo $IN | jq -c '{"v":"2","ps":"'${_ps}'","add":"'${ADDRESS}'","port":.port,"id":.settings.clients['${CLINTIDX}'].id,"aid":.settings.clients['${CLINTIDX}'].alterId,"net":'${_NET}',"type":'${_TYPE}',"host":'${_HOST}',"path":'${_PATH}',"tls":'${_TLS}'}' | base64 -w0)) _green "VMESS链接(v2rayN/v2rayNG): ${EMAIL//\"/}" echo _cyan "${_VMESS}"