~将clash基础内核、singbox内核移动到自定义内核功能中

~用singboxr内核替换了singboxp内核的原有功能
~自定义内核功能移除了部分不支持的内核
~优化singbox相关内核判断语句
~更新感谢列表
This commit is contained in:
juewuy
2025-11-30 21:27:46 +08:00
parent 4552514c23
commit 5c9fdeddd0
27 changed files with 52 additions and 68 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -180,7 +180,7 @@ startover() {
return 0 return 0
} }
start_core() { start_core() {
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ]; then if echo "$crashcore" | grep -q 'singbox'; then
core_config=${CRASHDIR}/jsons/config.json core_config=${CRASHDIR}/jsons/config.json
else else
core_config=${CRASHDIR}/yamls/config.yaml core_config=${CRASHDIR}/yamls/config.yaml
@@ -188,7 +188,7 @@ start_core() {
echo ----------------------------------------------- echo -----------------------------------------------
if [ ! -s $core_config -a -s $CRASHDIR/configs/providers.cfg ]; then if [ ! -s $core_config -a -s $CRASHDIR/configs/providers.cfg ]; then
echo -e "\033[33m没有找到${crashcore}配置文件尝试生成providers配置文件\033[0m" echo -e "\033[33m没有找到${crashcore}配置文件尝试生成providers配置文件\033[0m"
[ "$crashcore" = singboxp ] && coretype=singbox [ "$crashcore" = singboxr ] && coretype=singbox
[ "$crashcore" = meta -o "$crashcore" = clashpre ] && coretype=clash [ "$crashcore" = meta -o "$crashcore" = clashpre ] && coretype=clash
source ${CRASHDIR}/webget.sh && gen_${coretype}_providers source ${CRASHDIR}/webget.sh && gen_${coretype}_providers
elif [ -s $core_config -o -n "$Url" -o -n "$Https" ]; then elif [ -s $core_config -o -n "$Url" -o -n "$Https" ]; then
@@ -1483,7 +1483,7 @@ set_dns_mod() { #DNS模式设置
echo -e " 不支持CN-IP绕过功能" echo -e " 不支持CN-IP绕过功能"
echo -e " 2 redir_host模式\033[32m兼容性更好\033[0m" echo -e " 2 redir_host模式\033[32m兼容性更好\033[0m"
echo -e " 需搭配加密DNS使用" echo -e " 需搭配加密DNS使用"
if [ "$crashcore" = singbox ] || [ "$crashcore" = singboxp ] || [ "$crashcore" = meta ]; then if echo "$crashcore" | grep -q 'singbox' || [ "$crashcore" = meta ]; then
echo -e " 3 mix混合模式 \033[32m内部realip外部fakeip\033[0m" echo -e " 3 mix混合模式 \033[32m内部realip外部fakeip\033[0m"
echo -e " 依赖geosite.dat/geosite-cn.srs数据库" echo -e " 依赖geosite.dat/geosite-cn.srs数据库"
fi fi
@@ -1505,7 +1505,7 @@ set_dns_mod() { #DNS模式设置
echo -e "\033[36m已设为 $dns_mod 模式!!\033[0m" echo -e "\033[36m已设为 $dns_mod 模式!!\033[0m"
;; ;;
3) 3)
if [ "$crashcore" = singbox ] || [ "$crashcore" = singboxp ] || [ "$crashcore" = meta ]; then if echo "$crashcore" | grep -q 'singbox' || [ "$crashcore" = meta ]; then
dns_mod=mix dns_mod=mix
setconfig dns_mod $dns_mod setconfig dns_mod $dns_mod
echo ----------------------------------------------- echo -----------------------------------------------

View File

@@ -37,7 +37,7 @@ getconfig() { #读取配置及全局变量
[ -z "$multiport" ] && multiport='22,80,143,194,443,465,587,853,993,995,5222,8080,8443' [ -z "$multiport" ] && multiport='22,80,143,194,443,465,587,853,993,995,5222,8080,8443'
[ "$common_ports" = "已开启" ] && ports="-m multiport --dports $multiport" [ "$common_ports" = "已开启" ] && ports="-m multiport --dports $multiport"
#内核配置文件 #内核配置文件
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ]; then if echo "$crashcore" | grep -q 'singbox'; then
target=singbox target=singbox
format=json format=json
core_config="$CRASHDIR"/jsons/config.json core_config="$CRASHDIR"/jsons/config.json
@@ -60,7 +60,7 @@ getconfig() { #读取配置及全局变量
[ -z "$dns_fallback" ] && dns_fallback='1.0.0.1, 8.8.4.4' [ -z "$dns_fallback" ] && dns_fallback='1.0.0.1, 8.8.4.4'
#自动生成ua #自动生成ua
[ -z "$user_agent" -o "$user_agent" = "auto" ] && { [ -z "$user_agent" -o "$user_agent" = "auto" ] && {
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then if echo "$crashcore" | grep -q 'singbox';then
user_agent="sing-box/singbox/$core_v" user_agent="sing-box/singbox/$core_v"
elif [ "$crashcore" = meta ];then elif [ "$crashcore" = meta ];then
user_agent="clash.meta/mihomo/$core_v" user_agent="clash.meta/mihomo/$core_v"
@@ -353,7 +353,7 @@ get_core_config() { #下载内核配置文件
fi fi
else else
Https="" Https=""
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ]; then if echo "$crashcore" | grep -q 'singbox'; then
check_singbox_config check_singbox_config
else else
check_clash_config check_clash_config
@@ -741,7 +741,6 @@ EOF
userpass='"users": [{ "username": "'$username'", "password": "'$password'" }], ' userpass='"users": [{ "username": "'$username'", "password": "'$password'" }], '
} }
[ "$sniffer" = "已启用" ] && sniffer=true || sniffer=false #域名嗅探配置 [ "$sniffer" = "已启用" ] && sniffer=true || sniffer=false #域名嗅探配置
#[ "$crashcore" = singboxp ] && always_resolve_udp='"always_resolve_udp": true,'
cat >"$TMPDIR"/jsons/inbounds.json <<EOF cat >"$TMPDIR"/jsons/inbounds.json <<EOF
{ {
"inbounds": [ "inbounds": [
@@ -856,7 +855,7 @@ EOF
echo '{' >"$TMPDIR"/jsons/outbounds.json echo '{' >"$TMPDIR"/jsons/outbounds.json
echo '{' >"$TMPDIR"/jsons/route.json echo '{' >"$TMPDIR"/jsons/route.json
cat "$TMPDIR"/format.json | sed -n '/"outbounds":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/outbounds.json cat "$TMPDIR"/format.json | sed -n '/"outbounds":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/outbounds.json
[ "$crashcore" = "singboxp" ] && { [ "$crashcore" = "singboxr" ] && {
echo '{' >"$TMPDIR"/jsons/providers.json echo '{' >"$TMPDIR"/jsons/providers.json
cat "$TMPDIR"/format.json | sed -n '/"providers":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/providers.json cat "$TMPDIR"/format.json | sed -n '/"providers":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/providers.json
} }
@@ -1097,7 +1096,6 @@ EOF
userpass='"users": [{ "username": "'$username'", "password": "'$password'" }], ' userpass='"users": [{ "username": "'$username'", "password": "'$password'" }], '
} }
[ "$sniffer" = "已启用" ] && sniffer=true || sniffer=false #域名嗅探配置 [ "$sniffer" = "已启用" ] && sniffer=true || sniffer=false #域名嗅探配置
#[ "$crashcore" = singboxp ] && always_resolve_udp='"always_resolve_udp": true,'
cat >"$TMPDIR"/jsons/inbounds.json <<EOF cat >"$TMPDIR"/jsons/inbounds.json <<EOF
{ {
"inbounds": [ "inbounds": [
@@ -1209,7 +1207,7 @@ EOF
echo '{' >"$TMPDIR"/jsons/outbounds.json echo '{' >"$TMPDIR"/jsons/outbounds.json
echo '{' >"$TMPDIR"/jsons/route.json echo '{' >"$TMPDIR"/jsons/route.json
cat "$TMPDIR"/format.json | sed -n '/"outbounds":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/outbounds.json cat "$TMPDIR"/format.json | sed -n '/"outbounds":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/outbounds.json
[ "$crashcore" = "singboxp" ] && { [ "$crashcore" = "singboxr" ] && {
echo '{' >"$TMPDIR"/jsons/providers.json echo '{' >"$TMPDIR"/jsons/providers.json
cat "$TMPDIR"/format.json | sed -n '/^ "providers":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/providers.json cat "$TMPDIR"/format.json | sed -n '/^ "providers":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/providers.json
} }
@@ -2082,7 +2080,7 @@ core_check() { #检查及下载内核文件
#校验内核 #校验内核
tar_core "$TMPDIR"/CrashCore.tar.gz core_new tar_core "$TMPDIR"/CrashCore.tar.gz core_new
chmod +x "$TMPDIR"/core_new chmod +x "$TMPDIR"/core_new
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ]; then if echo "$crashcore" | grep -q 'singbox'; then
core_v=$("$TMPDIR"/core_new version 2>/dev/null | grep version | awk '{print $3}') core_v=$("$TMPDIR"/core_new version 2>/dev/null | grep version | awk '{print $3}')
COMMAND='"$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"' COMMAND='"$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"'
else else
@@ -2136,8 +2134,8 @@ clash_check() { #clash启动前检查
return 0 return 0
} }
singbox_check() { #singbox启动前检查 singbox_check() { #singbox启动前检查
#检测PuerNya专属功能 #检测singboxr专属功能
[ "$crashcore" != "singboxp" ] && [ -n "$(cat "$CRASHDIR"/jsons/*.json | grep -oE '"shadowsocksr"|"providers"')" ] && core_exchange singboxp 'PuerNya内核专属功能' [ "$crashcore" != "singboxr" ] && [ -n "$(cat "$CRASHDIR"/jsons/*.json | grep -oE '"shadowsocksr"|"providers"')" ] && core_exchange singboxr 'singboxr内核专属功能'
core_check core_check
#预下载geoip-cn.srs数据库 #预下载geoip-cn.srs数据库
[ -n "$(cat "$CRASHDIR"/jsons/*.json | grep -oEi '"rule_set" *: *"geoip-cn"')" ] && ckgeo geoip-cn.srs srs_geoip_cn.srs [ -n "$(cat "$CRASHDIR"/jsons/*.json | grep -oEi '"rule_set" *: *"geoip-cn"')" ] && ckgeo geoip-cn.srs srs_geoip_cn.srs
@@ -2182,7 +2180,7 @@ bfstart() { #启动前
[ ! -s "$BINDIR"/ui/index.html ] && makehtml #如没有面板则创建跳转界面 [ ! -s "$BINDIR"/ui/index.html ] && makehtml #如没有面板则创建跳转界面
catpac #生成pac文件 catpac #生成pac文件
#内核及内核配置文件检查 #内核及内核配置文件检查
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ]; then if echo "$crashcore" | grep -q 'singbox'; then
singbox_check singbox_check
[ -d "$TMPDIR"/jsons ] && rm -rf "$TMPDIR"/jsons/* || mkdir -p "$TMPDIR"/jsons #准备目录 [ -d "$TMPDIR"/jsons ] && rm -rf "$TMPDIR"/jsons/* || mkdir -p "$TMPDIR"/jsons #准备目录
[ "$disoverride" != "1" ] && modify_json2 || ln -sf $core_config "$TMPDIR"/jsons/config.json [ "$disoverride" != "1" ] && modify_json2 || ln -sf $core_config "$TMPDIR"/jsons/config.json
@@ -2377,7 +2375,7 @@ debug)
stop_firewall >/dev/null #清理路由策略 stop_firewall >/dev/null #清理路由策略
bfstart bfstart
if [ -n "$2" ]; then if [ -n "$2" ]; then
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ]; then if echo "$crashcore" | grep -q 'singbox'; then
sed -i "s/\"level\": \"info\"/\"level\": \"$2\"/" "$TMPDIR"/jsons/log.json 2>/dev/null sed -i "s/\"level\": \"info\"/\"level\": \"$2\"/" "$TMPDIR"/jsons/log.json 2>/dev/null
else else
sed -i "s/log-level: info/log-level: $2/" "$TMPDIR"/config.yaml sed -i "s/log-level: info/log-level: $2/" "$TMPDIR"/config.yaml

View File

@@ -32,7 +32,7 @@ update_core(){ #自动更新内核
logger "任务【自动更新内核】中止-未检测到版本更新" logger "任务【自动更新内核】中止-未检测到版本更新"
exit 1 exit 1
else else
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_new=singbox || core_new=clash echo "$crashcore" | grep -q 'singbox' && core_new=singbox || core_new=clash
if [ -n "$custcorelink" ];then if [ -n "$custcorelink" ];then
zip_type=$(echo $custcorelink | grep -oE 'tar.gz$') zip_type=$(echo $custcorelink | grep -oE 'tar.gz$')
[ -z "$zip_type" ] && zip_type=$(echo $custcorelink | grep -oE 'gz$') [ -z "$zip_type" ] && zip_type=$(echo $custcorelink | grep -oE 'gz$')
@@ -60,7 +60,7 @@ update_core(){ #自动更新内核
[ -f ${TMPDIR}/core_new.gz ] && gunzip ${TMPDIR}/core_new.gz >/dev/null && rm -rf ${TMPDIR}/core_new.gz [ -f ${TMPDIR}/core_new.gz ] && gunzip ${TMPDIR}/core_new.gz >/dev/null && rm -rf ${TMPDIR}/core_new.gz
chmod +x ${TMPDIR}/core_new chmod +x ${TMPDIR}/core_new
[ "$crashcore" = unknow ] && setcoretype [ "$crashcore" = unknow ] && setcoretype
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then if echo "$crashcore" | grep -q 'singbox';then
core_v=$(${TMPDIR}/core_new version 2>/dev/null | grep version | awk '{print $3}') core_v=$(${TMPDIR}/core_new version 2>/dev/null | grep version | awk '{print $3}')
else else
core_v=$(${TMPDIR}/core_new -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //') core_v=$(${TMPDIR}/core_new -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')

View File

@@ -96,7 +96,7 @@ setrules(){ #自定义规则
echo -e " 1 新增自定义规则" echo -e " 1 新增自定义规则"
echo -e " 2 移除自定义规则" echo -e " 2 移除自定义规则"
echo -e " 3 清空规则列表" echo -e " 3 清空规则列表"
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] || echo -e " 4 配置节点绕过: \033[36m$proxies_bypass\033[0m" echo "$crashcore" | grep -q 'singbox' || echo -e " 4 配置节点绕过: \033[36m$proxies_bypass\033[0m"
echo -e " 0 返回上级菜单" echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
case $num in case $num in
@@ -548,7 +548,6 @@ setproviders(){ #自定义providers
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[33m你可以在这里快捷管理与生成自定义的providers服务商\033[0m" echo -e "\033[33m你可以在这里快捷管理与生成自定义的providers服务商\033[0m"
echo -e "\033[33m支持在线及本地的Yaml格式配置导入\033[0m" echo -e "\033[33m支持在线及本地的Yaml格式配置导入\033[0m"
echo -e "\033[36msingboxp内核暂不支持跳过证书验证功能\033[0m"
[ -s $CRASHDIR/configs/providers.cfg ] && { [ -s $CRASHDIR/configs/providers.cfg ] && {
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[36m输入对应数字可管理providers服务商\033[0m" echo -e "\033[36m输入对应数字可管理providers服务商\033[0m"
@@ -641,7 +640,7 @@ setproviders(){ #自定义providers
c) c)
echo ----------------------------------------------- echo -----------------------------------------------
if [ -s $CRASHDIR/configs/providers.cfg ];then if [ -s $CRASHDIR/configs/providers.cfg ];then
echo -e "\033[33msingboxp与mihomo内核的providers配置文件不互通\033[0m" echo -e "\033[33msingboxr与mihomo内核的providers配置文件不互通\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
read -p "确认生成${coretype}配置文件?(1/0) > " res read -p "确认生成${coretype}配置文件?(1/0) > " res
[ "$res" = "1" ] && { [ "$res" = "1" ] && {
@@ -750,7 +749,7 @@ override(){ #配置文件覆写
echo ----------------------------------------------- echo -----------------------------------------------
echo -e " 1 自定义\033[32m端口及秘钥\033[0m" echo -e " 1 自定义\033[32m端口及秘钥\033[0m"
echo -e " 2 管理\033[36m自定义规则\033[0m" echo -e " 2 管理\033[36m自定义规则\033[0m"
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] || { echo "$crashcore" | grep -q 'singbox' || {
echo -e " 3 管理\033[33m自定义节点\033[0m" echo -e " 3 管理\033[33m自定义节点\033[0m"
echo -e " 4 管理\033[36m自定义策略组\033[0m" echo -e " 4 管理\033[36m自定义策略组\033[0m"
} }
@@ -789,7 +788,7 @@ override(){ #配置文件覆写
override override
;; ;;
5) 5)
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && set_singbox_adv || set_clash_adv echo "$crashcore" | grep -q 'singbox' && set_singbox_adv || set_clash_adv
sleep 3 sleep 3
override override
;; ;;
@@ -1022,7 +1021,7 @@ set_core_config_link(){ #直接导入配置
set_core_config(){ #配置文件功能 set_core_config(){ #配置文件功能
[ -z "$rule_link" ] && rule_link=1 [ -z "$rule_link" ] && rule_link=1
[ -z "$server_link" ] && server_link=1 [ -z "$server_link" ] && server_link=1
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml echo "$crashcore" | grep -q 'singbox' && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[30;47m ShellCrash配置文件管理\033[0m" echo -e "\033[30;47m ShellCrash配置文件管理\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
@@ -1076,7 +1075,7 @@ set_core_config(){ #配置文件功能
if [ "$crashcore" = meta -o "$crashcore" = clashpre ];then if [ "$crashcore" = meta -o "$crashcore" = clashpre ];then
coretype=clash coretype=clash
setproviders setproviders
elif [ "$crashcore" = singboxp ];then elif [ "$crashcore" = singboxr ];then
coretype=singbox coretype=singbox
setproviders setproviders
else else
@@ -1254,22 +1253,22 @@ setcpucore(){ #手动设置内核架构
fi fi
} }
setcoretype(){ #手动指定内核类型 setcoretype(){ #手动指定内核类型
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_old=singbox || core_old=clash echo "$crashcore" | grep -q 'singbox' && core_old=singbox || core_old=clash
echo -e "\033[33m请确认该自定义内核的类型\033[0m" echo -e "\033[33m请确认该自定义内核的类型\033[0m"
echo -e " 1 Clash基础内核" echo -e " 1 Clash基础内核"
echo -e " 2 Clash-Premium内核" echo -e " 2 Clash-Premium内核"
echo -e " 3 Clash-Meta内核" echo -e " 3 Clash-Meta内核"
echo -e " 4 Sing-Box内核" echo -e " 4 Sing-Box内核"
echo -e " 5 Sing-Box-Puer内核" echo -e " 5 Sing-Box-reF1nd内核"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
case "$num" in case "$num" in
2) crashcore=clashpre ;; 2) crashcore=clashpre ;;
3) crashcore=meta ;; 3) crashcore=meta ;;
4) crashcore=singbox ;; 4) crashcore=singbox ;;
5) crashcore=singboxp ;; 5) crashcore=singboxr ;;
*) crashcore=clash ;; *) crashcore=clash ;;
esac esac
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_new=singbox || core_new=clash echo "$crashcore" | grep -q 'singbox' && core_new=singbox || core_new=clash
} }
switch_core(){ #clash与singbox内核切换 switch_core(){ #clash与singbox内核切换
#singbox和clash内核切换时提示是否保留文件 #singbox和clash内核切换时提示是否保留文件
@@ -1296,7 +1295,7 @@ switch_core(){ #clash与singbox内核切换
done done
} }
} }
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then if echo "$crashcore" | grep -q 'singbox';then
COMMAND='"$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"' COMMAND='"$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons"'
else else
COMMAND='"$TMPDIR/CrashCore -d $BINDIR -f $TMPDIR/config.yaml"' COMMAND='"$TMPDIR/CrashCore -d $BINDIR -f $TMPDIR/config.yaml"'
@@ -1304,9 +1303,9 @@ switch_core(){ #clash与singbox内核切换
setconfig COMMAND "$COMMAND" ${CRASHDIR}/configs/command.env && source ${CRASHDIR}/configs/command.env setconfig COMMAND "$COMMAND" ${CRASHDIR}/configs/command.env && source ${CRASHDIR}/configs/command.env
} }
getcore(){ #下载内核文件 getcore(){ #下载内核文件
[ -z "$crashcore" ] && crashcore=singbox [ -z "$crashcore" ] && crashcore=meta
[ -z "$cpucore" ] && getcpucore [ -z "$cpucore" ] && getcpucore
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_new=singbox || core_new=clash echo "$crashcore" | grep -q 'singbox' && core_new=singbox || core_new=clash
#获取在线内核文件 #获取在线内核文件
echo ----------------------------------------------- echo -----------------------------------------------
echo 正在在线获取$crashcore核心文件…… echo 正在在线获取$crashcore核心文件……
@@ -1340,7 +1339,7 @@ getcore(){ #下载内核文件
[ -f ${TMPDIR}/core_new.gz ] && gunzip ${TMPDIR}/core_new.gz && rm -rf ${TMPDIR}/core_new.gz [ -f ${TMPDIR}/core_new.gz ] && gunzip ${TMPDIR}/core_new.gz && rm -rf ${TMPDIR}/core_new.gz
chmod +x ${TMPDIR}/core_new chmod +x ${TMPDIR}/core_new
[ "$crashcore" = unknow ] && setcoretype [ "$crashcore" = unknow ] && setcoretype
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then if echo "$crashcore" | grep -q 'singbox';then
core_v=$(${TMPDIR}/core_new version 2>/dev/null | grep version | awk '{print $3}') core_v=$(${TMPDIR}/core_new version 2>/dev/null | grep version | awk '{print $3}')
else else
core_v=$(${TMPDIR}/core_new -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //') core_v=$(${TMPDIR}/core_new -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')
@@ -1429,10 +1428,9 @@ setcustcore(){ #自定义内核
echo -e "\033[33m请选择需要使用的核心\033[0m" echo -e "\033[33m请选择需要使用的核心\033[0m"
echo -e "1 \033[36mMetaCubeX/mihomo\033[32m@release\033[0m版本内核" echo -e "1 \033[36mMetaCubeX/mihomo\033[32m@release\033[0m版本内核"
echo -e "2 \033[36mMetaCubeX/mihomo\033[32m@alpha\033[0m版本内核" echo -e "2 \033[36mMetaCubeX/mihomo\033[32m@alpha\033[0m版本内核"
echo -e "3 \033[36myaling888/clash\033[32m@release\033[0m版本内核"
echo -e "4 \033[36mSagerNet/sing-box\033[32m@release\033[0m版本内核" echo -e "4 \033[36mSagerNet/sing-box\033[32m@release\033[0m版本内核"
echo -e "5 \033[36mPuerNya/sing-box\033[0m内核(with_gvisor,with_wireguard)" echo -e "5 \033[36mreF1nd/sing-box\033[0m内核(with_gvisor,with_wireguard)"
echo -e "6 \033[36mSagerNet/sing-box\033[32m@1.7.8\033[0m版本内核(不支持rule-set)" echo -e "6 Clash基础内核(已停止维护)"
echo -e "7 Premium-2023.08.17内核(已停止维护)" echo -e "7 Premium-2023.08.17内核(已停止维护)"
echo -e "a \033[33m自定义内核链接 \033[0m" echo -e "a \033[33m自定义内核链接 \033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
@@ -1450,12 +1448,6 @@ setcustcore(){ #自定义内核
crashcore=meta crashcore=meta
checkcustcore checkcustcore
;; ;;
3)
project=yaling888/clash
api_tag=latest
crashcore=clashpre
checkcustcore
;;
4) 4)
project=SagerNet/sing-box project=SagerNet/sing-box
api_tag=latest api_tag=latest
@@ -1464,14 +1456,14 @@ setcustcore(){ #自定义内核
;; ;;
5) 5)
project=juewuy/ShellCrash project=juewuy/ShellCrash
api_tag=singbox_core_PuerNya api_tag=singbox_core_reF1nd
crashcore=singboxp crashcore=singboxr
checkcustcore checkcustcore
;; ;;
6) 6)
project=SagerNet/sing-box project=juewuy/ShellCrash
api_tag=v1.7.8 api_tag=Clash_Dreamacro
crashcore=singbox crashcore=clash
checkcustcore checkcustcore
;; ;;
7) 7)
@@ -1495,7 +1487,7 @@ setcore(){ #内核选择菜单
#获取核心及版本信息 #获取核心及版本信息
[ -z "$crashcore" ] && crashcore="unknow" [ -z "$crashcore" ] && crashcore="unknow"
[ ! -f ${CRASHDIR}/CrashCore.tar.gz ] && crashcore="未安装核心" [ ! -f ${CRASHDIR}/CrashCore.tar.gz ] && crashcore="未安装核心"
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && core_old=singbox || core_old=clash echo "$crashcore" | grep -q 'singbox' && core_old=singbox || core_old=clash
[ -n "$custcorelink" ] && custcore="$(echo $custcorelink | sed 's#.*github.com##; s#/releases/download/#@#; s#-linux.*$##')" [ -n "$custcorelink" ] && custcore="$(echo $custcorelink | sed 's#.*github.com##; s#/releases/download/#@#; s#-linux.*$##')"
### ###
echo ----------------------------------------------- echo -----------------------------------------------
@@ -1505,15 +1497,12 @@ setcore(){ #内核选择菜单
echo -e "\033[33m请选择需要使用的核心版本\033[0m" echo -e "\033[33m请选择需要使用的核心版本\033[0m"
echo -e "\033[36m如需本地上传请将二进制文件上传至 /tmp 目录后重新运行crash命令\033[0m" echo -e "\033[36m如需本地上传请将二进制文件上传至 /tmp 目录后重新运行crash命令\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "1 \033[43;30m Clash \033[0m \033[32m占用低\033[0m" echo -e "1 \033[43;30m Mihomo \033[0m \033[32m(原meta内核)支持全面\033[0m"
echo -e " >>\033[32m$clash_v \033[33m不支持Tun、Rule-set等\033[0m"
echo -e " 说明文档: \033[36;4mhttps://lancellc.gitbook.io\033[0m"
#echo -e "2 \033[43;30m SingBox \033[0m \033[32m支持全面占用低\033[0m"
#echo -e " >>\033[32m$singbox_v \033[33m不支持providers\033[0m"
#echo -e " 说明文档: \033[36;4mhttps://sing-box.sagernet.org\033[0m"
echo -e "3 \033[43;30m Mihomo \033[0m \033[32m(原meta内核)支持全面\033[0m"
echo -e " >>\033[32m$meta_v \033[33m占用略高GeoSite可能不兼容华硕固件\033[0m" echo -e " >>\033[32m$meta_v \033[33m占用略高GeoSite可能不兼容华硕固件\033[0m"
echo -e " 说明文档: \033[36;4mhttps://wiki.metacubex.one\033[0m" echo -e " 说明文档: \033[36;4mhttps://wiki.metacubex.one\033[0m"
echo -e "2 \033[43;30m SingBoxR \033[0m \033[32m支持全面\033[0m"
echo -e " >>\033[32m$singbox_v \033[33m使用reF1nd增强分支\033[0m"
echo -e " 说明文档: \033[36;4mhttps://github.com/reF1nd/sing-box/tree/reF1nd-main\033[0m"
#echo -e "4 \033[43;30m SingBoxP \033[0m \033[32m支持ssr、providers、dns并发……\033[0m" #echo -e "4 \033[43;30m SingBoxP \033[0m \033[32m支持ssr、providers、dns并发……\033[0m"
#echo -e " >>\033[32m$singboxp_v \033[33mPuerNya分支版本\033[0m" #echo -e " >>\033[32m$singboxp_v \033[33mPuerNya分支版本\033[0m"
#echo -e " 说明文档: \033[36;4mhttps://sing-boxp.dustinwin.top\033[0m" #echo -e " 说明文档: \033[36;4mhttps://sing-boxp.dustinwin.top\033[0m"
@@ -1528,16 +1517,6 @@ setcore(){ #内核选择菜单
0) 0)
;; ;;
1) 1)
crashcore=clash
custcorelink=''
getcore
;;
2)
crashcore=singbox
custcorelink=''
getcore
;;
3)
[ -d "/jffs" ] && { [ -d "/jffs" ] && {
echo -e "\033[31mMeta内核使用的GeoSite.dat数据库在华硕设备存在被系统误删的问题可能无法使用!\033[0m" echo -e "\033[31mMeta内核使用的GeoSite.dat数据库在华硕设备存在被系统误删的问题可能无法使用!\033[0m"
sleep 3 sleep 3
@@ -1546,6 +1525,11 @@ setcore(){ #内核选择菜单
custcorelink='' custcorelink=''
getcore getcore
;; ;;
2)
crashcore=singboxr
custcorelink=''
getcore
;;
4) 4)
crashcore=singboxp crashcore=singboxp
custcorelink='' custcorelink=''
@@ -2233,8 +2217,10 @@ update(){
echo -e "感谢:\033[32msing-box项目 \033[0m作者\033[36m SagerNet\033[0m 项目地址:\033[32mhttps://github.com/SagerNet/sing-box\033[0m" echo -e "感谢:\033[32msing-box项目 \033[0m作者\033[36m SagerNet\033[0m 项目地址:\033[32mhttps://github.com/SagerNet/sing-box\033[0m"
echo -e "感谢:\033[32mMetaCubeX项目 \033[0m作者\033[36m MetaCubeX\033[0m 项目地址:\033[32mhttps://github.com/MetaCubeX\033[0m" echo -e "感谢:\033[32mMetaCubeX项目 \033[0m作者\033[36m MetaCubeX\033[0m 项目地址:\033[32mhttps://github.com/MetaCubeX\033[0m"
echo -e "感谢:\033[32mYACD面板项目 \033[0m作者\033[36m haishanh\033[0m 项目地址:\033[32mhttps://github.com/haishanh/yacd\033[0m" echo -e "感谢:\033[32mYACD面板项目 \033[0m作者\033[36m haishanh\033[0m 项目地址:\033[32mhttps://github.com/haishanh/yacd\033[0m"
echo -e "感谢:\033[32mzashboard项目 \033[0m作者\033[36m Zephyruso\033[0m 项目地址:\033[32mhttps://github.com/Zephyruso/zashboard\033[0m"
echo -e "感谢:\033[32mSubconverter \033[0m作者\033[36m tindy2013\033[0m 项目地址:\033[32mhttps://github.com/tindy2013/subconverter\033[0m" echo -e "感谢:\033[32mSubconverter \033[0m作者\033[36m tindy2013\033[0m 项目地址:\033[32mhttps://github.com/tindy2013/subconverter\033[0m"
echo -e "感谢:\033[32msing-box分支项目 \033[0m作者\033[36m PuerNya\033[0m 项目地址:\033[32mhttps://github.com/PuerNya/sing-box\033[0m" echo -e "感谢:\033[32msing-box分支项目 \033[0m作者\033[36m PuerNya\033[0m 项目地址:\033[32mhttps://github.com/PuerNya/sing-box\033[0m"
echo -e "感谢:\033[32msing-box分支项目 \033[0m作者\033[36m reF1nd\033[0m 项目地址:\033[32mhttps://github.com/reF1nd/sing-box\033[0m"
echo -e "感谢:\033[32mDustinWin相关项目 \033[0m作者\033[36m DustinWin\033[0m 作者地址:\033[32mhttps://github.com/DustinWin\033[0m" echo -e "感谢:\033[32mDustinWin相关项目 \033[0m作者\033[36m DustinWin\033[0m 作者地址:\033[32mhttps://github.com/DustinWin\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "特别感谢:\033[36m所有帮助及赞助过此项目的同仁们\033[0m" echo -e "特别感谢:\033[36m所有帮助及赞助过此项目的同仁们\033[0m"
@@ -2417,7 +2403,7 @@ userguide(){
} }
#测试菜单 #测试菜单
debug(){ debug(){
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && config_tmp=$TMPDIR/jsons || config_tmp=$TMPDIR/config.yaml echo "$crashcore" | grep -q 'singbox' && config_tmp=$TMPDIR/jsons || config_tmp=$TMPDIR/config.yaml
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[36m注意Debug运行均会停止原本的内核服务\033[0m" echo -e "\033[36m注意Debug运行均会停止原本的内核服务\033[0m"
echo -e "后台运行日志地址:\033[32m$TMPDIR/debug.log\033[0m" echo -e "后台运行日志地址:\033[32m$TMPDIR/debug.log\033[0m"
@@ -2441,7 +2427,7 @@ debug(){
1) 1)
$CRASHDIR/start.sh stop $CRASHDIR/start.sh stop
$CRASHDIR/start.sh bfstart $CRASHDIR/start.sh bfstart
if [ "$crashcore" = singbox -o "$crashcore" = singboxp ] ;then if echo "$crashcore" | grep -q 'singbox' ;then
$TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons & $TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons &
{ sleep 4 ; kill $! >/dev/null 2>&1 & } { sleep 4 ; kill $! >/dev/null 2>&1 & }
wait wait
@@ -2493,7 +2479,7 @@ debug(){
esac esac
} }
testcommand(){ testcommand(){
[ "$crashcore" = singbox -o "$crashcore" = singboxp ] && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml echo "$crashcore" | grep -q 'singbox' && config_path=${JSONSDIR}/config.json || config_path=${YAMLSDIR}/config.yaml
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[30;47m这里是测试命令菜单\033[0m" echo -e "\033[30;47m这里是测试命令菜单\033[0m"
echo -e "\033[33m如遇问题尽量运行相应命令后截图提交issue或TG讨论组\033[0m" echo -e "\033[33m如遇问题尽量运行相应命令后截图提交issue或TG讨论组\033[0m"