Skip to content
Snippets Groups Projects
Commit 282d9bfc authored by echicken's avatar echicken :chicken:
Browse files

Build protocol header as string and send all in one big barforama.

parent 2225ced7
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -93,20 +93,17 @@ try { ...@@ -93,20 +93,17 @@ try {
var ServerData = []; var ServerData = [];
if (UsingHAProxy()) { if (UsingHAProxy()) {
[0x0D, 0x0A, 0x0D, 0x0A, 0x00, 0x0D, 0x0A, 0x51, 0x55, 0x49, 0x54, 0x0A, 0x21].forEach(function (e) { var hapstr = '\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A\x21';
FServerSocket.sendBin(e, 1);
});
if (client.socket.family === PF_INET) { if (client.socket.family === PF_INET) {
FServerSocket.sendBin(0x11, 1); hapstr += '\x11\x0C';
FServerSocket.sendBin(12, 2);
} else if (client.socket.family === PF_INET6) { } else if (client.socket.family === PF_INET6) {
FServerSocket.sendBin(0x21, 1); hapstr += '\x21\x24';
FServerSocket.sendBin(36, 2);
} }
FServerSocket.sendBin(inet_pton(client.ip_address), 4); hapstr += inet_pton(client.ip_address);
FServerSocket.sendBin(inet_pton(FServerSocket.remote_ip_address), 4); hapstr += inet_pton(FServerSocket.remote_ip_address);
FServerSocket.sendBin(client.port, 2); hapstr += client.port.toString(16);
FServerSocket.sendBin(TargetPort, 2); hapstr += TargetPort.toString(16);
FServerSocket.send(hapstr);
} }
// Loop while we're still connected on both ends // Loop while we're still connected on both ends
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment