feat: add hyper proxy for handshake dns
This commit is contained in:
parent
0cb070f47e
commit
a47d83942c
14
src/index.ts
14
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,
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue