UNPKG

@szegedsw/lib-node

Version:

A little framework published by Szeged Software Zrt. in order to enhance api endpoint security and create reuseable code. Email module, Logging system, and much more. Further improvements are expected.

13 lines 544 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getIpAddress = void 0; function getIpAddress(req) { // eslint-disable-next-line no-nested-ternary return req.headers["x-forwarded-for"] ? typeof req.headers["x-forwarded-for"] === "string" ? req.headers["x-forwarded-for"].split(",")[0] : req.headers["x-forwarded-for"][0] : req.connection.remoteAddress || req.socket.remoteAddress || ""; } exports.getIpAddress = getIpAddress; //# sourceMappingURL=get-ip.js.map