mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 08:53:56 +08:00
🏅 Sync 2026-06-22 01:15:34
This commit is contained in:
1 parent
6d4cdd8118
commit
4b85448aee
41 files changed
+3203
-1407
No files matched your search
@@ -214,7 +214,7 @@ is_builtin_dns_active() {
|
||||
ps_list | grep -v "grep" | grep -q "ssr-retcp"
|
||||
;;
|
||||
v2ray)
|
||||
ps_list | grep -v "grep" | grep -q "$TMP_PATH/.*ssr-retcp\\.json"
|
||||
ps_list | grep -v "grep" | grep -Eq "$TMP_PATH/.*ssr-retcp\\.(json|yaml)"
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
@@ -284,6 +284,22 @@ get_ss_server_mihomo_runtime_file() {
|
||||
echo "$(get_ss_server_mihomo_workdir "$1")/config.yaml"
|
||||
}
|
||||
|
||||
get_v2ray_mihomo_workdir() {
|
||||
echo "$TMP_PATH/v2ray-$1"
|
||||
}
|
||||
|
||||
get_v2ray_mihomo_runtime_file() {
|
||||
echo "$(get_v2ray_mihomo_workdir "$1")/config.yaml"
|
||||
}
|
||||
|
||||
get_v2ray_server_mihomo_workdir() {
|
||||
echo "$TMP_PATH/v2ray-server-$1"
|
||||
}
|
||||
|
||||
get_v2ray_server_mihomo_runtime_file() {
|
||||
echo "$(get_v2ray_server_mihomo_workdir "$1")/config.yaml"
|
||||
}
|
||||
|
||||
link_mihomo_geodata() {
|
||||
local workdir="$1"
|
||||
|
||||
@@ -366,6 +382,41 @@ prepare_ss_server_mihomo_runtime_config() {
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_v2ray_mihomo_runtime_config() {
|
||||
local sid="$1"
|
||||
local local_port="$2"
|
||||
local socks_port="$3"
|
||||
local instance_key="${4:-$sid}"
|
||||
local run_mode="${5:-redir}"
|
||||
local runtime_file="$(get_v2ray_mihomo_runtime_file "$instance_key")"
|
||||
local workdir="$(get_v2ray_mihomo_workdir "$instance_key")"
|
||||
|
||||
[ -n "$sid" ] || return 1
|
||||
[ -n "$local_port" ] || return 1
|
||||
|
||||
mkdir -p "$workdir"
|
||||
if ! /usr/bin/lua "$CLASH_YAML_HELPER" v2ray "$sid" "$runtime_file" "$local_port" "$socks_port" "$run_mode" >/dev/null 2>&1; then
|
||||
echolog "V2Ray/Xray 单节点 Mihomo 运行配置生成失败:$sid"
|
||||
return 1
|
||||
fi
|
||||
|
||||
link_mihomo_geodata "$workdir"
|
||||
}
|
||||
|
||||
prepare_v2ray_server_mihomo_runtime_config() {
|
||||
local sid="$1"
|
||||
local runtime_file="$(get_v2ray_server_mihomo_runtime_file "$sid")"
|
||||
local workdir="$(get_v2ray_server_mihomo_workdir "$sid")"
|
||||
|
||||
[ -n "$sid" ] || return 1
|
||||
|
||||
mkdir -p "$workdir"
|
||||
if ! /usr/bin/lua "$CLASH_YAML_HELPER" v2ray_server "$sid" "$runtime_file" >/dev/null 2>&1; then
|
||||
echolog "V2Ray/Xray 服务端 Mihomo 配置生成失败:$sid"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
download_clash_config() {
|
||||
local sid="$1"
|
||||
local clash_url="$(uci_get_by_name "$sid" clash_url)"
|
||||
@@ -419,7 +470,7 @@ clash_cache() {
|
||||
|
||||
filter_clash_yaml_proxies() {
|
||||
local yaml_file="$1"
|
||||
local filter_words="$(uci_get_by_type server_subscribe filter_words '过期时间/剩余流量')"
|
||||
local filter_words="$(uci_get_by_type server_subscribe filter_words '过期/重置/套餐/剩余/网址/QQ群/官网/防失联/回国')"
|
||||
local names_file="$TMP_PATH/clash-proxy-names.$$"
|
||||
local removed_file="$TMP_PATH/clash-proxy-removed.$$"
|
||||
local removed_count=0
|
||||
@@ -697,6 +748,70 @@ use_mihomo_for_ss_rust_server() {
|
||||
has_mihomo_binary
|
||||
}
|
||||
|
||||
start_v2ray_with_mihomo() {
|
||||
local sid="$1"
|
||||
local local_port="$2"
|
||||
local socks_port="$3"
|
||||
local instance_key="$4"
|
||||
local run_mode="$5"
|
||||
local process_name="$6"
|
||||
local log_prefix="$7"
|
||||
local mihomo_bin="$(first_type mihomo)"
|
||||
|
||||
[ -x "$mihomo_bin" ] || return 1
|
||||
prepare_v2ray_mihomo_runtime_config "$sid" "$local_port" "$socks_port" "$instance_key" "$run_mode" || return 1
|
||||
|
||||
local workdir="$(get_v2ray_mihomo_workdir "$instance_key")"
|
||||
local protocol_name="$(uci_get_by_name "$sid" v2ray_protocol)"
|
||||
[ -n "$protocol_name" ] || protocol_name="$(uci_get_by_name "$sid" type)"
|
||||
ln_start_bin "$mihomo_bin" "$process_name" -d "$workdir" -f "$workdir/config.yaml"
|
||||
echolog "$log_prefix:Mihomo ($protocol_name) Started!"
|
||||
return 0
|
||||
}
|
||||
|
||||
start_socks5_udp_with_ipt2socks() {
|
||||
local sid="$1"
|
||||
local local_port="$2"
|
||||
local threads="$3"
|
||||
local ipt2socks_bin="$(first_type ipt2socks)"
|
||||
local auth_opts=""
|
||||
|
||||
[ -x "$ipt2socks_bin" ] || return 1
|
||||
if [ "$(uci_get_by_name "$sid" auth_enable 0)" = "1" ]; then
|
||||
auth_opts="-a $(uci_get_by_name "$sid" username) -k $(uci_get_by_name "$sid" password)"
|
||||
fi
|
||||
for i in $(seq 1 $threads); do
|
||||
ln_start_bin "$ipt2socks_bin" ipt2socks -U -r -b 0.0.0.0 -4 \
|
||||
-s "$(uci_get_by_name "$sid" server)" \
|
||||
-p "$(uci_get_by_name "$sid" server_port)" \
|
||||
-l "$local_port" $auth_opts
|
||||
done
|
||||
echolog "UDP TPROXY Relay:Socks5 via IPT2Socks $threads Threads Started!"
|
||||
return 0
|
||||
}
|
||||
|
||||
start_socks5_redir_with_ipt2socks() {
|
||||
local sid="$1"
|
||||
local local_port="$2"
|
||||
local threads="$3"
|
||||
local ipt2socks_bin="$(first_type ipt2socks)"
|
||||
local auth_opts=""
|
||||
|
||||
[ -x "$ipt2socks_bin" ] || return 1
|
||||
if [ "$(uci_get_by_name "$sid" auth_enable 0)" = "1" ]; then
|
||||
auth_opts="-a $(uci_get_by_name "$sid" username) -k $(uci_get_by_name "$sid" password)"
|
||||
fi
|
||||
for i in $(seq 1 $threads); do
|
||||
ln_start_bin "$ipt2socks_bin" ipt2socks \
|
||||
-T -R -r -b 0.0.0.0 -4 \
|
||||
-s "$(uci_get_by_name "$sid" server)" \
|
||||
-p "$(uci_get_by_name "$sid" server_port)" \
|
||||
-l "$local_port" $auth_opts
|
||||
done
|
||||
echolog "Main node:Socks5 via IPT2Socks $threads Threads Started!"
|
||||
return 0
|
||||
}
|
||||
|
||||
ln_start_bin() {
|
||||
local file_func=${1}
|
||||
local ln_name=${2}
|
||||
@@ -1289,9 +1404,15 @@ start_udp() {
|
||||
fi
|
||||
;;
|
||||
v2ray)
|
||||
gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port
|
||||
ln_start_bin $(first_type xray) v2ray run -c $udp_config_file
|
||||
echolog "UDP TPROXY Relay:$($(first_type xray) version | head -1) Started!"
|
||||
if has_mihomo_binary; then
|
||||
redir_udp=0
|
||||
ARG_UDP=""
|
||||
echolog "UDP TPROXY Relay:V2Ray/Xray 单节点由主 Mihomo 实例处理。"
|
||||
else
|
||||
gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port
|
||||
ln_start_bin $(first_type xray) v2ray run -c $udp_config_file
|
||||
echolog "UDP TPROXY Relay:$($(first_type xray) version | head -1) Started!"
|
||||
fi
|
||||
;;
|
||||
trojan) #client
|
||||
gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_local_port
|
||||
@@ -1317,8 +1438,12 @@ start_udp() {
|
||||
local chain_type=$(uci_get_by_name $UDP_RELAY_SERVER chain_type)
|
||||
case ${chain_type} in
|
||||
vmess)
|
||||
ln_start_bin $(first_type xray) v2ray run -c $udp_config_file
|
||||
echolog "UDP TPROXY Relay:shadow-tls chain-to $($(first_type xray) --version) Started!"
|
||||
if start_v2ray_with_mihomo "$UDP_RELAY_SERVER" "$tmp_udp_port" "0" "${UDP_RELAY_SERVER}-shadowtls-udp" "redir" "shadowtls-vmess-udp" "UDP TPROXY Relay:shadow-tls chain-to"; then
|
||||
:
|
||||
else
|
||||
ln_start_bin $(first_type xray) v2ray run -c $udp_config_file
|
||||
echolog "UDP TPROXY Relay:shadow-tls chain-to $($(first_type xray) --version) Started!"
|
||||
fi
|
||||
;;
|
||||
sslocal)
|
||||
ln_start_bin $(first_type sslocal) sslocal -c $udp_config_file
|
||||
@@ -1327,16 +1452,16 @@ start_udp() {
|
||||
esac
|
||||
;;
|
||||
socks5)
|
||||
if [ "$(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0)" == "1" ]; then
|
||||
local auth="-a $(uci_get_by_name $UDP_RELAY_SERVER username) -k $(uci_get_by_name $UDP_RELAY_SERVER password)"
|
||||
if start_socks5_udp_with_ipt2socks "$UDP_RELAY_SERVER" "$tmp_udp_port" "$threads"; then
|
||||
:
|
||||
elif has_mihomo_binary; then
|
||||
redir_udp=0
|
||||
ARG_UDP=""
|
||||
echolog "UDP TPROXY Relay:Socks5 缺少 ipt2socks,已回退到主 Mihomo 实例处理。"
|
||||
else
|
||||
echolog "UDP TPROXY Relay:Socks5 缺少 ipt2socks,且 Mihomo 不可用。"
|
||||
return 1
|
||||
fi
|
||||
for i in $(seq 1 $threads); do
|
||||
ln_start_bin $(first_type ipt2socks) ipt2socks -U -r -b 0.0.0.0 -4 \
|
||||
-s $(uci_get_by_name $UDP_RELAY_SERVER server) \
|
||||
-p $(uci_get_by_name $UDP_RELAY_SERVER server_port) \
|
||||
-l $tmp_udp_port $auth
|
||||
done
|
||||
echolog "UDP TPROXY Relay:Socks5 via IPT2Socks $threads Threads Started!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -1395,11 +1520,20 @@ start_local() {
|
||||
fi
|
||||
;;
|
||||
v2ray)
|
||||
if [ "$_local" == "2" ]; then
|
||||
local instance_key="${LOCAL_SERVER}-local"
|
||||
[ -n "$probe_instance_key" ] && instance_key="$probe_instance_key"
|
||||
if start_v2ray_with_mihomo "$LOCAL_SERVER" "$local_port" "$local_port" "$instance_key" "socks" "v2ray-local" "Global_Socks5"; then
|
||||
:
|
||||
elif [ "$(uci_get_by_name "$LOCAL_SERVER" v2ray_protocol)" = "snell" ]; then
|
||||
echolog "Global_Socks5:Snell 需要 Mihomo 内核,且当前 Mihomo 启动失败。"
|
||||
return 1
|
||||
elif [ "$_local" == "2" ]; then
|
||||
gen_config_file $LOCAL_SERVER $type 4 0 $local_port
|
||||
ln_start_bin $(first_type xray) v2ray run -c $local_config_file
|
||||
echolog "Global_Socks5:$($(first_type xray) version | head -1) Started!"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
echolog "Global_Socks5:$($(first_type xray) version | head -1) Started!"
|
||||
;;
|
||||
trojan) #client
|
||||
gen_config_file $LOCAL_SERVER $type 4 $local_port
|
||||
@@ -1433,8 +1567,12 @@ start_local() {
|
||||
local chain_type=$(uci_get_by_name $LOCAL_SERVER chain_type)
|
||||
case ${chain_type} in
|
||||
vmess)
|
||||
ln_start_bin $(first_type xray) v2ray run -c $local_config_file
|
||||
echolog "Global Socks5 Proxy:shadow-tls chain-to$($(first_type xray) --version) Started!"
|
||||
if start_v2ray_with_mihomo "$LOCAL_SERVER" "$local_port" "$local_port" "${LOCAL_SERVER}-shadowtls-local" "socks" "shadowtls-vmess-local" "Global Socks5 Proxy:shadow-tls chain-to"; then
|
||||
:
|
||||
else
|
||||
ln_start_bin $(first_type xray) v2ray run -c $local_config_file
|
||||
echolog "Global Socks5 Proxy:shadow-tls chain-to$($(first_type xray) --version) Started!"
|
||||
fi
|
||||
;;
|
||||
sslocal)
|
||||
ln_start_bin $(first_type sslocal) sslocal -c $local_config_file
|
||||
@@ -1443,16 +1581,22 @@ start_local() {
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
clash)
|
||||
echolog "Global_Socks5:Clash total node is only supported when using Same as Global Server."
|
||||
clash)
|
||||
echolog "Global_Socks5:Clash total node is only supported when using Same as Global Server."
|
||||
return 1
|
||||
;;
|
||||
socks5)
|
||||
local instance_key="${LOCAL_SERVER}-local"
|
||||
[ -n "$probe_instance_key" ] && instance_key="$probe_instance_key"
|
||||
if start_v2ray_with_mihomo "$LOCAL_SERVER" "$local_port" "$local_port" "$instance_key" "socks" "socks5-local" "Global_Socks5"; then
|
||||
:
|
||||
else
|
||||
echolog "Global_Socks5:Socks5 单节点需要 Mihomo 才能作为本地 SOCKS 出口。"
|
||||
return 1
|
||||
;;
|
||||
socks5)
|
||||
echolog "Global_Socks5:Socks5 transparent-only node cannot be used as generic Socks outbound."
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
local listenip='-i 0.0.0.0'
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
local listenip='-i 0.0.0.0'
|
||||
[ -e /proc/sys/net/ipv6 ] && listenip='-i ::'
|
||||
ln_start_bin $(first_type microsocks) microsocks $listenip -p $local_port tcp-udp-ssr-local
|
||||
echolog "Global_Socks5:$type Started!"
|
||||
@@ -1725,9 +1869,16 @@ Start_Run() {
|
||||
fi
|
||||
;;
|
||||
v2ray)
|
||||
gen_config_file $GLOBAL_SERVER $type 1 $tcp_port $socks_port
|
||||
ln_start_bin $(first_type xray) v2ray run -c $tcp_config_file
|
||||
echolog "Main node:$($(first_type xray) version | head -1) Started!"
|
||||
if start_v2ray_with_mihomo "$GLOBAL_SERVER" "$tcp_port" "$socks_port" "$GLOBAL_SERVER" "redir" "ssr-retcp" "Main node"; then
|
||||
:
|
||||
elif [ "$(uci_get_by_name "$GLOBAL_SERVER" v2ray_protocol)" = "snell" ]; then
|
||||
echolog "Main node:Snell 需要 Mihomo 内核,且当前 Mihomo 启动失败。"
|
||||
return 1
|
||||
else
|
||||
gen_config_file $GLOBAL_SERVER $type 1 $tcp_port $socks_port
|
||||
ln_start_bin $(first_type xray) v2ray run -c $tcp_config_file
|
||||
echolog "Main node:$($(first_type xray) version | head -1) Started!"
|
||||
fi
|
||||
;;
|
||||
trojan)
|
||||
gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
|
||||
@@ -1759,24 +1910,28 @@ Start_Run() {
|
||||
shadowtls)
|
||||
if [ -z "$socks_port" ]; then
|
||||
gen_config_file $GLOBAL_SERVER $type 1 "10${tmp_tcp_local_port}"
|
||||
gen_config_file $GLOBAL_SERVER $type 1 "10${tmp_tcp_local_port}" 0 chain
|
||||
else
|
||||
gen_config_file $GLOBAL_SERVER $type 1 "10${tmp_tcp_local_port}"
|
||||
gen_config_file $GLOBAL_SERVER $type 1 "10${tmp_tcp_local_port}" $socks_port chain
|
||||
fi
|
||||
local chain_type=$(uci_get_by_name $GLOBAL_SERVER chain_type)
|
||||
case ${chain_type} in
|
||||
vmess)
|
||||
ln_start_bin $(first_type shadow-tls) shadow-tls config --config $chain_config_file
|
||||
ln_start_bin $(first_type xray) v2ray run -c $tcp_config_file
|
||||
echolog "Mian node:shadow-tls chain-to $($(first_type xray) --version) Started!"
|
||||
;;
|
||||
sslocal)
|
||||
ln_start_bin $(first_type shadow-tls) shadow-tls config --config $chain_config_file
|
||||
ln_start_bin $(first_type sslocal) sslocal -c $tcp_config_file
|
||||
echolog "Main node:shadow-tls chain-to $($(first_type sslocal) --version) Started!"
|
||||
;;
|
||||
esac
|
||||
gen_config_file $GLOBAL_SERVER $type 1 "10${tmp_tcp_local_port}" 0 chain
|
||||
else
|
||||
gen_config_file $GLOBAL_SERVER $type 1 "10${tmp_tcp_local_port}"
|
||||
gen_config_file $GLOBAL_SERVER $type 1 "10${tmp_tcp_local_port}" $socks_port chain
|
||||
fi
|
||||
local chain_type=$(uci_get_by_name $GLOBAL_SERVER chain_type)
|
||||
case ${chain_type} in
|
||||
vmess)
|
||||
ln_start_bin $(first_type shadow-tls) shadow-tls config --config $chain_config_file
|
||||
if start_v2ray_with_mihomo "$GLOBAL_SERVER" "$tcp_port" "$socks_port" "${GLOBAL_SERVER}-shadowtls" "redir" "shadowtls-vmess" "Main node:shadow-tls chain-to"; then
|
||||
:
|
||||
else
|
||||
ln_start_bin $(first_type xray) v2ray run -c $tcp_config_file
|
||||
echolog "Mian node:shadow-tls chain-to $($(first_type xray) --version) Started!"
|
||||
fi
|
||||
;;
|
||||
sslocal)
|
||||
ln_start_bin $(first_type shadow-tls) shadow-tls config --config $chain_config_file
|
||||
ln_start_bin $(first_type sslocal) sslocal -c $tcp_config_file
|
||||
echolog "Main node:shadow-tls chain-to $($(first_type sslocal) --version) Started!"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
clash)
|
||||
local clash_socks_port=0
|
||||
@@ -1802,23 +1957,14 @@ Start_Run() {
|
||||
echolog "Main node:Mihomo (Clash) Started!"
|
||||
;;
|
||||
socks5)
|
||||
local ipt2socks_bin="$(first_type ipt2socks)"
|
||||
local auth_opts=""
|
||||
[ -x "$ipt2socks_bin" ] || {
|
||||
echolog "Main node:Socks5 缺少 ipt2socks,无法启动透明代理。"
|
||||
if start_socks5_redir_with_ipt2socks "$GLOBAL_SERVER" "$tcp_port" "$threads"; then
|
||||
:
|
||||
elif start_v2ray_with_mihomo "$GLOBAL_SERVER" "$tcp_port" "$socks_port" "$GLOBAL_SERVER" "redir" "ssr-retcp" "Main node"; then
|
||||
echolog "Main node:Socks5 缺少 ipt2socks,已回退到 Mihomo。"
|
||||
else
|
||||
echolog "Main node:Socks5 缺少 ipt2socks,且 Mihomo 不可用。"
|
||||
return 1
|
||||
}
|
||||
if [ "$(uci_get_by_name $GLOBAL_SERVER auth_enable 0)" = "1" ]; then
|
||||
auth_opts="-a $(uci_get_by_name $GLOBAL_SERVER username) -k $(uci_get_by_name $GLOBAL_SERVER password)"
|
||||
fi
|
||||
for i in $(seq 1 $threads); do
|
||||
ln_start_bin "$ipt2socks_bin" ipt2socks \
|
||||
-T -R -r -b 0.0.0.0 -4 \
|
||||
-s "$(uci_get_by_name $GLOBAL_SERVER server)" \
|
||||
-p "$(uci_get_by_name $GLOBAL_SERVER server_port)" \
|
||||
-l "$tcp_port" $auth_opts
|
||||
done
|
||||
echolog "Main node:Socks5 via IPT2Socks $threads Threads Started!"
|
||||
;;
|
||||
esac
|
||||
redir_tcp=1
|
||||
@@ -2018,6 +2164,7 @@ start_server() {
|
||||
local tcp_guise=$(uci_get_by_name "$1" tcp_guise "none")
|
||||
local tcp_guise_http_host=$(uci_get_by_name "$1" tcp_guise_http_host "")
|
||||
local tcp_guise_http_path=$(uci_get_by_name "$1" tcp_guise_http_path "")
|
||||
local mihomo_server_started=0
|
||||
|
||||
# 确定密码/UUID
|
||||
local password=""
|
||||
@@ -2036,26 +2183,37 @@ start_server() {
|
||||
echolog "Server: $type 服务端缺少密码/UUID,跳过启动"
|
||||
return 1
|
||||
}
|
||||
|
||||
local config_file="$TMP_PATH/xray-server-$server_count.json"
|
||||
|
||||
# 生成 Xray 配置
|
||||
generate_xray_config "$type" "$port" "$password" "$security" "$method" "$network" "$ws_path" "$ws_host" "$grpc_service" "$alter_id" "$tcp_guise" "$tcp_guise_http_host" "$tcp_guise_http_path" "$config_file"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echolog "Server: Xray $type 配置生成失败"
|
||||
return 1
|
||||
|
||||
local mihomo_bin="$(first_type mihomo)"
|
||||
if [ -x "$mihomo_bin" ] && prepare_v2ray_server_mihomo_runtime_config "$1"; then
|
||||
local server_workdir="$(get_v2ray_server_mihomo_workdir "$1")"
|
||||
ln_start_bin "$mihomo_bin" mihomo-server-$server_count -d "$server_workdir" -f "$server_workdir/config.yaml"
|
||||
echolog "Server: Mihomo $type 服务端 Server$server_count 已启动 (端口: $port)"
|
||||
mihomo_server_started=1
|
||||
fi
|
||||
|
||||
local xray_bin=$(first_type xray)
|
||||
if [ -z "$xray_bin" ]; then
|
||||
echolog "Server: xray-core 未安装,无法启动 $type 服务端"
|
||||
return 1
|
||||
|
||||
if [ "$mihomo_server_started" != "1" ]; then
|
||||
|
||||
local config_file="$TMP_PATH/xray-server-$server_count.json"
|
||||
|
||||
# 生成 Xray 配置
|
||||
generate_xray_config "$type" "$port" "$password" "$security" "$method" "$network" "$ws_path" "$ws_host" "$grpc_service" "$alter_id" "$tcp_guise" "$tcp_guise_http_host" "$tcp_guise_http_path" "$config_file"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echolog "Server: Xray $type 配置生成失败"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local xray_bin=$(first_type xray)
|
||||
if [ -z "$xray_bin" ]; then
|
||||
echolog "Server: xray-core 未安装,无法启动 $type 服务端"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ln_start_bin "$xray_bin" xray-server-$server_count run -c "$config_file"
|
||||
echolog "Server: Xray $type 服务端 Server$server_count 已启动 (端口: $port)"
|
||||
fi
|
||||
|
||||
ln_start_bin "$xray_bin" xray-server-$server_count run -c "$config_file"
|
||||
echolog "Server: Xray $type 服务端 Server$server_count 已启动 (端口: $port)"
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
server_port=$(uci_get_by_name $1 server_port)
|
||||
if [ "$USE_TABLES" = "nftables" ]; then
|
||||
|
||||
@@ -63,6 +63,13 @@ if [ -s "/etc/config/shadowsocksr" ]; then
|
||||
uci -q set shadowsocksr.@server_subscribe[0].proxy='1'
|
||||
fi
|
||||
|
||||
current_filter_words="$(uci -q get shadowsocksr.@server_subscribe[0].filter_words)"
|
||||
if [ -z "$current_filter_words" ]; then
|
||||
uci -q set shadowsocksr.@server_subscribe[0].filter_words='过期/重置/套餐/剩余/网址/QQ群/官网/防失联/回国'
|
||||
elif ! printf '%s\n' "$current_filter_words" | grep -q '重置'; then
|
||||
uci -q set shadowsocksr.@server_subscribe[0].filter_words="${current_filter_words}/重置"
|
||||
fi
|
||||
|
||||
if ! uci -q get shadowsocksr.@global_xray_fragment[0] > /dev/null; then
|
||||
uci -q add shadowsocksr global_xray_fragment
|
||||
uci -q set shadowsocksr.@global_xray_fragment[0].fragment='0'
|
||||
|
||||
Reference in new issue
Block a user