fix(Shadowrocket.php): add missing bandwidth params for Hysteria2 (#1031)

* fix(Shadowrocket): add missing bandwidth params for Hysteria2

Fixes a critical issue where Hysteria 2 silently downgrades to non-Brutal congestion control (BBR/Reno) on Shadowrocket clients.

* Refactor bandwidth parameters assignment

Update bandwidth parameters to only include positive values.

---------

Co-authored-by: Xboard <[email protected]>
This commit is contained in:
JW-3154andXboard authored and GitHub committed 2026-08-30 00:55:14 +08:00
1 parent 7cfe061469
commit e074bef702
1 file changed
+6
+6
View File
@@ -381,6 +381,12 @@ class Shadowrocket extends AbstractProtocol
"obfs" => 'none',
"fastopen" => 1
];
if (($upMbps = data_get($protocol_settings, 'bandwidth.up')) > 0) {
$params['upmbps'] = $upMbps;
}
if (($downMbps = data_get($protocol_settings, 'bandwidth.down')) > 0) {
$params['downmbps'] = $downMbps;
}
if ($serverName = data_get($protocol_settings, 'tls.server_name')) {
$params['peer'] = $serverName;
}