Skip to content

Instantly share code, notes, and snippets.

@uiur
Created June 1, 2015 06:11
Show Gist options
  • Save uiur/a4244d324050d1cbe7c1 to your computer and use it in GitHub Desktop.
Save uiur/a4244d324050d1cbe7c1 to your computer and use it in GitHub Desktop.
var mdns = require('multicast-dns')()
var ip = require('ip')
mdns.on('query', function (query) {
if (query.questions[0] && query.questions[0].name === 'dj.local') {
mdns.respond([
{ name: 'dj.local', type: 'A', data: ip.address() },
{ name: 'dj.local', type: 'AAAA', data: ip.address('ipv6') }
])
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment