Skip to content

Commit 9b0ca46

Browse files
authored
core: bump sing-quic pin; drop the Hysteria2 sidecar (#113)
Bump the sing-quic replace pin to the current hawkff HEAD (configurable BBR profiles, random hop interval, shared QUIC options, realm support, gecko obfs on the migrated base, and a salamander data-race fix; built on sing v0.8.10 + quic-go v0.59-mod.5). The shared-QUIC-options refactor moves the per-window / MTU knobs into qtls.QUICOptions; the matching sing-box change is pinned via COMMIT_SING_BOX. Hysteria2 (incl. gecko obfs) runs natively in the core, so the bundled client binary is no longer reachable. Remove its build step, env, cache-key segment and ABI checks across the workflows, the native-executable entry, the plugin mapping, the dead config builder, and the now-redundant external plugin branch. canUseSingBox() now routes all Hysteria2 to the native outbound and reserves the external path for the Hysteria1 transports. Hysteria1 support is unchanged.
1 parent 1f068fe commit 9b0ca46

13 files changed

Lines changed: 30 additions & 435 deletions

File tree

.depot/workflows/build-apk.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ env:
1010
GO_VERSION: '1.26.4'
1111
NDK_VERSION: '25.0.8775105'
1212
MIERU_VERSION: v3.34.0
13-
HYSTERIA_VERSION: v2.9.2
1413
MDVPN_REF: android-vpnservice-protect-hook
1514
MDVPN_COMMIT: d481d72d4b86783a87d536c214d2c68cc4e9320e
1615
NAIVE_VERSION: v149.0.7827.114-1
@@ -61,7 +60,6 @@ jobs:
6160
run: |
6261
git ls-files -s -- \
6362
buildScript/lib/mieru.sh \
64-
buildScript/lib/hysteria2.sh \
6563
buildScript/lib/masterdnsvpn.sh \
6664
buildScript/lib/naive.sh \
6765
buildScript/lib/olcrtc.sh \
@@ -77,7 +75,7 @@ jobs:
7775
uses: actions/cache@v4
7876
with:
7977
path: app/executableSo
80-
key: depot-sidecars-${{ env.GO_VERSION }}-${{ env.NDK_VERSION }}-${{ env.MIERU_VERSION }}-${{ env.HYSTERIA_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-${{ env.OLCRTC_COMMIT }}-${{ hashFiles('sidecars_status') }}
78+
key: depot-sidecars-${{ env.GO_VERSION }}-${{ env.NDK_VERSION }}-${{ env.MIERU_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-${{ env.OLCRTC_COMMIT }}-${{ hashFiles('sidecars_status') }}
8179

8280
- name: Install Go
8381
if: steps.libcore-cache.outputs.cache-hit != 'true' || steps.sidecars-cache.outputs.cache-hit != 'true'
@@ -94,15 +92,14 @@ jobs:
9492
if: steps.sidecars-cache.outputs.cache-hit != 'true'
9593
run: |
9694
./run lib mieru
97-
./run lib hysteria2
9895
./run lib masterdnsvpn
9996
./run lib naive
10097
./run lib olcrtc
10198
10299
- name: Verify sidecar artifacts
103100
run: |
104101
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
105-
for so in libmieru.so libhysteria2.so libmasterdnsvpn.so libnaive.so libolcrtc.so; do
102+
for so in libmieru.so libmasterdnsvpn.so libnaive.so libolcrtc.so; do
106103
if [ ! -f "app/executableSo/$abi/$so" ]; then
107104
echo "Error: missing app/executableSo/$abi/$so" >&2
108105
exit 1

.github/workflows/build.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- 'nb4a.properties'
99
env:
1010
MIERU_VERSION: v3.34.0
11-
HYSTERIA_VERSION: v2.9.2
1211
MDVPN_REF: android-vpnservice-protect-hook
1312
MDVPN_COMMIT: d481d72d4b86783a87d536c214d2c68cc4e9320e
1413
NAIVE_VERSION: v149.0.7827.114-1
@@ -91,14 +90,14 @@ jobs:
9190
- name: Checkout
9291
uses: actions/checkout@v5
9392
- name: Sidecars Status
94-
run: cat buildScript/lib/mieru.sh buildScript/lib/hysteria2.sh buildScript/lib/masterdnsvpn.sh buildScript/lib/naive.sh buildScript/init/env.sh buildScript/init/env_ndk.sh | sha1sum > sidecars_status
93+
run: cat buildScript/lib/mieru.sh buildScript/lib/masterdnsvpn.sh buildScript/lib/naive.sh buildScript/init/env.sh buildScript/init/env_ndk.sh | sha1sum > sidecars_status
9594
- name: Sidecars Cache
9695
id: cache
9796
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
9897
with:
9998
path: |
10099
app/executableSo
101-
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.HYSTERIA_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-sidecars
100+
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-sidecars
102101
- name: Install Golang
103102
if: steps.cache.outputs.cache-hit != 'true'
104103
uses: actions/setup-go@v6
@@ -107,9 +106,6 @@ jobs:
107106
- name: Mieru Build
108107
if: steps.cache.outputs.cache-hit != 'true'
109108
run: ./run lib mieru
110-
- name: Hysteria2 Download
111-
if: steps.cache.outputs.cache-hit != 'true'
112-
run: ./run lib hysteria2
113109
- name: MasterDnsVPN Build
114110
if: steps.cache.outputs.cache-hit != 'true'
115111
run: ./run lib masterdnsvpn
@@ -145,7 +141,7 @@ jobs:
145141
- name: Verify Sidecar Artifacts
146142
run: |
147143
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
148-
for so in libmieru.so libhysteria2.so libmasterdnsvpn.so libnaive.so; do
144+
for so in libmieru.so libmasterdnsvpn.so libnaive.so; do
149145
if [ ! -f "app/executableSo/$abi/$so" ]; then
150146
echo "Error: missing app/executableSo/$abi/$so (sidecar artifact missing)" >&2
151147
exit 1

.github/workflows/ci.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
workflow_dispatch:
44
env:
55
MIERU_VERSION: v3.34.0
6-
HYSTERIA_VERSION: v2.9.2
76
MDVPN_REF: android-vpnservice-protect-hook
87
MDVPN_COMMIT: d481d72d4b86783a87d536c214d2c68cc4e9320e
98
NAIVE_VERSION: v149.0.7827.114-1
@@ -129,7 +128,6 @@ jobs:
129128
run: |
130129
git ls-files -s -- \
131130
buildScript/lib/mieru.sh \
132-
buildScript/lib/hysteria2.sh \
133131
buildScript/lib/masterdnsvpn.sh \
134132
buildScript/lib/naive.sh \
135133
buildScript/lib/olcrtc.sh \
@@ -144,7 +142,7 @@ jobs:
144142
with:
145143
path: |
146144
app/executableSo
147-
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.HYSTERIA_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-${{ env.OLCRTC_COMMIT }}-sidecars-ci
145+
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-${{ env.OLCRTC_COMMIT }}-sidecars-ci
148146
- name: Install Golang
149147
if: steps.cache.outputs.cache-hit != 'true'
150148
uses: actions/setup-go@v6
@@ -153,9 +151,6 @@ jobs:
153151
- name: Mieru Build
154152
if: steps.cache.outputs.cache-hit != 'true'
155153
run: ./run lib mieru
156-
- name: Hysteria2 Download
157-
if: steps.cache.outputs.cache-hit != 'true'
158-
run: ./run lib hysteria2
159154
- name: MasterDnsVPN Build
160155
if: steps.cache.outputs.cache-hit != 'true'
161156
run: ./run lib masterdnsvpn
@@ -199,7 +194,7 @@ jobs:
199194
- name: Verify Sidecar Artifacts
200195
run: |
201196
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
202-
for so in libmieru.so libhysteria2.so libmasterdnsvpn.so libnaive.so libolcrtc.so; do
197+
for so in libmieru.so libmasterdnsvpn.so libnaive.so libolcrtc.so; do
203198
if [ ! -f "app/executableSo/$abi/$so" ]; then
204199
echo "Error: missing app/executableSo/$abi/$so (sidecar artifact missing)" >&2
205200
exit 1

.github/workflows/preview.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
inputs:
55
env:
66
MIERU_VERSION: v3.34.0
7-
HYSTERIA_VERSION: v2.9.2
87
MDVPN_REF: android-vpnservice-protect-hook
98
MDVPN_COMMIT: d481d72d4b86783a87d536c214d2c68cc4e9320e
109
NAIVE_VERSION: v149.0.7827.114-1
@@ -50,14 +49,14 @@ jobs:
5049
- name: Checkout
5150
uses: actions/checkout@v5
5251
- name: Sidecars Status
53-
run: cat buildScript/lib/mieru.sh buildScript/lib/hysteria2.sh buildScript/lib/masterdnsvpn.sh buildScript/lib/naive.sh buildScript/init/env.sh buildScript/init/env_ndk.sh | sha1sum > sidecars_status
52+
run: cat buildScript/lib/mieru.sh buildScript/lib/masterdnsvpn.sh buildScript/lib/naive.sh buildScript/init/env.sh buildScript/init/env_ndk.sh | sha1sum > sidecars_status
5453
- name: Sidecars Cache
5554
id: cache
5655
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
5756
with:
5857
path: |
5958
app/executableSo
60-
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.HYSTERIA_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-sidecars
59+
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-sidecars
6160
- name: Install Golang
6261
if: steps.cache.outputs.cache-hit != 'true'
6362
uses: actions/setup-go@v6
@@ -66,9 +65,6 @@ jobs:
6665
- name: Mieru Build
6766
if: steps.cache.outputs.cache-hit != 'true'
6867
run: ./run lib mieru
69-
- name: Hysteria2 Download
70-
if: steps.cache.outputs.cache-hit != 'true'
71-
run: ./run lib hysteria2
7268
- name: MasterDnsVPN Build
7369
if: steps.cache.outputs.cache-hit != 'true'
7470
run: ./run lib masterdnsvpn
@@ -104,7 +100,7 @@ jobs:
104100
- name: Verify Sidecar Artifacts
105101
run: |
106102
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
107-
for so in libmieru.so libhysteria2.so libmasterdnsvpn.so libnaive.so; do
103+
for so in libmieru.so libmasterdnsvpn.so libnaive.so; do
108104
if [ ! -f "app/executableSo/$abi/$so" ]; then
109105
echo "Error: missing app/executableSo/$abi/$so (sidecar artifact missing)" >&2
110106
exit 1

.github/workflows/release.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
required: false
1111
env:
1212
MIERU_VERSION: v3.34.0
13-
HYSTERIA_VERSION: v2.9.2
1413
MDVPN_REF: android-vpnservice-protect-hook
1514
MDVPN_COMMIT: d481d72d4b86783a87d536c214d2c68cc4e9320e
1615
NAIVE_VERSION: v149.0.7827.114-1
@@ -56,14 +55,14 @@ jobs:
5655
- name: Checkout
5756
uses: actions/checkout@v5
5857
- name: Sidecars Status
59-
run: cat buildScript/lib/mieru.sh buildScript/lib/hysteria2.sh buildScript/lib/masterdnsvpn.sh buildScript/lib/naive.sh buildScript/init/env.sh buildScript/init/env_ndk.sh | sha1sum > sidecars_status
58+
run: cat buildScript/lib/mieru.sh buildScript/lib/masterdnsvpn.sh buildScript/lib/naive.sh buildScript/init/env.sh buildScript/init/env_ndk.sh | sha1sum > sidecars_status
6059
- name: Sidecars Cache
6160
id: cache
6261
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6362
with:
6463
path: |
6564
app/executableSo
66-
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.HYSTERIA_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-sidecars
65+
key: ${{ hashFiles('.github/workflows/*', 'sidecars_status') }}-${{ env.MIERU_VERSION }}-${{ env.MDVPN_COMMIT }}-${{ env.NAIVE_VERSION }}-sidecars
6766
- name: Install Golang
6867
if: steps.cache.outputs.cache-hit != 'true'
6968
uses: actions/setup-go@v6
@@ -72,9 +71,6 @@ jobs:
7271
- name: Mieru Build
7372
if: steps.cache.outputs.cache-hit != 'true'
7473
run: ./run lib mieru
75-
- name: Hysteria2 Download
76-
if: steps.cache.outputs.cache-hit != 'true'
77-
run: ./run lib hysteria2
7874
- name: MasterDnsVPN Build
7975
if: steps.cache.outputs.cache-hit != 'true'
8076
run: ./run lib masterdnsvpn
@@ -110,7 +106,7 @@ jobs:
110106
- name: Verify Sidecar Artifacts
111107
run: |
112108
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
113-
for so in libmieru.so libhysteria2.so libmasterdnsvpn.so libnaive.so; do
109+
for so in libmieru.so libmasterdnsvpn.so libnaive.so; do
114110
if [ ! -f "app/executableSo/$abi/$so" ]; then
115111
echo "Error: missing app/executableSo/$abi/$so (sidecar artifact missing)" >&2
116112
exit 1

app/src/main/java/io/nekohasekai/sagernet/bg/Executable.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ object Executable {
1616
"libtuic.so",
1717
"libhysteria.so",
1818
"libmieru.so",
19-
"libhysteria2.so",
2019
"libmasterdnsvpn.so",
2120
"libolcrtc.so",
2221
)

app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,9 @@ fun buildConfig(proxy: ProxyEntity, forTest: Boolean = false, forExport: Boolean
628628
var needExternal = true
629629
if (index == profileList.lastIndex) {
630630
val pluginId = when (bean) {
631-
is HysteriaBean -> if (bean.protocolVersion == 1) "hysteria-plugin" else "hysteria2-plugin"
631+
// Only Hysteria v1 takes the external plugin path; v2 is
632+
// handled natively, so it never reaches needExternal().
633+
is HysteriaBean -> "hysteria-plugin"
632634
else -> ""
633635
}
634636
if (Plugins.isUsingMatsuriExe(pluginId)) {

app/src/main/java/io/nekohasekai/sagernet/fmt/hysteria/HysteriaFmt.kt

Lines changed: 9 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,12 @@ fun getFirstPort(portStr: String): Int {
375375
}
376376

377377
fun HysteriaBean.canUseSingBox(): Boolean {
378-
if (protocol != HysteriaBean.PROTOCOL_UDP) return false
379-
// Gecko obfs is now supported natively by this fork's sing-box core (via the
380-
// hawkff/sing-quic gecko backport), so it no longer needs the sidecar.
381-
return true
378+
// Hysteria2 always uses the native sing-box outbound; the faketcp / wechat-video
379+
// transports are a Hysteria1-only concept, and gecko obfs is handled natively by
380+
// this fork's core (via the hawkff/sing-quic gecko backport).
381+
if (protocolVersion == 2) return true
382+
// Hysteria1 falls back to the external plugin for the non-UDP transports.
383+
return protocol == HysteriaBean.PROTOCOL_UDP
382384
}
383385

384386
fun buildSingBoxOutboundHysteriaBean(bean: HysteriaBean): SingBoxOptions.SingBoxOption {
@@ -440,9 +442,9 @@ fun buildSingBoxOutboundHysteriaBean(bean: HysteriaBean): SingBoxOptions.SingBox
440442
HysteriaBean.OBFS_GECKO -> {
441443
type = "gecko"
442444
password = bean.obfuscation
443-
// Clamp + order to match the sidecar builder's bounds
444-
// (1..2048, min <= max); an inverted/out-of-range pair
445-
// would otherwise be rejected by the core at connect time.
445+
// Clamp and order the bounds (1..2048, min <= max);
446+
// an inverted or out-of-range pair would otherwise be
447+
// rejected by the core at connect time.
446448
val min = bean.geckoMinPacketSize?.takeIf { it > 0 }?.coerceIn(1, 2048)
447449
val max = bean.geckoMaxPacketSize?.takeIf { it > 0 }?.coerceIn(min ?: 1, 2048)
448450
if (min != null) min_packet_size = min
@@ -491,101 +493,3 @@ fun hopPortsToSingboxList(s: String): List<String> {
491493
}
492494
}
493495
}
494-
495-
/**
496-
* Builds a config for the bundled official apernet/hysteria client binary (sidecar).
497-
*
498-
* NOTE: Hysteria2 (including Gecko obfs) now runs natively in the sing-box core, so this
499-
* sidecar path is no longer used for Gecko. This builder is retained for the bundled
500-
* hysteria2 binary infrastructure and potential fallback use.
501-
*
502-
* Emitted as JSON (hysteria uses viper, which detects format by the .json extension).
503-
* The client's upstream QUIC sockets are protected from the VPN via
504-
* quic.sockopts.fdControlUnixSocket, pointing at libcore's protect_server socket
505-
* ("protect_path" in the process working dir). It exposes a loopback-only SOCKS5 listener
506-
* that the generated sing-box "socks" outbound dials (no auth, matching the other sidecars).
507-
*
508-
* @param port local SOCKS5 port for the sidecar to listen on (== sing-box outbound port).
509-
* @param protectPath absolute path to libcore's protect unix socket.
510-
*/
511-
fun HysteriaBean.buildHysteria2SidecarConfig(port: Int, protectPath: String): String {
512-
if (protocolVersion != 2) {
513-
throw Exception("error version: $protocolVersion")
514-
}
515-
var realSni = sni
516-
if (realSni.isBlank() && !serverAddress.isIpAddress()) {
517-
realSni = serverAddress
518-
}
519-
return JSONObject().apply {
520-
put("server", "$serverAddress:$serverPorts")
521-
if (authPayload.isNotBlank()) put("auth", authPayload)
522-
put(
523-
"tls",
524-
JSONObject().apply {
525-
if (realSni.isNotBlank()) put("sni", realSni)
526-
put("insecure", allowInsecure || DataStore.globalAllowInsecure)
527-
if (caText.isNotBlank()) put("ca", caText)
528-
},
529-
)
530-
if (hysteria2ObfsType == HysteriaBean.OBFS_GECKO && obfuscation.isNotBlank()) {
531-
// Clamp to hysteria's accepted bounds: 1 <= min <= max <= 2048.
532-
val min = geckoMinPacketSize.coerceIn(1, 2048)
533-
val max = geckoMaxPacketSize.coerceIn(min, 2048)
534-
put(
535-
"obfs",
536-
JSONObject().apply {
537-
put("type", "gecko")
538-
put(
539-
"gecko",
540-
JSONObject().apply {
541-
put("password", obfuscation)
542-
put("minPacketSize", min)
543-
put("maxPacketSize", max)
544-
},
545-
)
546-
},
547-
)
548-
} else if (hysteria2ObfsType == HysteriaBean.OBFS_SALAMANDER && obfuscation.isNotBlank()) {
549-
put(
550-
"obfs",
551-
JSONObject().apply {
552-
put("type", "salamander")
553-
put(
554-
"salamander",
555-
JSONObject().apply {
556-
put("password", obfuscation)
557-
},
558-
)
559-
},
560-
)
561-
}
562-
if (uploadMbps > 0 || downloadMbps > 0) {
563-
put(
564-
"bandwidth",
565-
JSONObject().apply {
566-
if (uploadMbps > 0) put("up", "$uploadMbps mbps")
567-
if (downloadMbps > 0) put("down", "$downloadMbps mbps")
568-
},
569-
)
570-
}
571-
put(
572-
"quic",
573-
JSONObject().apply {
574-
put(
575-
"sockopts",
576-
JSONObject().apply {
577-
put("fdControlUnixSocket", protectPath)
578-
},
579-
)
580-
},
581-
)
582-
put(
583-
"socks5",
584-
JSONObject().apply {
585-
put("listen", "$LOCALHOST:$port")
586-
put("disableUDP", false)
587-
},
588-
)
589-
put("lazy", true)
590-
}.toStringPretty()
591-
}

app/src/main/java/io/nekohasekai/sagernet/plugin/PluginManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ object PluginManager {
7272
}
7373
return when (pluginId) {
7474
"hysteria-plugin" -> soIfExist("libhysteria.so")
75-
"hysteria2-plugin" -> soIfExist("libhysteria2.so")
7675
"mieru-plugin" -> soIfExist("libmieru.so")
7776
"masterdnsvpn-plugin" -> soIfExist("libmasterdnsvpn.so")
7877
"olcrtc-plugin" -> soIfExist("libolcrtc.so")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export COMMIT_SING_BOX="8966dca291128e4801b1492b0ae6e68cc7bea214"
1+
export COMMIT_SING_BOX="8bac84d6b794531f93558f74adc067f080522e8a"
22
# Human-readable sing-box version for the About screen. Pinned alongside the commit so the
33
# build does not depend on tags being present in the CI clone (git describe there only
44
# resolves a bare hash). Update this together with COMMIT_SING_BOX. Matches `git describe
55
# --tags` on the hawkff fork at the pinned commit.
6-
export VERSION_SING_BOX="1.13.13-9-g8966dca2"
6+
export VERSION_SING_BOX="1.13.13-10-g8bac84d6"
77
export COMMIT_LIBNEKO="1c47a3af71990a7b2192e03292b4d246c308ef0b"

0 commit comments

Comments
 (0)