Skip to content

Multicast DNS Types

Jared Rice Sr edited this page Jul 1, 2018 · 1 revision

@distdns/types

dWeb Library For MultiCast DNS Types, allowing for the parsing and stringifying of mDNS Service Types.

npm install @distdns/types

Usage

var mDNSTypes = require('@distdns/types')

console.log(mDNSTypes.stringify({name: 'http', protocol: 'tcp', subtypes: ['sub1', 'sub2']})) // _http._tcp._sub1._sub2
console.log(mDNSTypes.parse('_http._tcp._sub1._sub2')) // {name: 'http', protocol: 'tcp', subtypes: ['sub1', 'sub2']}

The following shorthands also exist

mDNSTypes.stringify(name, protocol, subtypes)
mDNSTypes.tcp(name, subtypes) // set protocol to tcp
mDNSTypes.udp(name, subtypes) // set protocol to udp
Clone this wiki locally