2.0.0 • Published 5 years ago

tubemail-mdns v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Tube Mail: Discovery mDNS

This is just a helper module for Tube Mail. This module can be used to enable mDNS-based discovery.

Example

// npm install tubemail tubemail-mds
const fs = require('fs');
const tubemail = require('tubemail');

const toBuffer = (obj) => Buffer.from(obj.toString());

tubemail.join({
	key: fs.readFileSync('./hood.peer1.key'),
	cert: fs.readFileSync('./hood.peer1.crt'),
	ca: fs.readFileSync('./hood.crt'),
	discovery: require('tubemail-mdns');
}).then((hood) => {
	// Send the current time every second
	setInterval(() => hood.send(toBuffer(new Date())), 1000);

	// Say hello to new neighs
	hood.on('foundNeigh', (n) => n.send(toBuffer(`Hello ${n.info.subject.commonName}!`)));
});
2.0.0

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago