Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,8 @@ fun getFirstPort(portStr: String): Int {

fun HysteriaBean.canUseSingBox(): Boolean {
if (protocol != HysteriaBean.PROTOCOL_UDP) return false
// The starifly sing-box core only supports Salamander obfs. Gecko obfs is provided by
// the bundled official hysteria binary sidecar, so force the external path for Gecko.
if (protocolVersion == 2 && hysteria2ObfsType == HysteriaBean.OBFS_GECKO) return false
// Gecko obfs is now supported natively by this fork's sing-box core (via the
// hawkff/sing-quic gecko backport), so it no longer needs the sidecar.
return true
}

Expand Down Expand Up @@ -354,11 +353,24 @@ fun buildSingBoxOutboundHysteriaBean(bean: HysteriaBean): SingBoxOptions.SingBox
up_mbps = bean.uploadMbps
down_mbps = bean.downloadMbps
if (bean.obfuscation.isNotBlank() && bean.hysteria2ObfsType != HysteriaBean.OBFS_NONE) {
// Native sing-box core only supports Salamander; Gecko goes through the
// bundled hysteria binary sidecar (canUseSingBox() == false for Gecko).
obfs = SingBoxOptions.Hysteria2Obfs().apply {
type = "salamander"
password = bean.obfuscation
when (bean.hysteria2ObfsType) {
HysteriaBean.OBFS_GECKO -> {
type = "gecko"
password = bean.obfuscation
if (bean.geckoMinPacketSize != null && bean.geckoMinPacketSize > 0) {
min_packet_size = bean.geckoMinPacketSize
}
if (bean.geckoMaxPacketSize != null && bean.geckoMaxPacketSize > 0) {
max_packet_size = bean.geckoMaxPacketSize
}
}
Comment thread
greptile-apps[bot] marked this conversation as resolved.

else -> {
type = "salamander"
password = bean.obfuscation
}
}
}
}
// disable_mtu_discovery = bean.disableMtuDiscovery
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,11 @@ public static class Hysteria2Obfs extends SingBoxOption {

public String password;

// Gecko obfs only (flattened into the obfs object by the core's badjson serializer).
public Integer min_packet_size;

public Integer max_packet_size;

}

public static class Hysteria2User extends SingBoxOption {
Expand Down
2 changes: 1 addition & 1 deletion buildScript/lib/core/get_source_env.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export COMMIT_SING_BOX="ed45ea96fa27d27bd346539403303c8384b7d210"
export COMMIT_SING_BOX="d003dccf165816f51b669ded6d2d4e66df5c3b3b"
export COMMIT_LIBNEKO="1c47a3af71990a7b2192e03292b4d246c308ef0b"
6 changes: 3 additions & 3 deletions libcore/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module libcore

go 1.24.7

toolchain go1.26.4
go 1.26.4

require (
github.com/dyhkwong/sing-juicity v0.0.3
Expand Down Expand Up @@ -107,3 +105,5 @@ replace github.com/sagernet/sing-vmess => github.com/starifly/sing-vmess v0.2.8-
// replace github.com/sagernet/sing-dns => ../../sing-dns

// replace berty.tech/go-libtor => github.com/berty/go-libtor v0.0.0-20220627102132-9189eb6e3982

replace github.com/sagernet/sing-quic => github.com/hawkff/sing-quic v0.5.3-0.20260618035506-f2f558c5aaba
4 changes: 2 additions & 2 deletions libcore/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ github.com/gorilla/csrf v1.7.3-0.20250123201450-9dd6af1f6d30/go.mod h1:F1Fj3KG23
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
github.com/hawkff/sing-quic v0.5.3-0.20260618035506-f2f558c5aaba h1:r2nlyrd4MBY8OPS4wEOw8SojAdnyzzl81OEKD4CES60=
github.com/hawkff/sing-quic v0.5.3-0.20260618035506-f2f558c5aaba/go.mod h1:evP1e++ZG8TJHVV5HudXV4vWeYzGfCdF4HwSJZcdqkI=
github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo=
github.com/illarion/gonotify/v2 v2.0.3/go.mod h1:38oIJTgFqupkEydkkClkbL6i5lXV/bxdH9do5TALPEE=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
Expand Down Expand Up @@ -200,8 +202,6 @@ github.com/sagernet/sing v0.7.18 h1:iZHkaru1/MoHugx3G+9S3WG4owMewKO/KvieE2Pzk4E=
github.com/sagernet/sing v0.7.18/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
github.com/sagernet/sing-mux v0.3.4 h1:ZQplKl8MNXutjzbMVtWvWG31fohhgOfCuUZR4dVQ8+s=
github.com/sagernet/sing-mux v0.3.4/go.mod h1:QvlKMyNBNrQoyX4x+gq028uPbLM2XeRpWtDsWBJbFSk=
github.com/sagernet/sing-quic v0.5.2 h1:I3vlfRImhr0uLwRS3b3ib70RMG9FcXtOKKUDz3eKRWc=
github.com/sagernet/sing-quic v0.5.2/go.mod h1:evP1e++ZG8TJHVV5HudXV4vWeYzGfCdF4HwSJZcdqkI=
github.com/sagernet/sing-shadowsocks v0.2.8 h1:PURj5PRoAkqeHh2ZW205RWzN9E9RtKCVCzByXruQWfE=
github.com/sagernet/sing-shadowsocks v0.2.8/go.mod h1:lo7TWEMDcN5/h5B8S0ew+r78ZODn6SwVaFhvB6H+PTI=
github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnqqs2gQ2/Qioo=
Expand Down
Loading