mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-11 16:01:28 +00:00
Merge branch 'dev' into patch-2
This commit is contained in:
@@ -3,49 +3,65 @@
|
||||
|
||||
[ -n "$__IS_MODULE_1_START_LOADED" ] && return
|
||||
__IS_MODULE_1_START_LOADED=1
|
||||
load_lang 1_start
|
||||
|
||||
#启动相关
|
||||
# ===== 启动完成提示 =====
|
||||
startover() {
|
||||
echo -ne " \r"
|
||||
echo -e "\033[32m服务已启动!\033[0m"
|
||||
echo -e "请使用 \033[4;36mhttp://$host$hostdir\033[0m 管理内置规则"
|
||||
echo -e "\033[32m$START_SERVICE_OK\033[0m"
|
||||
echo -e "$START_WEB_HINT \033[4;36mhttp://$host$hostdir\033[0m $START_WEB_HINT2"
|
||||
|
||||
if [ "$redir_mod" = "纯净模式" ]; then
|
||||
echo "-----------------------------------------------"
|
||||
echo -e "其他设备可以使用PAC配置连接:\033[4;32mhttp://$host:$db_port/ui/pac\033[0m"
|
||||
echo -e "或者使用HTTP/SOCK5方式连接:IP{\033[36m$host\033[0m}Port{\033[36m$mix_port\033[0m}"
|
||||
echo -e "$START_PAC_HINT \033[4;32mhttp://$host:$db_port/ui/pac\033[0m"
|
||||
echo -e "$START_PROXY_HINT IP{\033[36m$host\033[0m} Port{\033[36m$mix_port\033[0m}"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# ===== 启动核心 =====
|
||||
start_core() {
|
||||
if echo "$crashcore" | grep -q 'singbox'; then
|
||||
core_config="$CRASHDIR"/jsons/config.json
|
||||
core_config="$CRASHDIR/jsons/config.json"
|
||||
else
|
||||
core_config="$CRASHDIR"/yamls/config.yaml
|
||||
core_config="$CRASHDIR/yamls/config.yaml"
|
||||
fi
|
||||
|
||||
echo "-----------------------------------------------"
|
||||
if [ ! -s $core_config -a -s "$CRASHDIR"/configs/providers.cfg ]; then
|
||||
echo -e "\033[33m没有找到${crashcore}配置文件,尝试生成providers配置文件!\033[0m"
|
||||
|
||||
if [ ! -s "$core_config" ] && [ -s "$CRASHDIR/configs/providers.cfg" ]; then
|
||||
echo -e "\033[33m$START_NO_CORE_CFG_TRY_GEN\033[0m"
|
||||
|
||||
[ "$crashcore" = singboxr ] && coretype=singbox
|
||||
[ "$crashcore" = meta -o "$crashcore" = clashpre ] && coretype=clash
|
||||
. "$CRASHDIR"/menus/6_core_config.sh && gen_${coretype}_providers
|
||||
elif [ -s $core_config -o -n "$Url" -o -n "$Https" ]; then
|
||||
"$CRASHDIR"/start.sh start
|
||||
#设置循环检测以判定服务启动是否成功
|
||||
. "$CRASHDIR"/libs/start_wait.sh
|
||||
[ -n "$test" -o -n "$(pidof CrashCore)" ] && {
|
||||
#启动TG机器人
|
||||
[ "$bot_tg_service" = ON ] && . "$CRASHDIR"/menus/bot_tg_service.sh && bot_tg_start
|
||||
startover
|
||||
}
|
||||
|
||||
. "$CRASHDIR/menus/6_core_config.sh" && gen_${coretype}_providers
|
||||
|
||||
elif [ -s "$core_config" ] || [ -n "$Url" ] || [ -n "$Https" ]; then
|
||||
"$CRASHDIR/start.sh" start
|
||||
|
||||
# 循环检测服务启动状态
|
||||
. "$CRASHDIR/libs/start_wait.sh"
|
||||
|
||||
[ -n "$test" ] || pidof CrashCore >/dev/null && {
|
||||
# 启动 TG 机器人
|
||||
if [ "$bot_tg_service" = ON ]; then
|
||||
. "$CRASHDIR/menus/bot_tg_service.sh" && bot_tg_start
|
||||
fi
|
||||
startover
|
||||
}
|
||||
|
||||
else
|
||||
echo -e "\033[31m没有找到${crashcore}配置文件,请先导入配置文件!\033[0m"
|
||||
. "$CRASHDIR"/menus/6_core_config.sh && set_core_config
|
||||
echo -e "\033[31m$START_NO_CORE_CFG_IMPORT_FIRST\033[0m"
|
||||
. "$CRASHDIR/menus/6_core_config.sh" && set_core_config
|
||||
fi
|
||||
}
|
||||
|
||||
# ===== 启动服务入口 =====
|
||||
start_service() {
|
||||
if [ "$firewall_area" = 5 ]; then
|
||||
"$CRASHDIR"/start.sh start
|
||||
echo -e "\033[32m已完成防火墙设置!\033[0m"
|
||||
"$CRASHDIR/start.sh" start
|
||||
echo -e "\033[32m$START_FIREWALL_DONE\033[0m"
|
||||
else
|
||||
start_core
|
||||
fi
|
||||
|
||||
@@ -372,13 +372,13 @@ EOF
|
||||
}
|
||||
}
|
||||
if [ -z "$(grep "provider_temp_${coretype}" "$CRASHDIR"/configs/ShellCrash.cfg)" ];then
|
||||
provider_temp_file="$TMPDIR/$(sed -n "1 p" "$CRASHDIR"/configs/${coretype}_providers.list | awk '{print $2}')"
|
||||
provider_temp_file="$(sed -n "1 p" "$CRASHDIR"/configs/${coretype}_providers.list | awk '{print $2}')"
|
||||
else
|
||||
provider_temp_file=$(grep "provider_temp_${coretype}" "$CRASHDIR"/configs/ShellCrash.cfg | awk -F '=' '{print $2}')
|
||||
fi
|
||||
echo "-----------------------------------------------"
|
||||
if [ -s "$provider_temp_file" ];then
|
||||
ln -sf "$provider_temp_file" "$TMPDIR"/provider_temp_file
|
||||
if [ -s "$TMPDIR/$provider_temp_file" ];then
|
||||
ln -sf "$TMPDIR/$provider_temp_file" "$TMPDIR"/provider_temp_file
|
||||
else
|
||||
echo -e "\033[33m正在获取在线模版!\033[0m"
|
||||
get_bin "$TMPDIR"/provider_temp_file "rules/${coretype}_providers/$provider_temp_file"
|
||||
@@ -416,7 +416,7 @@ EOF
|
||||
cut -c 1- "$TMPDIR"/providers/providers.yaml "$TMPDIR"/providers/proxy-groups.yaml "$TMPDIR"/providers/rules.yaml > "$TMPDIR"/config.yaml
|
||||
rm -rf "$TMPDIR"/providers
|
||||
#调用内核测试
|
||||
. "$CRASHDIR"/libs/core_tools.sh && core_find && "$TMPDIR"/CrashCore -t -d "$BINDIR" -f "$TMPDIR"/config.yaml
|
||||
. "$CRASHDIR"/starts/check_core.sh && check_core && "$TMPDIR"/CrashCore -t -d "$BINDIR" -f "$TMPDIR"/config.yaml
|
||||
if [ "$?" = 0 ];then
|
||||
echo -e "\033[32m配置文件生成成功!\033[0m"
|
||||
mkdir -p "$CRASHDIR"/yamls
|
||||
@@ -518,7 +518,7 @@ EOF
|
||||
cat "$TMPDIR"/provider_temp_file | sed "s/{providers_tags}/$providers_tags/g" > "$TMPDIR"/providers/outbounds.json
|
||||
rm -rf "$TMPDIR"/provider_temp_file
|
||||
#调用内核测试
|
||||
. "$CRASHDIR"/libs/core_tools.sh && core_find && "$TMPDIR"/CrashCore merge "$TMPDIR"/config.json -C "$TMPDIR"/providers
|
||||
. "$CRASHDIR"/starts/check_core.sh && check_core && "$TMPDIR"/CrashCore merge "$TMPDIR"/config.json -C "$TMPDIR"/providers
|
||||
if [ "$?" = 0 ];then
|
||||
echo -e "\033[32m配置文件生成成功!如果启动超时建议更新里手动安装Singbox-srs数据库常用包!\033[0m"
|
||||
mkdir -p "$CRASHDIR"/jsons
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -181,8 +181,9 @@ set_common_ports() {
|
||||
}
|
||||
set_cust_host_ipv4() { #自定义ipv4透明路由网段
|
||||
[ -z "$replace_default_host_ipv4" ] && replace_default_host_ipv4="OFF"
|
||||
. "$CRASHDIR"/starts/fw_getlanip.sh && getlanip
|
||||
echo "-----------------------------------------------"
|
||||
echo -e "当前默认透明路由的网段为: \033[32m$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'br' | grep -v 'iot' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g' | tr '\n' ' ' && echo) \033[0m"
|
||||
echo -e "当前默认透明路由的网段为: \033[32m$host_ipv4 \033[0m"
|
||||
echo -e "当前已添加的自定义网段为:\033[36m$cust_host_ipv4\033[0m"
|
||||
echo "-----------------------------------------------"
|
||||
echo -e " 1 移除所有自定义网段"
|
||||
|
||||
Reference in New Issue
Block a user