Commit 061e3e72a74371aae02321b09a7ba522a143fa4a
bonjour
Tree committed on 12/14/2016, 4:01:03 AMParent: 1c3bb55caa34e2ddba219e58aec5893424a109b0
Files changed
index.js | changed |
readme.md | added |
index.js | ||
---|---|---|
@@ -2,8 +2,9 @@ | ||
2 | 2 … | var keys = require('./keys.json') |
3 | 3 … | var appkey = require('./appkeys.json') |
4 | 4 … | var muxrpc = require('muxrpc') |
5 | 5 … | var ms = require('multiserver') |
6 … | +var mdns = require('mdns') | |
6 | 7 … | |
7 | 8 … | var createApp = secretStack({ |
8 | 9 … | appKey: appkey.private |
9 | 10 … | }).use({ |
@@ -28,5 +29,19 @@ | ||
28 | 29 … | var node = createApp({ |
29 | 30 … | keys: keys |
30 | 31 … | }) |
31 | 32 … | |
33 … | +var record = { | |
34 … | + name: process.argv[3] || 'poopface', | |
35 … | + address: node.getAddress() | |
36 … | +} | |
37 … | + | |
38 … | +var ad = mdns.createAdvertisement(mdns.tcp('http'), 11111, {txtRecord: record}) | |
39 … | +ad.start() | |
40 … | + | |
41 … | +var browser = mdns.createBrowser(mdns.tcp('http'), 11111) | |
42 … | +browser.on('serviceUp', function(service){ | |
43 … | + console.log(service.txtRecord.address) | |
44 … | +}) | |
45 … | + | |
46 … | + | |
32 | 47 … | console.log(node.getAddress()) |
Built with git-ssb-web