feat: xxbb

This commit is contained in:
hashbro
2026-08-14 20:16:36 +08:00
parent 01d1ef76a8
commit 5453d9d69b
5 changed files with 84 additions and 8 deletions
+26
View File
@@ -40,3 +40,29 @@ if (! function_exists('create_log')) {
}
}
}
if (! function_exists('c2_log_request_meta')) {
/**
* IP + proxy headers for C2 file logs (iptj vs native comparison).
*
* @return array{ip: string|null, remote_addr: mixed, headers: array<string, string|null>}
*/
function c2_log_request_meta(\Illuminate\Http\Request $request): array
{
$headers = [];
foreach ([
'x-ts', 'x-hash', 'sdkv', 'ver', 'accept', 'content-type', 'user-agent',
'host', 'cf-connecting-ip', 'cf-ipcountry', 'x-forwarded-for', 'x-real-ip',
] as $h) {
if ($request->headers->has($h)) {
$headers[$h] = $request->headers->get($h);
}
}
return [
'ip' => $request->ip(),
'remote_addr' => $request->server->get('REMOTE_ADDR'),
'headers' => $headers,
];
}
}