Try to fix things once again
This commit is contained in:
parent
450b22ccf7
commit
03df23e214
5
index.ts
5
index.ts
@ -42,12 +42,13 @@ let srv = net.createServer(function(socket: net.Socket) {
|
|||||||
socket.on('data', function(data: Buffer | string) {
|
socket.on('data', function(data: Buffer | string) {
|
||||||
if (data[0] === 'P'.charCodeAt(0)) {
|
if (data[0] === 'P'.charCodeAt(0)) {
|
||||||
if (addr == "127.0.0.1") {
|
if (addr == "127.0.0.1") {
|
||||||
let p = pp.V1ProxyProtocol.parse(String(data));
|
let s = String(data);
|
||||||
|
let p = pp.V1ProxyProtocol.parse(s);
|
||||||
addr = p.source.ipAddress;
|
addr = p.source.ipAddress;
|
||||||
if (typeof p.data === 'undefined') {
|
if (typeof p.data === 'undefined') {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
data = data.slice(p.data.length);
|
data = data.slice(s.search("\r"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Address " + addr + " tried to use proxy protocol.");
|
console.log("Address " + addr + " tried to use proxy protocol.");
|
||||||
|
Loading…
Reference in New Issue
Block a user