| 37 | | 37 | |
| 38 | if (!knownIPs.has(clientIp)) { | 38 | if (!knownIPs.has(clientIp)) { |
| 39 | // Log new connection | 39 | // Log new connection |
| 40 | console.info(color.yellow(`New connection from ${clientIp}; User Agent: ${userAgent}\n`)); | | |
| 41 | knownIPs.add(clientIp); | 40 | knownIPs.add(clientIp); |
| 42 | | 41 | |
| 43 | // Write to access log if enabled | 42 | // Write to access log if enabled |
| 44 | if (enableAccessLog) { | 43 | if (enableAccessLog) { |
| | 44 | console.info(color.yellow(`New connection from ${clientIp}; User Agent: ${userAgent}\n`)); |
| 45 | const logPath = getAccessLogPath(); | 45 | const logPath = getAccessLogPath(); |
| 46 | const timestamp = new Date().toISOString(); | 46 | const timestamp = new Date().toISOString(); |
| 47 | const log = `${timestamp} ${clientIp} ${userAgent}\n`; | 47 | const log = `${timestamp} ${clientIp} ${userAgent}\n`; |