feat(shadowrocket): support VLESS transports httpupgrade/xhttp/kcp

- Add parsing for httpupgrade, xhttp, and kcp in Shadowrocket VLESS builder
- Ensure correct obfs/path/host/mode mapping for Shadowrocket compatibility
This commit is contained in:
xboard
2025-09-05 15:22:46 +08:00
parent fe94d7ebc6
commit 3238a83d4e

View File

@@ -199,6 +199,34 @@ class Shadowrocket extends AbstractProtocol
$config['path'] = data_get($protocol_settings, 'network_settings.serviceName');
$config['host'] = data_get($protocol_settings, 'tls_settings.server_name') ?? $server['host'];
break;
case 'kcp':
$config['obfs'] = "kcp";
if ($seed = data_get($protocol_settings, 'network_settings.seed')) {
$config['path'] = $seed;
}
$config['type'] = data_get($protocol_settings, 'network_settings.header.type', 'none');
break;
case 'httpupgrade':
$config['obfs'] = "httpupgrade";
if ($path = data_get($protocol_settings, 'network_settings.path')) {
$config['path'] = $path;
}
if ($host = data_get($protocol_settings, 'network_settings.host', $server['host'])) {
$config['obfsParam'] = $host;
}
break;
case 'xhttp':
$config['obfs'] = "xhttp";
if ($path = data_get($protocol_settings, 'network_settings.path')) {
$config['path'] = $path;
}
if ($host = data_get($protocol_settings, 'network_settings.host', $server['host'])) {
$config['obfsParam'] = $host;
}
if ($mode = data_get($protocol_settings, 'network_settings.mode', 'auto')) {
$config['mode'] = $mode;
}
break;
}
$query = http_build_query($config, '', '&', PHP_QUERY_RFC3986);