diff --git a/src/index.ts b/src/index.ts index 2c0c4bd..5b33d16 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,6 +8,7 @@ import { MultiSocketProxy } from "@lumeweb/libhyperproxy"; let api: PluginAPI; const PROTOCOL = "lumeweb.proxy.handshake"; +const DNS_PROTOCOL = "lumeweb.proxy.handshake.dns"; const plugin: Plugin = { name: "handshake", @@ -26,6 +27,19 @@ const plugin: Plugin = { muxer, }); }); + + const dnsProxy = new MultiSocketProxy({ + swarm: api.swarm, + protocol: DNS_PROTOCOL, + allowedPorts: [53], + server: true, + }); + api.protocols.register(DNS_PROTOCOL, (peer: any, muxer: any) => { + dnsProxy.handlePeer({ + peer, + muxer, + }); + }); }, };