From 450b22ccf7aada446d73f4faaead6696e384edba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Wed, 18 Dec 2024 22:28:53 +0500 Subject: [PATCH] Try to fix things again. --- index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index d65cfdb..3879cb6 100644 --- a/index.ts +++ b/index.ts @@ -44,8 +44,10 @@ let srv = net.createServer(function(socket: net.Socket) { if (addr == "127.0.0.1") { let p = pp.V1ProxyProtocol.parse(String(data)); addr = p.source.ipAddress; - if (typeof p.data === 'string') { - data = p.data; + if (typeof p.data === 'undefined') { + return; + } else { + data = data.slice(p.data.length); } } else { console.log("Address " + addr + " tried to use proxy protocol.");