Add host/port "switchboard" module

Centrally list all hostnames and port numbers here. Need to push
this into IDZ further but I'm a bit short on time (so what else is
new).
This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent ff4545d468
commit 355f20c50b
6 changed files with 110 additions and 62 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
import { createSocket } from "dgram";
export default function createPing(port: number) {
export default function createPing(port: number, host: string) {
const socket = createSocket("udp4");
socket.bind(port);
socket.bind(port, host);
socket.on("message", (msg, rinfo) => {
console.log(`Idz Ping: Ping from ${rinfo.address}:${rinfo.port}`);
socket.send(msg, rinfo.port, rinfo.address);