feat: xxbb
This commit is contained in:
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user