
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
bare-mdns-discovery
Advanced tools
⚠️ Experimental Claude generated prototype
Minimal mDNS/DNS-SD service discovery.
npm install bare-mdns-discovery
const { MDNS } = require('bare-mdns-discovery')
const mdns = new MDNS({ debug: true })
await mdns.ready()
mdns.on('records', (records, rinfo) => {
console.log('from:', rinfo.address)
for (const r of records) {
console.log(r.type, r.name, r.data)
}
})
mdns.query('_services._dns-sd._udp.local')
mdns.query('_http._tcp.local')
mdns.query('_googlecast._tcp.local')
setTimeout(() => mdns.close(), 10000)
const { Discovery } = require('bare-mdns-discovery')
const discovery = new Discovery({ service: 'googlecast' })
await discovery.ready()
discovery.on('service', (service) => {
console.log('Found:', service.name, service.address, service.port)
})
const services = await discovery.discover(10) // 10 second timeout
console.log('All services:', services)
await discovery.close()
const { Discovery } = require('bare-mdns-discovery')
class MyServiceDiscovery extends Discovery {
constructor(opts = {}) {
super({ ...opts, service: 'myservice' })
}
_parseService(records, rinfo) {
const service = super._parseService(records, rinfo)
if (!service) return null
// Add custom filtering or fields
return {
...service,
customField: service.txt.someKey
}
}
}
new MDNS(opts?)Create a low-level mDNS instance.
Options:
debug (boolean): Enable debug logging. Default: falseiface (string): IPv4 address of the network interface to join the multicast group on. Required on Android — without this, addMembership falls back to the OS default interface which may not be the WiFi interface, causing responses to be silently dropped. Pass the WiFi IP (e.g. from bare-wifi-android's getWifiIP()).mdns.ready()Wait for the socket to be bound. Returns a Promise.
mdns.query(name, type?)Send an mDNS query.
name (string): Service name, e.g. '_http._tcp.local'type (number): Record type. Default: TYPE.PTR (12)mdns.close()Close the socket. Returns a Promise.
'records'Emitted when records are received.
mdns.on('records', (records, rinfo) => {
// records: Array of parsed DNS records
// rinfo: { address, port, family, size }
})
new Discovery(opts?)High-level service discovery. Extends MDNS.
Options:
service (string): Service type without prefix/suffix, e.g. 'http', 'googlecast'debug (boolean): Enable debug logging. Default: falsediscovery.discover(timeout?)Discover services on the network. Returns a Promise resolving to an array of services.
timeout (number): Discovery timeout in seconds. Default: 10discovery.servicesMap of discovered services keyed by uid.
'service'Emitted when a service is discovered.
discovery.on('service', (service) => {
// service: { uid, name, address, addresses, port, target, txt }
})
const { TYPE } = require('bare-mdns-discovery')
TYPE.A // 1 - IPv4 address
TYPE.PTR // 12 - Pointer
TYPE.TXT // 16 - Text
TYPE.AAAA // 28 - IPv6 address
TYPE.SRV // 33 - Service
const { MDNS_ADDR, MDNS_PORT } = require('bare-mdns-discovery')
MDNS_ADDR // '224.0.0.251'
MDNS_PORT // 5353
Apache-2.0
FAQs
bare-mdns-discovery
The npm package bare-mdns-discovery receives a total of 4 weekly downloads. As such, bare-mdns-discovery popularity was classified as not popular.
We found that bare-mdns-discovery demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.