@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
23 lines (22 loc) • 835 B
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getClientAddress", {
enumerable: true,
get: function() {
return getClientAddress;
}
});
const _configenvironment = require("../../configuration/config.environment");
function getClientAddress(socket) {
return (_configenvironment.configuration.server.trustProxy ? socket.handshake.headers['x-forwarded-for']?.toString().split(',')[0] : undefined) || // via proxy
socket.handshake.address || // fallback
socket.conn.remoteAddress // fallback (IPv6)
;
}
//# sourceMappingURL=utils.js.map