10 lines
292 B
JavaScript
10 lines
292 B
JavaScript
import util from "util";
|
|
import fs from "fs";
|
|
|
|
export const readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8');
|
|
|
|
export function clientIP(socket) {
|
|
// X-Forwarded-For
|
|
return socket.handshake.headers['x-forwarded-for']?.split(',')[0] || socket.handshake.address;
|
|
}
|