tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
27 lines • 995 B
text/typescript
/**
* @typedef {{ value: string[] | string, type: string | null }} IpResult
*/
/**
* Retrieves the client's IP address from the Express request object,
* supporting detection for Firebase/Cloud Functions, proxies, and direct connections.
*
* @param {import('express').Request} req - The Express request object.
* @param {Object} [options] - Optional configuration.
* @param {boolean} [options.isFirebase=false] - Enable detection for Firebase environments (e.g., Fastly).
*
* @returns {IpResult} An object containing the list of IP addresses and the detection source type.
* @deprecated
*
* @example
* const ipInfo = userIp(req);
* console.log(ipInfo.value); // ['192.168.0.1']
* console.log(ipInfo.type); // 'x-forwarded-for'
*/
export default function userIp(req: import("express").Request, options?: {
isFirebase?: boolean | undefined;
}): IpResult;
export type IpResult = {
value: string[] | string;
type: string | null;
};
//# sourceMappingURL=userIP.d.mts.map