Skip to content

Commit 9c0941d

Browse files
committed
docs: feasibility study for switching to official SagerNet/sing-box
Read-only investigation. Conclusion: not a drop-in switch. The core is starifly/sing-box (fork of MatsuriDayo/sing-box -> official). libcore imports Matsuri-only packages (nekoutils, protocol/shadowsocksr, protocol/snell) absent from official v1.13.x, and the app exposes SSR/Snell/Juicity as first-class types plus a 4830-line options schema mirroring the fork. Switching means re-platforming (weeks, high regression risk, loses protocols). Documents the breakage and the lower-risk alternatives (wait for starifly rebase, or backport specific features).
1 parent 5889145 commit 9c0941d

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Feasibility: switching the core to official SagerNet/sing-box
2+
3+
Date: 2026-06-15
4+
Status: **Investigated (read-only). Not recommended as a drop-in switch.**
5+
6+
## What was asked
7+
Switch this fork's core from `starifly/sing-box` to the official
8+
`SagerNet/sing-box`.
9+
10+
## The actual fork chain
11+
```
12+
SagerNet/sing-box (official, latest stable v1.13.13)
13+
└── MatsuriDayo/sing-box (NekoBox lineage; heavy Android/gomobile + extra protocols)
14+
└── starifly/sing-box (this fork's pinned core; ~v1.12.19-neko-1)
15+
```
16+
`starifly/sing-box`'s GitHub parent is `MatsuriDayo/sing-box`, **not** official directly.
17+
So "switch to official" means leaving the entire Matsuri/NekoBox core lineage that this
18+
app is built on — not a remote/URL change.
19+
20+
## Why it is not a config swap
21+
`libcore/` (the gomobile bridge, 8 Go files) imports sing-box **internal** packages
22+
directly, including several that **do not exist in official sing-box**:
23+
24+
| libcore import | In official v1.13.x? |
25+
|---|---|
26+
| `sing-box/nekoutils` | NO (Matsuri-only glue) |
27+
| `sing-box/protocol/shadowsocksr` | NO (SSR not in official) |
28+
| `sing-box/protocol/snell` | NO (Snell not in official) |
29+
| `sing-box/protocol/anytls` | Present, but fork/official APIs differ |
30+
| `experimental/libbox/platform` | Present, but the fork's platform API diverges |
31+
| `adapter`, `adapter/{inbound,outbound,endpoint,service}`, `option`, `dns/...` | Present, but 1.12-fork vs 1.13-official APIs differ |
32+
33+
Official `protocol/` dir (v1.13.13, confirmed) has: anytls, block, cloudflare, direct,
34+
dns, group, http, hysteria, hysteria2, mixed, naive, redirect, shadowsocks, shadowtls,
35+
socks, ssh, tailscale, tor, trojan, tuic, tun, vless, vmess, wireguard.
36+
37+
**Missing vs this fork:** `shadowsocksr`, `snell`, `juicity` (juicity is wired via the
38+
separate `dyhkwong/sing-juicity` dep), plus the `nekoutils` glue.
39+
40+
## App-side coupling (what would break)
41+
- `app/.../SingBoxOptions.java` is a **4830-line** hand-maintained mirror of the fork's
42+
`option` structs. Official's option schema differs (1.13 vs 1.12 fork) and would need
43+
re-deriving.
44+
- The app exposes fork-only protocols as first-class profile types:
45+
- `TYPE_SSR = 3` (ShadowsocksR) — 8 files
46+
- `TYPE_SNELL = 24` — 11 files
47+
- `TYPE_JUICITY = 23` — 9 files
48+
These would all break (no core support in official) and the profile types/DB enums,
49+
fmt parsers/exporters, and UI editors would need removal or re-sourcing.
50+
- `box_include.go` registers the fork's protocol set; official's registration API differs.
51+
- `BoxInstance.kt` + platform interface target the Matsuri `libbox/platform` API.
52+
53+
## Cost / risk
54+
This is **re-platforming the app onto a different core**, not an upgrade:
55+
1. Rewrite all 8 libcore Go bridge files against official 1.13.x adapter/option/platform APIs.
56+
2. Re-derive the 4830-line `SingBoxOptions.java` schema.
57+
3. Lose ShadowsocksR, Snell, Juicity (and re-source or drop them) — visible feature loss.
58+
4. Re-implement/verify the external-plugin mapping (mieru/naive/hysteria/etc.).
59+
5. Re-validate every remaining protocol end to end.
60+
Estimated: weeks of work, high regression risk across most protocols. Result would be a
61+
materially different app from the NekoBox/Matsuri lineage.
62+
63+
## Recommendation
64+
**Do not switch wholesale.** The fork exists precisely because of the Matsuri/starifly
65+
core additions; official sing-box can't host this app's feature set without major loss and
66+
rework.
67+
68+
If the underlying motivation is **newer upstream sing-box features** (e.g. the Gecko obfs
69+
that started this), the realistic paths are, in order of preference:
70+
1. **Wait for `starifly`/Matsuri to rebase onto newer official sing-box** (they track
71+
upstream), then bump the pin — keeps all fork protocols.
72+
2. **Cherry-pick/backport** a specific upstream feature into the starifly fork (a fork of
73+
the fork) when a single feature is needed.
74+
3. Full re-platform to official only if the project intentionally abandons the
75+
Matsuri-lineage protocol set — a separate product decision, out of scope for a
76+
maintenance/feature pass.
77+
78+
## Verification performed (read-only)
79+
- Enumerated libcore's sing-box imports and matched them against official v1.13.13's
80+
package layout.
81+
- Confirmed SSR/Snell/Juicity/nekoutils absent from official.
82+
- Measured app-side coupling (SingBoxOptions.java size, ProxyEntity types, file counts).
83+
- No core or app code was changed.

0 commit comments

Comments
 (0)