35 Commits

Author SHA1 Message Date
juewuy
ff7d454432 Merge pull request #1307 from DustinWin/dev
适配 sing-box 内核规则集新特性
2026-07-20 00:06:56 +08:00
DustinWin
cc56656695 适配 sing-box 内核规则集新特性
`route.rule_set.tag` 支持了数组,修改后避免报错“cn 规则集重复”。
2026-07-18 22:47:17 +08:00
juewuy
6ed020a864 ~修复中文括号 2026-07-18 20:36:07 +08:00
juewuy
a6e6907e86 ~1.9.5beta1 pkg 2026-07-18 20:19:51 +08:00
juewuy
c71fcce870 ~给没有 CIDR 前缀的裸 IP 补 /32 2026-07-18 20:16:51 +08:00
juewuy
0f2a0b437c ~修复语法错误 2026-07-18 20:08:06 +08:00
juewuy
8b8d47c633 ~优化文件结构 2026-07-18 19:45:22 +08:00
juewuy
7df1d7aafa ~修复提示 2026-07-18 19:35:13 +08:00
juewuy
71c21fa26d ~修复错误链接 2026-07-14 15:11:50 +08:00
juewuy
7ba46d0d2d ~1.9.5alpha15 pkg 2026-07-14 10:47:54 +08:00
juewuy
947d93d3ea ~适配singbox1.14+版本内核
~修复debug模式提示找不到内核的bug
2026-07-14 10:47:13 +08:00
juewuy
bc26306ebd ~修复文件格式 2026-07-14 09:56:54 +08:00
juewuy
021960fbe7 ~增加梅林固件启动时优化系统默认内存检测机制 2026-07-14 08:41:16 +08:00
juewuy
655c9aaa07 ~修复版本号不更新的bug 2026-07-13 18:24:14 +08:00
juewuy
34b1fc3126 ~为upx版本mihomo内核添加no_tailscale参数 2026-07-13 17:11:00 +08:00
juewuy
bda31de05d ~修复在线更新订阅定时任务失效的bug 2026-07-13 17:00:50 +08:00
juewuy
2ef92f42ed ~将fakeip地址从28.0.0.0/8调整为198.18.0.0/15 2026-07-13 15:48:34 +08:00
juewuy
7603a480cd ~修复自定义DNS劫持端口界面的错误提示文本 2026-07-13 15:41:43 +08:00
juewuy
9401a48c02 ~修复安装目录末尾会包含/的bug 2026-07-13 15:30:48 +08:00
juewuy
47e50ee608 ~修复部分华硕设备提示找不到crontab的bug 2026-07-13 15:30:21 +08:00
juewuy
5cf7aba112 ~修复容器劫持开关失效的bug 2026-07-13 15:23:13 +08:00
juewuy
b2d8ad9774 ~适配1.14+版本singbox内核 2026-07-13 15:10:50 +08:00
juewuy
a3f2aa9b96 Merge pull request #1284 from wray-lee/patch-1
修复某些情况下引入的default字段污染变量
2026-07-13 14:24:01 +08:00
juewuy
4c1e4ab036 Merge pull request #1272 from fyzhu/patch-2
Fix welcome message formatting in install_en.sh
2026-07-13 14:23:23 +08:00
juewuy
c100d0312d Merge pull request #1271 from fyzhu/patch-1
fix sed error
2026-07-13 14:22:57 +08:00
juewuy
baaad12501 Merge pull request #1293 from kannakamuiuwu/dev
fix: 修复iptables放行端口添加过多导致溢出的错误
2026-07-13 14:12:27 +08:00
juewuy
3c838f2dda Merge pull request #1301 from abcfy2/fix/ecs-dns-empty-client-subnet
修复 singbox 内核 ECS 获取失败导致启动 FATAL
2026-07-13 14:09:30 +08:00
Feng Yu
c4532c979f fix(ecs): 公网IP轮询加IPv4校验,新增oray源,避免错误页伪成功
原轮询 [ -n "$ip" ] 只判非空,members.3322.org 被限流返回 429 HTML
错误页时也判为成功 return,后续更可靠的源不会被尝试。

- 每个响应用 grep -oE 提取合法 IPv4,提取失败(HTML/空)则继续下一个
- 新增 http://ddns.oray.com/checkip 放首位(响应含 'Current IP Address:'
  前缀,grep 提取末尾 IPv4),比 3322 免费 DDNS 更稳定
- 移除 http://4.ipw.cn(部分运营商 DNS 解析失败)
2026-07-11 22:42:53 +08:00
Feng Yu
d4e0ec8fb0 fix(ecs): singbox 分支补齐 ecs_address 判空,失败时终端告警
singbox_modify.sh 之前 ecs_address 为空时仍写入 client_subnet:"",
导致 sing-box 启动时 netip.ParsePrefix("") 报 'no /' FATAL,
服务无法启动。根因是 get_ecsip.sh 在部分环境(如梅林 resolv.conf
无 # Interface wan 标记、members.3322.org 被限流)下拿不到公网 IP。

- singbox_modify.sh: 与 mihomo 分支对齐,加 [ -n ecs_address ] 判空,
  失败时不写字段并 logger 告警
- clash_modify.sh: logger 补颜色码 33(黄色),使告警同样打印到终端,
  原来无颜色码只写日志文件用户无感知
2026-07-11 22:42:53 +08:00
Kanna Kamui
f89ac976a7 Update fw_stop.sh 2026-06-25 20:59:30 +08:00
Kanna Kamui
c25c7800be fix: 修复iptables放行端口添加过多导致溢出的错误
```
iptables v1.8.10 (nf_tables): too many ports specified
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): too many ports specified
Try `iptables -h' or 'iptables --help' for more information.
```
iptables放行端口添加过多导致溢出
2026-06-25 20:56:00 +08:00
Arias Oscar
ca6e79d864 fix: 修复iptables放行端口添加过多导致溢出的错误 2026-06-25 17:11:53 +08:00
Wray
a2720dbe3e 修复某些情况下引入的default字段污染变量 2026-06-07 22:42:28 +09:00
Wanfung Chu
b66dc2c1b6 Fix welcome message formatting in install_en.sh 2026-05-07 00:33:07 +08:00
Wanfung Chu
d37ffc53e0 fix sed error 2026-05-07 00:24:28 +08:00
28 changed files with 228 additions and 148 deletions

View File

@@ -45,7 +45,7 @@ jobs:
tag1: MetaCubeX/mihomo tag1: MetaCubeX/mihomo
tag2: ${{ needs.get_version.outputs.version }} tag2: ${{ needs.get_version.outputs.version }}
tag4: meta tag4: meta
tag5: "" tag5: no_tailscale
tag6: tar.gz tag6: tar.gz
secrets: inherit secrets: inherit

View File

@@ -259,7 +259,7 @@ jobs:
mkdir -p ./bin/${crashcore} mkdir -p ./bin/${crashcore}
mv -f ./tmp/singbox-linux-* ./bin/${crashcore}/ mv -f ./tmp/singbox-linux-* ./bin/${crashcore}/
rm -fr ./tmp rm -fr ./tmp
[ "${{ inputs.tag6 }}" = tar.gz ] && sed -i "s/${crashcore}_v=.*/${crashcore}_v=${VERSION}/" ./bin/version [ "${{ inputs.tag6 }}" = upx ] && sed -i "s/${crashcore}_v=.*/${crashcore}_v=${VERSION}/" ./bin/version
git config --global user.email "github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"
git add . && git commit -m "更新${crashcore}内核至${VERSION}" || exit 0 git add . && git commit -m "更新${crashcore}内核至${VERSION}" || exit 0
git push git push

Binary file not shown.

View File

@@ -1,4 +1,4 @@
meta_v=v1.19.17 meta_v=v1.19.17
singboxr_v=1.13.0-alpha.27 singboxr_v=1.13.0-alpha.27
versionsh=1.9.5alpha14 versionsh=1.9.5beta1
GeoIP_v=20251205 GeoIP_v=20251205

View File

@@ -62,147 +62,147 @@ rule-providers:
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/ai.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/ai.mrs"
youtube: youtube:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/youtube.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/youtube.mrs"
netflix: netflix:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/netflix.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/netflix.mrs"
telegramip: telegramip:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: ipcidr behavior: ipcidr
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/telegramip.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/telegramip.mrs"
applications: applications:
type: http type: http
format: text format: text
interval: 86400 interval: 86400
behavior: classical behavior: classical
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/applications.list" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/applications.list"
private: private:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/private.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/private.mrs"
privateip: privateip:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: ipcidr behavior: ipcidr
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/privateip.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/privateip.mrs"
networktest: networktest:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/networktest.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/networktest.mrs"
apple-cn: apple-cn:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/apple-cn.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/apple-cn.mrs"
google-cn: google-cn:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/google-cn.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/google-cn.mrs"
googlefcm: googlefcm:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@refs/heads/meta/geo/geosite/googlefcm.mrs" url: "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@meta/geo/geosite/googlefcm.mrs"
steamcn: steamcn:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@refs/heads/meta/geo/geosite/steam@cn.mrs" url: "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@meta/geo/geosite/steam@cn.mrs"
microsoft-cn: microsoft-cn:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/microsoft-cn.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/microsoft-cn.mrs"
games-cn: games-cn:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/games-cn.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/games-cn.mrs"
games: games:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/games.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/games.mrs"
mediaip: mediaip:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: ipcidr behavior: ipcidr
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/mediaip.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/mediaip.mrs"
media: media:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/media.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/media.mrs"
cnip: cnip:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: ipcidr behavior: ipcidr
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/cnip.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/cnip.mrs"
proxy: proxy:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/proxy.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/proxy.mrs"
cn: cn:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/cn.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/cn.mrs"
ads: ads:
type: http type: http
format: mrs format: mrs
interval: 86400 interval: 86400
behavior: domain behavior: domain
proxy: DIRECT proxy: DIRECT
url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/mihomo-ruleset/ads.mrs" url: "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@mihomo-ruleset/ads.mrs"
#规则顺序 #规则顺序
rules: rules:

View File

@@ -84,7 +84,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/private.srs", "path": "./ruleset/private.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/private.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/private.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -92,7 +92,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/ads.srs", "path": "./ruleset/ads.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/ads.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/ads.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -100,7 +100,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/networktest.srs", "path": "./ruleset/networktest.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/networktest.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/networktest.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -108,7 +108,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/applications.srs", "path": "./ruleset/applications.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/applications.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/applications.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -116,7 +116,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/apple-cn.srs", "path": "./ruleset/apple-cn.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/apple-cn.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/apple-cn.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -124,7 +124,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/microsoft-cn.srs", "path": "./ruleset/microsoft-cn.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/microsoft-cn.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/microsoft-cn.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -132,7 +132,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/google-cn.srs", "path": "./ruleset/google-cn.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/google-cn.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/google-cn.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -140,7 +140,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/steamcn.srs", "path": "./ruleset/steamcn.srs",
"url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@refs/heads/sing/geo/geosite/steam%40cn.srs", "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/steam%40cn.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -148,7 +148,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/games-cn.srs", "path": "./ruleset/games-cn.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/games-cn.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/games-cn.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -156,7 +156,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/googlefcm.srs", "path": "./ruleset/googlefcm.srs",
"url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@refs/heads/sing/geo/geosite/googlefcm.srs", "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/googlefcm.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -164,7 +164,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/netflix.srs", "path": "./ruleset/netflix.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/netflix.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/netflix.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -172,7 +172,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/youtube.srs", "path": "./ruleset/youtube.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/youtube.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/youtube.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -180,7 +180,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/ai.srs", "path": "./ruleset/ai.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/ai.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/ai.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -188,7 +188,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/media.srs", "path": "./ruleset/media.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/media.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/media.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -196,7 +196,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/games.srs", "path": "./ruleset/games.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/games.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/games.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -204,7 +204,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/proxy.srs", "path": "./ruleset/proxy.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/proxy.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/proxy.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -212,7 +212,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/cn.srs", "path": "./ruleset/cn.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/cn.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/cn.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -220,7 +220,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/privateip.srs", "path": "./ruleset/privateip.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/privateip.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/privateip.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -228,7 +228,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/telegramip.srs", "path": "./ruleset/telegramip.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/telegramip.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/telegramip.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -236,7 +236,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/mediaip.srs", "path": "./ruleset/mediaip.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/mediaip.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/mediaip.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
}, },
{ {
@@ -244,7 +244,7 @@
"type": "remote", "type": "remote",
"format": "binary", "format": "binary",
"path": "./ruleset/cnip.srs", "path": "./ruleset/cnip.srs",
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@refs/heads/sing-box-ruleset/cnip.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/cnip.srs",
"download_detour": "DIRECT" "download_detour": "DIRECT"
} }
], ],

View File

@@ -22,6 +22,7 @@ grep -qE '/(docker|lxc|kubepods|crio|containerd)/' /proc/1/cgroup 2>/dev/null ||
[ "$systype" = 'container' ] && CRASHDIR='/etc/ShellCrash' [ "$systype" = 'container' ] && CRASHDIR='/etc/ShellCrash'
[ -z "$CRASHDIR" ] && [ -n "$clashdir" ] && CRASHDIR="$clashdir" [ -z "$CRASHDIR" ] && [ -n "$clashdir" ] && CRASHDIR="$clashdir"
[ -z "$CRASHDIR" ] && [ -d /tmp/SC_tmp ] && . /tmp/SC_tmp/menus/set_crashdir.sh && set_crashdir [ -z "$CRASHDIR" ] && [ -d /tmp/SC_tmp ] && . /tmp/SC_tmp/menus/set_crashdir.sh && set_crashdir
CRASHDIR=$(echo "$CRASHDIR" | sed 's#/*$##') #删除末尾的/
TASKCFGDIR="$CRASHDIR"/configs/task TASKCFGDIR="$CRASHDIR"/configs/task
#移动文件 #移动文件
mkdir -p "$CRASHDIR" mkdir -p "$CRASHDIR"

View File

@@ -54,7 +54,7 @@ DNS_CORE_REQUIRE="请使用Mihomo或SingBox内核"
DNS_SET_TO="设为" DNS_SET_TO="设为"
DNS_REMOVE_OK="移除成功" DNS_REMOVE_OK="移除成功"
DNS_REMOVE_FAIL="移除失败" DNS_REMOVE_FAIL="移除失败"
DNS_INPUT_REDIR_PORT="请直接输入旁路由IPV4地址" DNS_INPUT_REDIR_PORT="请输入第三方应用的DNS监听端口"
DNS_INPUT_REDIR_RESET="或输入 r 重置DNS劫持端口" DNS_INPUT_REDIR_RESET="或输入 r 重置DNS劫持端口"
DNS_INPUT_REDIR_BACK="或输入 0 返回上级菜单" DNS_INPUT_REDIR_BACK="或输入 0 返回上级菜单"
DNS_INPUT="请输入" DNS_INPUT="请输入"

View File

@@ -56,7 +56,7 @@ DNS_CORE_REQUIRE="Please use the Mihomo or SingBox core"
DNS_SET_TO="Set to" DNS_SET_TO="Set to"
DNS_REMOVE_OK="Removed successfully" DNS_REMOVE_OK="Removed successfully"
DNS_REMOVE_FAIL="Remove failed" DNS_REMOVE_FAIL="Remove failed"
DNS_INPUT_REDIR_PORT="Please input bypass-router IPv4 address" DNS_INPUT_REDIR_PORT="Please input DNS redirect port"
DNS_INPUT_REDIR_RESET="or input r to reset DNS redirect port" DNS_INPUT_REDIR_RESET="or input r to reset DNS redirect port"
DNS_INPUT_REDIR_BACK="or input 0 to go back" DNS_INPUT_REDIR_BACK="or input 0 to go back"
DNS_INPUT="Please enter" DNS_INPUT="Please enter"

View File

@@ -6,8 +6,9 @@ get_ecs_address() {
[ -n "$ip" ] && return [ -n "$ip" ] && return
done done
. "$CRASHDIR"/libs/web_get_lite.sh . "$CRASHDIR"/libs/web_get_lite.sh
for web in http://members.3322.org/dyndns/getip http://4.ipw.cn http://ipinfo.io/ip; do #轮询公网IP提取并校验为合法IPv4才采用否则继续尝试下一个
ip=$(web_get_lite "$web" 0) for web in http://ddns.oray.com/checkip http://members.3322.org/dyndns/getip http://ipinfo.io/ip; do
ip=$(web_get_lite "$web" 0 | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' | tail -1)
[ -n "$ip" ] && return [ -n "$ip" ] && return
done done
} }

View File

@@ -4,6 +4,8 @@
[ "$ts_service" = ON ] && ! grep -q '"tailscale"' "$CRASHDIR"/jsons/endpoints.json 2>/dev/null && { [ "$ts_service" = ON ] && ! grep -q '"tailscale"' "$CRASHDIR"/jsons/endpoints.json 2>/dev/null && {
[ "$ts_subnet" = true ] && { [ "$ts_subnet" = true ] && {
. "$CRASHDIR"/starts/fw_getlanip.sh && getlanip . "$CRASHDIR"/starts/fw_getlanip.sh && getlanip
# 给没有 CIDR 前缀的裸 IP 补 /32
host_ipv4=$(echo $host_ipv4 | awk '{for(i=1;i<=NF;i++){if($i !~ /\//){$i=$i"/32"}} print}')
advertise_routes=$(echo "$host_ipv4"|sed 's/[[:space:]]\+/", "/g; s/^/"/; s/$/"/') advertise_routes=$(echo "$host_ipv4"|sed 's/[[:space:]]\+/", "/g; s/^/"/; s/$/"/')
} }
[ -z "$ts_exit_node" ] && ts_exit_node=false [ -z "$ts_exit_node" ] && ts_exit_node=false

View File

@@ -11,7 +11,7 @@ touch "$tmpcron"
cronadd() { #定时任务工具 cronadd() { #定时任务工具
if crontab -h 2>&1 | grep -q '\-l'; then if crontab -h 2>&1 | grep -q '\-l'; then
crontab "$1" crontab "$1"
elif [ -f "$crondir/$USER" ];then elif [ -w "$crondir" ];then
cat "$1" >"$crondir"/"$USER" && cru a REFRESH "0 0 1 1 * /bin/true" 2>/dev/null cat "$1" >"$crondir"/"$USER" && cru a REFRESH "0 0 1 1 * /bin/true" 2>/dev/null
else else
echo "找不到可用的crond或者crontab应用No available crond or crontab application can be found!" echo "找不到可用的crond或者crontab应用No available crond or crontab application can be found!"

View File

@@ -118,12 +118,12 @@ ckstatus() {
PID=$(pidof CrashCore | awk '{print $NF}') PID=$(pidof CrashCore | awk '{print $NF}')
if [ -n "$PID" ]; then if [ -n "$PID" ]; then
run="\033[32m$MENU_RUN_ON$redir_mod$MENU_MOD\033[0m" run="\033[32m$MENU_RUN_ON ($redir_mod$MENU_MOD) \033[0m"
running_status running_status
elif [ "$firewall_area" = 5 ] && [ -n "$(ip route list table 100)" ]; then elif [ "$firewall_area" = 5 ] && [ -n "$(ip route list table 100)" ]; then
run="\033[32m$MENU_RUN_SET$redir_mod$MENU_MOD\033[0m" run="\033[32m$MENU_RUN_SET ($redir_mod$MENU_MOD) \033[0m"
else else
run="\033[31m$MENU_RUN_OFF$redir_mod$MENU_MOD\033[0m" run="\033[31m$MENU_RUN_OFF ($redir_mod$MENU_MOD) \033[0m"
# 检测系统端口占用 # 检测系统端口占用
checkport checkport
fi fi

View File

@@ -625,6 +625,8 @@ set_firewall_vm() {
common_success common_success
else else
msg_alert "\033[33m$VM_NO_NET_DETECTED\033[0m" msg_alert "\033[33m$VM_NO_NET_DETECTED\033[0m"
set_firewall_vm
return
fi fi
;; ;;
@@ -639,16 +641,12 @@ set_firewall_vm() {
3) 3)
vm_redir=OFF vm_redir=OFF
vm_ipv4='' vm_ipv4=''
common_success
;; ;;
*) ;; *) return ;;
esac esac
case "$num" in common_success
1-3)
setconfig vm_redir "$vm_redir" setconfig vm_redir "$vm_redir"
setconfig vm_ipv4 "'$vm_ipv4'" setconfig vm_ipv4 "'$vm_ipv4'"
;;
esac
} }
# ipv6设置 # ipv6设置

View File

@@ -684,6 +684,7 @@ testcommand() {
} }
debug() { debug() {
rm -f "$CRASHDIR"/\.start_error #移除自启失败标记
echo "$crashcore" | grep -q 'singbox' && config_tmp="$TMPDIR"/jsons || config_tmp="$TMPDIR"/config.yaml echo "$crashcore" | grep -q 'singbox' && config_tmp="$TMPDIR"/jsons || config_tmp="$TMPDIR"/config.yaml
comp_box "\033[36m$TOOLS_DEBUG_WARN1\033[0m" \ comp_box "\033[36m$TOOLS_DEBUG_WARN1\033[0m" \
"${TOOLS_DEBUG_WARN2_PREFIX}\033[32m$TMPDIR/debug.log\033[0m${TOOLS_DEBUG_WARN2_SUFFIX}" \ "${TOOLS_DEBUG_WARN2_PREFIX}\033[32m$TMPDIR/debug.log\033[0m${TOOLS_DEBUG_WARN2_SUFFIX}" \
@@ -705,7 +706,7 @@ debug() {
0) ;; 0) ;;
1) 1)
"$CRASHDIR"/start.sh stop "$CRASHDIR"/start.sh stop
"$CRASHDIR"/start.sh bfstart "$CRASHDIR"/starts/bfstart.sh
if echo "$crashcore" | grep -q 'singbox'; then if echo "$crashcore" | grep -q 'singbox'; then
"$TMPDIR"/CrashCore run -D "$BINDIR" -C "$TMPDIR"/jsons & "$TMPDIR"/CrashCore run -D "$BINDIR" -C "$TMPDIR"/jsons &
{ {

View File

@@ -447,6 +447,12 @@ setcustcore() {
crashcore=singboxr crashcore=singboxr
checkcustcore checkcustcore
;; ;;
6)
project=vernesong/mihomo-oix
api_tag=Pre-Alpha
crashcore=meta
checkcustcore
;;
9) 9)
comp_box "$UPG_CUSTOM_CORE_LINK_HINT" \ comp_box "$UPG_CUSTOM_CORE_LINK_HINT" \
"$UPG_CUSTOM_CORE_LINK_HINT2" \ "$UPG_CUSTOM_CORE_LINK_HINT2" \

View File

@@ -101,7 +101,7 @@ set_dns_mod() {
common_success common_success
break break
else else
msg_alert msg_alert "\033[33m$DNS_REDIR_NO_SERVICE\033[0m"
fi fi
else else
errornum errornum

View File

@@ -129,7 +129,7 @@ web_save_auto(){
. "$CRASHDIR"/libs/web_save.sh && web_save . "$CRASHDIR"/libs/web_save.sh && web_save
} }
update_config() { #更新订阅并重启 update_config() { #更新订阅并重启
. "$CRASHDIR"/starts/core_config.sh && get_core_config && "$CRASHDIR"/start.sh start . "$CRASHDIR"/starts/core_config.sh get_core_config && "$CRASHDIR"/start.sh start
} }
hotupdate() { #热更新订阅 hotupdate() { #热更新订阅
. "$CRASHDIR"/starts/core_config.sh && get_core_config && . "$CRASHDIR"/starts/core_config.sh && get_core_config &&

View File

@@ -120,7 +120,7 @@ userguide() {
read -r -p "$COMMON_INPUT_R" res read -r -p "$COMMON_INPUT_R" res
[ "$res" = 1 ] && { [ "$res" = 1 ] && {
BINDIR=/tmp/ShellCrash BINDIR=/tmp/ShellCrash
sed -i "s#BINDIR=.*#BINDIR=$BINDIR" "$CRASHDIR"/configs/command.env sed -i "s#BINDIR=.*#BINDIR=$BINDIR#" "$CRASHDIR"/configs/command.env
} }
fi fi

View File

@@ -21,7 +21,7 @@ prepare_clash_base_config() {
if [ -n "$ecs_address" ];then if [ -n "$ecs_address" ];then
dns_fallback=$(echo "$dns_fallback, " | sed "s|, |#ecs-override=true\&ecs=$ecs_address, |g" | sed 's|, $||') dns_fallback=$(echo "$dns_fallback, " | sed "s|, |#ecs-override=true\&ecs=$ecs_address, |g" | sed 's|, $||')
else else
logger "自动获取ecs网段失败" logger "自动获取ecs网段失败" 33
fi fi
} }
} }
@@ -37,7 +37,7 @@ dns:
default-nameserver: [ $dns_resolver ] default-nameserver: [ $dns_resolver ]
direct-nameserver: [ $dns_nameserver ] direct-nameserver: [ $dns_nameserver ]
enhanced-mode: fake-ip enhanced-mode: fake-ip
fake-ip-range: 28.0.0.0/8 fake-ip-range: 198.18.0.0/15
fake-ip-range6: fc00::/16 fake-ip-range6: fc00::/16
fake-ip-filter: fake-ip-filter:
EOF EOF

View File

@@ -2,7 +2,7 @@ getlanip() { #获取局域网host地址
i=1 i=1
while [ "$i" -le "20" ]; do while [ "$i" -le "20" ]; do
#ipv4局域网网段 #ipv4局域网网段
host_ipv4=$(ip route show scope link | grep -Ev 'wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet|wgs|multicast|anycast' | awk '{print $1}') host_ipv4=$(ip route show scope link | grep -Ev 'default|wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet|wgs|multicast|anycast' | awk '{print $1}')
#ipv6局域网网段 - 从IPv4已识别的LAN接口获取全局IPv6前缀 #ipv6局域网网段 - 从IPv4已识别的LAN接口获取全局IPv6前缀
[ "$ipv6_redir" = "ON" ] && { [ "$ipv6_redir" = "ON" ] && {
lan_ifaces=$(ip route show scope link | grep -Ev 'ppp|wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet|wgs|multicast|anycast' | awk '{for(i=1;i<=NF;i++) if($i=="dev") {print $(i+1); break}}' | grep -v '^lo$' | sort -u) lan_ifaces=$(ip route show scope link | grep -Ev 'ppp|wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet|wgs|multicast|anycast' | awk '{for(i=1;i<=NF;i++) if($i=="dev") {print $(i+1); break}}' | grep -v '^lo$' | sort -u)
@@ -30,7 +30,7 @@ getlanip() { #获取局域网host地址
[ -n "$wg_ipv6" ] && wg_host_ipv6=' $wg_ipv6' [ -n "$wg_ipv6" ] && wg_host_ipv6=' $wg_ipv6'
} }
#添加自定义ipv4局域网网段 #添加自定义ipv4局域网网段
if [ "$replace_default_host_ipv4" == "ON" ]; then if [ "$replace_default_host_ipv4" = "ON" ]; then
host_ipv4="$cust_host_ipv4" host_ipv4="$cust_host_ipv4"
else else
host_ipv4=$(echo "$host_ipv4 $cust_host_ipv4$ts_host_ipv4$wg_host_ipv4" | tr '\n' ' ' | sed 's/ $//') host_ipv4=$(echo "$host_ipv4 $cust_host_ipv4$ts_host_ipv4$wg_host_ipv4" | tr '\n' ' ' | sed 's/ $//')

View File

@@ -72,8 +72,23 @@ start_ipt_route() { #iptables-route通用工具
done done
fi fi
#将所在链指定流量指向shellcrash表 #将所在链指定流量指向shellcrash表
"$1" $w -t "$2" -I "$3" -p "$5" $ports -j "$4" if [ -n "$ports" ]; then
[ "$dns_mod" = "mix" -o "$dns_mod" = "fake-ip" ] && [ "$common_ports" = "ON" ] && [ "$1" = iptables ] && "$1" $w -t "$2" -I "$3" -p "$5" -d 28.0.0.0/8 -j "$4" clean_ports=$(echo "$multiport" | sed 's/ //g')
echo "$clean_ports" | awk -F, '{
for(i=1; i<=NF; i+=9) {
group=""
for(j=i; j<i+9 && j<=NF; j++) {
group=(group == "" ? $j : group "," $j)
}
print group
}
}' | while read -r port_group; do
[ -n "$port_group" ] && "$1" $w -t "$2" -I "$3" -p "$5" -m multiport --dports "$port_group" -j "$4"
done
else
"$1" $w -t "$2" -I "$3" -p "$5" -j "$4"
fi
[ "$dns_mod" = "mix" -o "$dns_mod" = "fake-ip" ] && [ "$common_ports" = "ON" ] && [ "$1" = iptables ] && "$1" $w -t "$2" -I "$3" -p "$5" -d 198.18.0.0/15 -j "$4"
[ "$dns_mod" = "mix" -o "$dns_mod" = "fake-ip" ] && [ "$common_ports" = "ON" ] && [ "$1" = ip6tables ] && "$1" $w -t "$2" -I "$3" -p "$5" -d fc00::/16 -j "$4" [ "$dns_mod" = "mix" -o "$dns_mod" = "fake-ip" ] && [ "$common_ports" = "ON" ] && [ "$1" = ip6tables ] && "$1" $w -t "$2" -I "$3" -p "$5" -d fc00::/16 -j "$4"
} }
[ "$5" = "tcp" -o "$5" = "all" ] && proxy_set "$1" "$2" "$3" "$4" tcp [ "$5" = "tcp" -o "$5" = "all" ] && proxy_set "$1" "$2" "$3" "$4" tcp

View File

@@ -38,12 +38,12 @@ start_nft_route() { #nftables-route通用工具
[ -z "$ports" ] && nft add rule inet shellcrash $1 tcp dport {"$mix_port, $redir_port, $tproxy_port"} return [ -z "$ports" ] && nft add rule inet shellcrash $1 tcp dport {"$mix_port, $redir_port, $tproxy_port"} return
#过滤常用端口 #过滤常用端口
[ -n "$PORTS" ] && { [ -n "$PORTS" ] && {
nft add rule inet shellcrash $1 ip daddr != {28.0.0.0/8} tcp dport != {$PORTS} return nft add rule inet shellcrash $1 ip daddr != {198.18.0.0/15} tcp dport != {$PORTS} return
nft add rule inet shellcrash $1 ip daddr != {28.0.0.0/8} udp dport != {$PORTS} return nft add rule inet shellcrash $1 ip daddr != {198.18.0.0/15} udp dport != {$PORTS} return
nft add rule inet shellcrash $1 ip6 daddr != {fc00::/16} tcp dport != {$PORTS} return nft add rule inet shellcrash $1 ip6 daddr != {fc00::/16} tcp dport != {$PORTS} return
nft add rule inet shellcrash $1 ip6 daddr != {fc00::/16} udp dport != {$PORTS} return nft add rule inet shellcrash $1 ip6 daddr != {fc00::/16} udp dport != {$PORTS} return
} }
#nft add rule inet shellcrash $1 ip saddr 28.0.0.0/8 return #nft add rule inet shellcrash $1 ip saddr 198.18.0.0/15 return
nft add rule inet shellcrash $1 ip daddr {$RESERVED_IP} return #过滤保留地址 nft add rule inet shellcrash $1 ip daddr {$RESERVED_IP} return #过滤保留地址
#过滤局域网设备 #过滤局域网设备
[ "$1" = 'prerouting' ] && { [ "$1" = 'prerouting' ] && {

View File

@@ -20,26 +20,46 @@ ckcmd iptables && {
$iptable -t nat -D PREROUTING -p udp --dport 53 -j shellcrash_dns 2>/dev/null $iptable -t nat -D PREROUTING -p udp --dport 53 -j shellcrash_dns 2>/dev/null
$iptable -t nat -D OUTPUT -p udp --dport 53 -j shellcrash_dns_out 2>/dev/null $iptable -t nat -D OUTPUT -p udp --dport 53 -j shellcrash_dns_out 2>/dev/null
$iptable -t nat -D OUTPUT -p tcp --dport 53 -j shellcrash_dns_out 2>/dev/null $iptable -t nat -D OUTPUT -p tcp --dport 53 -j shellcrash_dns_out 2>/dev/null
if [ -n "$ports" ]; then
clean_ports=$(echo "$multiport" | sed 's/ //g')
echo "$clean_ports" | awk -F, '{
for(i=1; i<=NF; i+=9) {
group=""; for(j=i; j<i+9 && j<=NF; j++) group=(group == "" ? $j : group "," $j)
print group
}
}' | while read -r port_group; do
if [ -n "$port_group" ]; then
$iptable -t nat -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrash 2>/dev/null
$iptable -t nat -D OUTPUT -p tcp -m multiport --dports "$port_group" -j shellcrash_out 2>/dev/null
$iptable -t nat -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrash_vm 2>/dev/null
$iptable -t mangle -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrash_mark 2>/dev/null
$iptable -t mangle -D PREROUTING -p udp -m multiport --dports "$port_group" -j shellcrash_mark 2>/dev/null
$iptable -t mangle -D OUTPUT -p tcp -m multiport --dports "$port_group" -j shellcrash_mark_out 2>/dev/null
$iptable -t mangle -D OUTPUT -p udp -m multiport --dports "$port_group" -j shellcrash_mark_out 2>/dev/null
fi
done
else
$iptable -t nat -D PREROUTING -p tcp -j shellcrash 2>/dev/null
$iptable -t nat -D OUTPUT -p tcp -j shellcrash_out 2>/dev/null
$iptable -t nat -D PREROUTING -p tcp -j shellcrash_vm 2>/dev/null
$iptable -t mangle -D PREROUTING -p tcp -j shellcrash_mark 2>/dev/null
$iptable -t mangle -D PREROUTING -p udp -j shellcrash_mark 2>/dev/null
$iptable -t mangle -D OUTPUT -p tcp -j shellcrash_mark_out 2>/dev/null
$iptable -t mangle -D OUTPUT -p udp -j shellcrash_mark_out 2>/dev/null
fi
#redir #redir
$iptable -t nat -D PREROUTING -p tcp $ports -j shellcrash 2>/dev/null $iptable -t nat -D PREROUTING -p tcp -d 198.18.0.0/15 -j shellcrash 2>/dev/null
$iptable -t nat -D PREROUTING -p tcp -d 28.0.0.0/8 -j shellcrash 2>/dev/null $iptable -t nat -D OUTPUT -p tcp -d 198.18.0.0/15 -j shellcrash_out 2>/dev/null
$iptable -t nat -D OUTPUT -p tcp $ports -j shellcrash_out 2>/dev/null
$iptable -t nat -D OUTPUT -p tcp -d 28.0.0.0/8 -j shellcrash_out 2>/dev/null
#vm_dns #vm_dns
$iptable -t nat -D PREROUTING -p tcp --dport 53 -j shellcrash_vm_dns 2>/dev/null $iptable -t nat -D PREROUTING -p tcp --dport 53 -j shellcrash_vm_dns 2>/dev/null
$iptable -t nat -D PREROUTING -p udp --dport 53 -j shellcrash_vm_dns 2>/dev/null $iptable -t nat -D PREROUTING -p udp --dport 53 -j shellcrash_vm_dns 2>/dev/null
#vm_redir #vm_redir
$iptable -t nat -D PREROUTING -p tcp $ports -j shellcrash_vm 2>/dev/null $iptable -t nat -D PREROUTING -p tcp -d 198.18.0.0/15 -j shellcrash_vm 2>/dev/null
$iptable -t nat -D PREROUTING -p tcp -d 28.0.0.0/8 -j shellcrash_vm 2>/dev/null
#TPROXY&tun #TPROXY&tun
$iptable -t mangle -D PREROUTING -p tcp $ports -j shellcrash_mark 2>/dev/null $iptable -t mangle -D PREROUTING -p tcp -d 198.18.0.0/15 -j shellcrash_mark 2>/dev/null
$iptable -t mangle -D PREROUTING -p udp $ports -j shellcrash_mark 2>/dev/null $iptable -t mangle -D PREROUTING -p udp -d 198.18.0.0/15 -j shellcrash_mark 2>/dev/null
$iptable -t mangle -D PREROUTING -p tcp -d 28.0.0.0/8 -j shellcrash_mark 2>/dev/null $iptable -t mangle -D OUTPUT -p tcp -d 198.18.0.0/15 -j shellcrash_mark_out 2>/dev/null
$iptable -t mangle -D PREROUTING -p udp -d 28.0.0.0/8 -j shellcrash_mark 2>/dev/null $iptable -t mangle -D OUTPUT -p udp -d 198.18.0.0/15 -j shellcrash_mark_out 2>/dev/null
$iptable -t mangle -D OUTPUT -p tcp $ports -j shellcrash_mark_out 2>/dev/null
$iptable -t mangle -D OUTPUT -p udp $ports -j shellcrash_mark_out 2>/dev/null
$iptable -t mangle -D OUTPUT -p tcp -d 28.0.0.0/8 -j shellcrash_mark_out 2>/dev/null
$iptable -t mangle -D OUTPUT -p udp -d 28.0.0.0/8 -j shellcrash_mark_out 2>/dev/null
$iptable -t mangle -D PREROUTING -m mark --mark $fwmark -p tcp -j TPROXY --on-port $tproxy_port 2>/dev/null $iptable -t mangle -D PREROUTING -m mark --mark $fwmark -p tcp -j TPROXY --on-port $tproxy_port 2>/dev/null
$iptable -t mangle -D PREROUTING -m mark --mark $fwmark -p udp -j TPROXY --on-port $tproxy_port 2>/dev/null $iptable -t mangle -D PREROUTING -m mark --mark $fwmark -p udp -j TPROXY --on-port $tproxy_port 2>/dev/null
#tun #tun
@@ -73,20 +93,39 @@ ckcmd ip6tables && {
#dns #dns
$ip6table -t nat -D PREROUTING -p tcp --dport 53 -j shellcrashv6_dns 2>/dev/null $ip6table -t nat -D PREROUTING -p tcp --dport 53 -j shellcrashv6_dns 2>/dev/null
$ip6table -t nat -D PREROUTING -p udp --dport 53 -j shellcrashv6_dns 2>/dev/null $ip6table -t nat -D PREROUTING -p udp --dport 53 -j shellcrashv6_dns 2>/dev/null
if [ -n "$ports" ]; then
clean_ports=$(echo "$multiport" | sed 's/ //g')
echo "$clean_ports" | awk -F, '{
for(i=1; i<=NF; i+=9) {
group=""; for(j=i; j<i+9 && j<=NF; j++) group=(group == "" ? $j : group "," $j)
print group
}
}' | while read -r port_group; do
if [ -n "$port_group" ]; then
$ip6table -t nat -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrashv6 2>/dev/null
$ip6table -t nat -D OUTPUT -p tcp -m multiport --dports "$port_group" -j shellcrashv6_out 2>/dev/null
$ip6table -t mangle -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrashv6_mark 2>/dev/null
$ip6table -t mangle -D PREROUTING -p udp -m multiport --dports "$port_group" -j shellcrashv6_mark 2>/dev/null
$ip6table -t mangle -D OUTPUT -p tcp -m multiport --dports "$port_group" -j shellcrashv6_mark_out 2>/dev/null
$ip6table -t mangle -D OUTPUT -p udp -m multiport --dports "$port_group" -j shellcrashv6_mark_out 2>/dev/null
fi
done
else
$ip6table -t nat -D PREROUTING -p tcp -j shellcrashv6 2>/dev/null
$ip6table -t nat -D OUTPUT -p tcp -j shellcrashv6_out 2>/dev/null
$ip6table -t mangle -D PREROUTING -p tcp -j shellcrashv6_mark 2>/dev/null
$ip6table -t mangle -D PREROUTING -p udp -j shellcrashv6_mark 2>/dev/null
$ip6table -t mangle -D OUTPUT -p tcp -j shellcrashv6_mark_out 2>/dev/null
$ip6table -t mangle -D OUTPUT -p udp -j shellcrashv6_mark_out 2>/dev/null
fi
#redir #redir
$ip6table -t nat -D PREROUTING -p tcp $ports -j shellcrashv6 2>/dev/null
$ip6table -t nat -D PREROUTING -p tcp -d fc00::/16 -j shellcrashv6 2>/dev/null $ip6table -t nat -D PREROUTING -p tcp -d fc00::/16 -j shellcrashv6 2>/dev/null
$ip6table -t nat -D OUTPUT -p tcp $ports -j shellcrashv6_out 2>/dev/null
$ip6table -t nat -D OUTPUT -p tcp -d fc00::/16 -j shellcrashv6_out 2>/dev/null $ip6table -t nat -D OUTPUT -p tcp -d fc00::/16 -j shellcrashv6_out 2>/dev/null
$ip6table -D INPUT -p tcp --dport 53 -j REJECT 2>/dev/null $ip6table -D INPUT -p tcp --dport 53 -j REJECT 2>/dev/null
$ip6table -D INPUT -p udp --dport 53 -j REJECT 2>/dev/null $ip6table -D INPUT -p udp --dport 53 -j REJECT 2>/dev/null
#mark #mark
$ip6table -t mangle -D PREROUTING -p tcp $ports -j shellcrashv6_mark 2>/dev/null
$ip6table -t mangle -D PREROUTING -p udp $ports -j shellcrashv6_mark 2>/dev/null
$ip6table -t mangle -D PREROUTING -p tcp -d fc00::/16 -j shellcrashv6_mark 2>/dev/null $ip6table -t mangle -D PREROUTING -p tcp -d fc00::/16 -j shellcrashv6_mark 2>/dev/null
$ip6table -t mangle -D PREROUTING -p udp -d fc00::/16 -j shellcrashv6_mark 2>/dev/null $ip6table -t mangle -D PREROUTING -p udp -d fc00::/16 -j shellcrashv6_mark 2>/dev/null
$ip6table -t mangle -D OUTPUT -p tcp $ports -j shellcrashv6_mark_out 2>/dev/null
$ip6table -t mangle -D OUTPUT -p udp $ports -j shellcrashv6_mark_out 2>/dev/null
$ip6table -t mangle -D OUTPUT -p tcp -d fc00::/16 -j shellcrashv6_mark_out 2>/dev/null $ip6table -t mangle -D OUTPUT -p tcp -d fc00::/16 -j shellcrashv6_mark_out 2>/dev/null
$ip6table -t mangle -D OUTPUT -p udp -d fc00::/16 -j shellcrashv6_mark_out 2>/dev/null $ip6table -t mangle -D OUTPUT -p udp -d fc00::/16 -j shellcrashv6_mark_out 2>/dev/null
$ip6table -D INPUT -p udp --dport 443 $set_cn_ip -j REJECT 2>/dev/null $ip6table -D INPUT -p udp --dport 443 $set_cn_ip -j REJECT 2>/dev/null

View File

@@ -27,5 +27,6 @@ set_profile "$profile"
if [ -f "$CRASHDIR"/.dis_startup ] || [ -f "$CRASHDIR"/.start_error ];then if [ -f "$CRASHDIR"/.dis_startup ] || [ -f "$CRASHDIR"/.start_error ];then
cronset "保守模式守护进程" cronset "保守模式守护进程"
else else
echo 0 > /proc/sys/vm/overcommit_memory #优化系统默认内存检测机制
"$CRASHDIR"/start.sh start "$CRASHDIR"/start.sh start
fi fi

View File

@@ -2,7 +2,8 @@
# Copyright (C) Juewuy # Copyright (C) Juewuy
#修饰singbox配置文件 #修饰singbox配置文件
parse_singbox_dns() { #dns转换
parse_singbox_dns() { #dns转换工具
first_dns=$(echo "$1" | cut -d',' -f1 | cut -d' ' -f1) first_dns=$(echo "$1" | cut -d',' -f1 | cut -d' ' -f1)
type="" type=""
server="" server=""
@@ -41,8 +42,8 @@ parse_singbox_dns() { #dns转换
# 输出 # 输出
echo '"type": "'"$type"'", "server": "'"$server"'", "server_port": '"$port"',' echo '"type": "'"$type"'", "server": "'"$server"'", "server_port": '"$port"','
} }
extract_base_jsons() {
#提取配置文件以获得outbounds.json,providers.json及route.json extract_base_jsons() { #提取配置文件以获得outbounds.json,providers.json及route.json
"$TMPDIR"/CrashCore format -c $core_config >"$TMPDIR"/format.json "$TMPDIR"/CrashCore format -c $core_config >"$TMPDIR"/format.json
echo '{' >"$TMPDIR"/jsons/outbounds.json echo '{' >"$TMPDIR"/jsons/outbounds.json
echo '{' >"$TMPDIR"/jsons/route.json echo '{' >"$TMPDIR"/jsons/route.json
@@ -52,9 +53,34 @@ extract_base_jsons() {
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
} }
cat "$TMPDIR"/format.json | sed -n '/"route":/,/^\( "[a-z]\|}\)/p' | sed '$d' >>"$TMPDIR"/jsons/route.json cat "$TMPDIR"/format.json | sed -n '/"route":/,/^\( "[a-z]\|}\)/p' | sed '$d' >>"$TMPDIR"/jsons/route.json
#清理PASS规则
sed -i 's/"PASS"/"DIRECT"/g' "$TMPDIR"/jsons/outbounds.json
} }
generate_basic_jsons() { generate_basic_jsons() {
#适配1.14+版本
if [ "$(printf '%s' "$core_v" | cut -d. -f2)" -lt 14 ];then
preferred='"ip_accept_any": true,'
detour_direct='"download_detour": "DIRECT"'
else
preferred='"preferred_by": [ "hosts" ],'
detour_direct='"http_client": "detour_direct"'
#生成http_clients.json
cat >"$TMPDIR"/jsons/http_clients.json <<EOF
{
"http_clients": [
{
"tag": "detour_proxy",
"detour": "GLOBAL"
},
{
"tag": "detour_direct",
"detour": "DIRECT"
}
]
}
EOF
fi
#生成endpoints.json #生成endpoints.json
[ "$ts_service" = ON ] || [ "$wg_service" = ON ] && [ "$zip_type" != upx ] && { [ "$ts_service" = ON ] || [ "$wg_service" = ON ] && [ "$zip_type" != upx ] && {
. "$CRASHDIR"/configs/gateway.cfg . "$CRASHDIR"/configs/gateway.cfg
@@ -92,7 +118,7 @@ EOF
], ],
"rules": [ "rules": [
{ {
"preferred_by": [ "hosts" ], $preferred
"server": "hosts" "server": "hosts"
} }
] ]
@@ -102,7 +128,7 @@ EOF
fi fi
} }
prepare_dns_config() { gen_dns() {
#生成dns.json #生成dns.json
[ "$ipv6_dns" != "OFF" ] && strategy='prefer_ipv4' || strategy='ipv4_only' [ "$ipv6_dns" != "OFF" ] && strategy='prefer_ipv4' || strategy='ipv4_only'
#获取detour出口 #获取detour出口
@@ -113,7 +139,11 @@ prepare_dns_config() {
#ecs优化 #ecs优化
[ "$ecs_subnet" = ON ] && { [ "$ecs_subnet" = ON ] && {
. "$CRASHDIR"/libs/get_ecsip.sh . "$CRASHDIR"/libs/get_ecsip.sh
if [ -n "$ecs_address" ]; then
client_subnet='"client_subnet": "'"$ecs_address"'",' client_subnet='"client_subnet": "'"$ecs_address"'",'
else
logger "自动获取ecs网段失败" 33
fi
} }
#根据dns模式生成 #根据dns模式生成
[ "$dns_mod" = "redir_host" ] && { [ "$dns_mod" = "redir_host" ] && {
@@ -128,7 +158,7 @@ prepare_dns_config() {
[ -n "$fake_ip_filter_domain" ] && fake_ip_filter_domain="{ \"domain\": [$fake_ip_filter_domain], \"server\": \"dns_direct\" }," [ -n "$fake_ip_filter_domain" ] && fake_ip_filter_domain="{ \"domain\": [$fake_ip_filter_domain], \"server\": \"dns_direct\" },"
[ -n "$fake_ip_filter_suffix" ] && fake_ip_filter_suffix="{ \"domain_suffix\": [$fake_ip_filter_suffix], \"server\": \"dns_direct\" }," [ -n "$fake_ip_filter_suffix" ] && fake_ip_filter_suffix="{ \"domain_suffix\": [$fake_ip_filter_suffix], \"server\": \"dns_direct\" },"
[ -n "$fake_ip_filter_regex" ] && fake_ip_filter_regex="{ \"domain_regex\": [$fake_ip_filter_regex], \"server\": \"dns_direct\" }," [ -n "$fake_ip_filter_regex" ] && fake_ip_filter_regex="{ \"domain_regex\": [$fake_ip_filter_regex], \"server\": \"dns_direct\" },"
proxy_dns='{ "query_type": ["A", "AAAA"], "server": "dns_fakeip", "strategy": "'"$strategy"'", "rewrite_ttl": 1 }' proxy_dns='{ "query_type": ["A", "AAAA"], "server": "dns_fakeip", "rewrite_ttl": 1 }'
#mix模式插入fakeip过滤规则 #mix模式插入fakeip过滤规则
[ "$dns_mod" = "mix" ] && direct_dns='{ "rule_set": ["cn"], "server": "dns_direct" },' [ "$dns_mod" = "mix" ] && direct_dns='{ "rule_set": ["cn"], "server": "dns_direct" },'
} }
@@ -138,11 +168,8 @@ prepare_dns_config() {
} }
#防泄露设置 #防泄露设置
[ "$dns_protect" = "OFF" ] && sed -i 's/"server": "dns_proxy"/"server": "dns_direct"/g' "$TMPDIR"/jsons/route.json [ "$dns_protect" = "OFF" ] && sed -i 's/"server": "dns_proxy"/"server": "dns_direct"/g' "$TMPDIR"/jsons/route.json
}
generate_dns_related_jsons() {
#生成add_rule_set.json #生成add_rule_set.json
[ "$dns_mod" = "mix" ] || [ "$dns_mod" = "route" ] && ! grep -Eq '"tag" *:[[:space:]]*"cn"' "$CRASHDIR"/jsons/*.json && { [ "$dns_mod" = "mix" ] || [ "$dns_mod" = "route" ] && ! grep -Eq '"tag" *:[[:space:]]*"cn"' "$CRASHDIR"/jsons/*.json && ! grep -Eq '"tag"[[:space:]]*:[[:space:]]*\[[^]]*"cn"' "$CRASHDIR"/jsons/*.json && {
[ "$crashcore" = "singboxr" ] && srs_path='"path": "./ruleset/cn.srs",' [ "$crashcore" = "singboxr" ] && srs_path='"path": "./ruleset/cn.srs",'
cat >"$TMPDIR"/jsons/add_rule_set.json <<EOF cat >"$TMPDIR"/jsons/add_rule_set.json <<EOF
{ {
@@ -154,7 +181,7 @@ generate_dns_related_jsons() {
"format": "binary", "format": "binary",
$srs_path $srs_path
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/cn.srs", "url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/cn.srs",
"http_client": "detour_direct" $detour_direct
} }
] ]
} }
@@ -181,7 +208,7 @@ EOF
{ {
"tag": "dns_fakeip", "tag": "dns_fakeip",
"type": "fakeip", "type": "fakeip",
"inet4_range": "28.0.0.0/8", "inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/16" "inet6_range": "fc00::/16"
}, },
{ {
@@ -196,18 +223,17 @@ EOF
} }
], ],
"rules": [ "rules": [
{ "clash_mode": "Direct", "server": "dns_direct", "strategy": "$strategy" }, { "clash_mode": "Direct", "server": "dns_direct" },
{ "domain_suffix": ["services.googleapis.cn"], "server": "dns_fakeip", "strategy": "$strategy", "rewrite_ttl": 1 }, { "domain_suffix": ["services.googleapis.cn"], "server": "dns_fakeip", "rewrite_ttl": 1 },
$fake_ip_filter_domain $fake_ip_filter_domain
$fake_ip_filter_suffix $fake_ip_filter_suffix
$fake_ip_filter_regex $fake_ip_filter_regex
{ "clash_mode": "Global", "query_type": ["A", "AAAA"], "server": "$global_dns", "strategy": "$strategy", "rewrite_ttl": 1 }, { "clash_mode": "Global", "query_type": ["A", "AAAA"], "server": "$global_dns", "rewrite_ttl": 1 },
$direct_dns $direct_dns
$proxy_dns $proxy_dns
], ],
"final": "dns_proxy", "final": "dns_proxy",
"strategy": "$strategy", "strategy": "$strategy",
"independent_cache": true,
$client_subnet $client_subnet
"reverse_mapping": true "reverse_mapping": true
} }
@@ -215,7 +241,7 @@ EOF
EOF EOF
} }
generate_route_and_inbounds_jsons() { gen_outbounds() {
#生成add_route.json #生成add_route.json
#域名嗅探配置 #域名嗅探配置
grep -q 'telegramip' "$TMPDIR"/jsons/route.json && telegramip_set=' "rule_set": [ "telegramip" ],' grep -q 'telegramip' "$TMPDIR"/jsons/route.json && telegramip_set=' "rule_set": [ "telegramip" ],'
@@ -236,7 +262,9 @@ generate_route_and_inbounds_jsons() {
} }
} }
EOF EOF
#生成certificate.json }
gen_certificate() { #生成certificate.json
cat >"$TMPDIR"/jsons/certificate.json <<EOF cat >"$TMPDIR"/jsons/certificate.json <<EOF
{ {
"certificate": { "certificate": {
@@ -244,7 +272,9 @@ EOF
} }
} }
EOF EOF
#生成inbounds.json }
gen_inbounds() { #生成inbounds.json
[ -n "$authentication" ] && { [ -n "$authentication" ] && {
username=$(echo $authentication | awk -F ':' '{print $1}') #混合端口账号密码 username=$(echo $authentication | awk -F ':' '{print $1}') #混合端口账号密码
password=$(echo $authentication | awk -F ':' '{print $2}') password=$(echo $authentication | awk -F ':' '{print $2}')
@@ -297,7 +327,7 @@ EOF
"interface_name": "utun", "interface_name": "utun",
"address": [ "address": [
$ipv6_address $ipv6_address
"28.0.0.1/30" "198.18.0.1/15"
], ],
"auto_route": false, "auto_route": false,
"stack": "system" "stack": "system"
@@ -308,8 +338,7 @@ EOF
fi fi
} }
generate_outbounds_and_experimental_jsons() { add_outbounds() { #生成add_outbounds.json
#生成add_outbounds.json
grep -qE '"tag": "DIRECT"' "$TMPDIR"/jsons/outbounds.json || add_direct='{ "tag": "DIRECT", "type": "direct" }' grep -qE '"tag": "DIRECT"' "$TMPDIR"/jsons/outbounds.json || add_direct='{ "tag": "DIRECT", "type": "direct" }'
grep -qE '"tag": "REJECT"' "$TMPDIR"/jsons/outbounds.json || add_reject='{ "tag": "REJECT", "type": "block" }' grep -qE '"tag": "REJECT"' "$TMPDIR"/jsons/outbounds.json || add_reject='{ "tag": "REJECT", "type": "block" }'
grep -qE '"tag": "GLOBAL"' "$TMPDIR"/jsons/outbounds.json || { grep -qE '"tag": "GLOBAL"' "$TMPDIR"/jsons/outbounds.json || {
@@ -327,22 +356,9 @@ generate_outbounds_and_experimental_jsons() {
] ]
} }
EOF EOF
#生成http_clients.json
cat >"$TMPDIR"/jsons/http_clients.json <<EOF
{
"http_clients": [
{
"tag": "detour_proxy",
"detour": "GLOBAL"
},
{
"tag": "detour_direct",
"detour": "DIRECT"
} }
]
} gen_experimental() { #生成experimental.json
EOF
#生成experimental.json
[ "$crashcore" = "singboxr" ] && urltest_unified_delay=',"urltest_unified_delay": true' [ "$crashcore" = "singboxr" ] && urltest_unified_delay=',"urltest_unified_delay": true'
cat >"$TMPDIR"/jsons/experimental.json <<EOF cat >"$TMPDIR"/jsons/experimental.json <<EOF
{ {
@@ -359,8 +375,7 @@ EOF
EOF EOF
} }
generate_custom_rules_json() { generate_custom_rules_json() { #生成自定义规则文件
#生成自定义规则文件
[ -n "$(grep -Ev ^# "$CRASHDIR"/yamls/rules.yaml 2>/dev/null)" ] && { [ -n "$(grep -Ev ^# "$CRASHDIR"/yamls/rules.yaml 2>/dev/null)" ] && {
cat "$CRASHDIR"/yamls/rules.yaml | cat "$CRASHDIR"/yamls/rules.yaml |
sed '/#.*/d' | sed '/#.*/d' |
@@ -385,7 +400,7 @@ generate_custom_rules_json() {
} }
} }
normalize_and_finalize_jsons() { normalize_and_finalize_jsons() { #修饰文件
#清理route.json中的process_name规则以及"auto_detect_interface" #清理route.json中的process_name规则以及"auto_detect_interface"
sed -i '/"process_name": \[/,/],$/d' "$TMPDIR"/jsons/route.json sed -i '/"process_name": \[/,/],$/d' "$TMPDIR"/jsons/route.json
sed -i '/"process_name": "[^"]*",/d' "$TMPDIR"/jsons/route.json sed -i '/"process_name": "[^"]*",/d' "$TMPDIR"/jsons/route.json
@@ -407,7 +422,7 @@ normalize_and_finalize_jsons() {
done done
} }
link_custom_jsons() { link_custom_jsons() { #合并文件
#加载自定义配置文件 #加载自定义配置文件
mkdir -p "$TMPDIR"/jsons_base mkdir -p "$TMPDIR"/jsons_base
#以下为覆盖脚本的自定义文件 #以下为覆盖脚本的自定义文件
@@ -425,8 +440,7 @@ link_custom_jsons() {
done done
} }
validate_and_restore_custom_jsons() { test_json() { #测试自定义配置文件
#测试自定义配置文件
if ! error=$("$TMPDIR"/CrashCore check -D "$BINDIR" -C "$TMPDIR"/jsons 2>&1); then if ! error=$("$TMPDIR"/CrashCore check -D "$BINDIR" -C "$TMPDIR"/jsons 2>&1); then
echo $error echo $error
error_file=$(echo $error | grep -Eo 'cust.*\.json' | sed 's/cust_//g') error_file=$(echo $error | grep -Eo 'cust.*\.json' | sed 's/cust_//g')
@@ -439,17 +453,19 @@ validate_and_restore_custom_jsons() {
fi fi
} }
modify_json() { modify_json() { #入口
extract_base_jsons extract_base_jsons
generate_basic_jsons generate_basic_jsons
prepare_dns_config gen_dns
generate_dns_related_jsons gen_outbounds
generate_route_and_inbounds_jsons gen_certificate
generate_outbounds_and_experimental_jsons gen_inbounds
add_outbounds
gen_experimental
generate_custom_rules_json generate_custom_rules_json
normalize_and_finalize_jsons normalize_and_finalize_jsons
link_custom_jsons link_custom_jsons
validate_and_restore_custom_jsons test_json
#清理缓存 #清理缓存
rm -rf "$TMPDIR"/*.json rm -rf "$TMPDIR"/*.json
rm -rf "$TMPDIR"/jsons_base rm -rf "$TMPDIR"/jsons_base

View File

@@ -1 +1 @@
1.9.5alpha14 1.9.5beta1