forked from BobaBoard/boba-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mgdns_proxies.js
34 lines (29 loc) · 900 Bytes
/
mgdns_proxies.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const mdns = require("multicast-dns")();
const TO_REGISTER = ["v0_boba.local", "v1_boba.local"];
// mdns.on("response", function (response) {
// if (response.answers.some((q) => q.name.indexOf("boba.local") != -1)) {
// console.log("got a response packet:", response);
// }
// });
// mdns.on("query", function (query) {
// console.log(query.questions.map((q) => `${q.name} ${q.type}`));
// if (query.questions.some((q) => q.name.indexOf("boba.local") != -1)) {
// console.log("got a query packet:", query.questions);
// }
// });
const registerDomains = () => {
mdns.respond({
answers: TO_REGISTER.map((domain) => ({
name: domain,
type: "A",
ttl: 30,
data: "127.0.0.1",
})),
});
};
setTimeout(function timing() {
console.log("refreshing DNS entries");
registerDomains();
setTimeout(timing, 25 * 1000);
}, 25 * 1000);
registerDomains();