From 49821022f0d35bf90057491263e623454c8051a1 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 6 Jun 2019 14:09:19 +0100 Subject: [PATCH] Hostnames are case-insensitive. Ugh --- packages/syntax-playground/src/socks-gateway.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/syntax-playground/src/socks-gateway.js b/packages/syntax-playground/src/socks-gateway.js index 5447703..9fc6919 100644 --- a/packages/syntax-playground/src/socks-gateway.js +++ b/packages/syntax-playground/src/socks-gateway.js @@ -251,17 +251,25 @@ spawn named 'remap-service' { const debug = debugFactory('syndicate/server:socks:remap-service'); field this.table = Map(); + function lc(va) { + return VirtualTcpAddress(VirtualTcpAddress._host(va).toLowerCase(), + VirtualTcpAddress._port(va)); + } + during C.ServerConnected(server_addr) { on asserted C.FromServer(server_addr, $entry(AddressMap(_, _, _))) { debug('+', entry.toString()); - this.table = this.table.set(AddressMap._from(entry), entry); + this.table = this.table.set(lc(AddressMap._from(entry)), entry); } on retracted C.FromServer(server_addr, $entry(AddressMap(_, _, _))) { debug('-', entry.toString()); - this.table = this.table.remove(AddressMap._from(entry)); + this.table = this.table.remove(lc(AddressMap._from(entry))); } - during S.Stream($id, S.Outgoing($a(VirtualTcpAddress($host, $port)))) { + during S.Stream($id, S.Outgoing($a0(VirtualTcpAddress(_, _)))) { + const a = lc(a0); + const host = VirtualTcpAddress._host(a); + const port = VirtualTcpAddress._port(a); if (host.endsWith('.fruit')) { if (this.table.has(a)) { const entry = this.table.get(a);