diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index c0c2ad55c..1704cc246 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -352,7 +352,7 @@ get_geoip() { local geoip_type_flag="" local geoip_path="$(config_t_get global_rules v2ray_location_asset)" geoip_path="${geoip_path%*/}/geoip.dat" - [ -e "$geoip_path" ] || { echo ""; return; } + [ -s "$geoip_path" ] || { echo ""; return; } case "$2" in "ipv4") geoip_type_flag="-ipv6=false" ;; "ipv6") geoip_type_flag="-ipv4=false" ;; @@ -773,9 +773,26 @@ run_redir() { run_ipt2socks flag=default proto=UDP local_port=${local_port} socks_address=${_socks_address} socks_port=${_socks_port} socks_username=${_socks_username} socks_password=${_socks_password} log_file=${log_file} ;; sing-box) + local protocol=$(config_n_get $node protocol) + [ "$protocol" = "_shunt" ] && { + local geoip_path="$(config_t_get global_singbox geoip_path)" + local geosite_path="$(config_t_get global_singbox geosite_path)" + if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then + echolog "* 缺少Geo规则文件,UDP Sing-Box分流节点无法正常使用!" + fi + } run_singbox flag=UDP node=$node udp_redir_port=$local_port config_file=$config_file log_file=$log_file ;; xray) + local protocol=$(config_n_get $node protocol) + [ "$protocol" = "_shunt" ] && { + local geo_path="$(config_t_get global_rules v2ray_location_asset)" + local geoip_path="${geo_path%*/}/geoip.dat" + local geosite_path="${geo_path%*/}/geosite.dat" + if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then + echolog "* 缺少Geo规则文件,UDP Xray分流节点无法正常使用!" + fi + } run_xray flag=UDP node=$node udp_redir_port=$local_port config_file=$config_file log_file=$log_file ;; trojan*) @@ -875,6 +892,14 @@ run_redir() { echolog "* 当前TCP节点采用Sing-Box分流且默认节点为直连,远程DNS过滤模式将默认使用Sing-Box(TCP),防止环回!" } + [ "$protocol" = "_shunt" ] && { + local geoip_path="$(config_t_get global_singbox geoip_path)" + local geosite_path="$(config_t_get global_singbox geosite_path)" + if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then + echolog "* 缺少Geo规则文件,TCP Sing-Box分流节点无法正常使用!" + fi + } + [ "${DNS_MODE}" = "sing-box" ] && { NO_PLUGIN_DNS=1 config_file=$(echo $config_file | sed "s/.json/_DNS.json/g") @@ -953,6 +978,15 @@ run_redir() { echolog "* 当前TCP节点采用Xray分流且默认节点为直连,远程DNS过滤模式将默认使用Xray(TCP),防止环回!" } + [ "$protocol" = "_shunt" ] && { + local geo_path="$(config_t_get global_rules v2ray_location_asset)" + local geoip_path="${geo_path%*/}/geoip.dat" + local geosite_path="${geo_path%*/}/geosite.dat" + if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then + echolog "* 缺少Geo规则文件,TCP Xray分流节点无法正常使用!" + fi + } + [ "${DNS_MODE}" = "xray" ] && { NO_PLUGIN_DNS=1 config_file=$(echo $config_file | sed "s/.json/_DNS.json/g")