update: support grpc for clash & shadowrocket

This commit is contained in:
tokumeikoi
2021-06-12 15:42:44 +09:00
parent c5e2ec1d12
commit d510064732
4 changed files with 24 additions and 4 deletions

View File

@ -44,6 +44,18 @@ class Shadowrocket
$config['obfsParam'] = $wsSettings['headers']['Host'];
}
}
if ($server['network'] === 'grpc') {
$config['obfs'] = "grpc";
if (isset($server['networkSettings'])) {
$grpcObject = json_decode($server['networkSettings'], true);
if (isset($grpcObject['serviceName'])) {
$config['obfsParam'] = json_decode([
'Host' => $grpcObject['serviceName']
]);
$config['path'] = '/';
}
}
}
$query = http_build_query($config, '', '&', PHP_QUERY_RFC3986);
$uri = "vmess://{$userinfo}?{$query}";
$uri .= "\r\n";