// Resolve a client IP from the request (works behind proxies) — mirrors the equivalent // local helper in userController.js, shared here for the admin-audit call sites. function getClientIp(req) { const forwarded = req.headers['x-forwarded-for']; if (forwarded) return forwarded.split(',')[0].trim(); return req.socket?.remoteAddress || 'unknown'; } module.exports = { getClientIp };