<commit_before>libp2p-mdns JavaScript implementation
===============================================

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-mdns-discovery/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-mdns-discovery?branch=master)
[![Travis CI](https://travis-ci.org/libp2p/js-libp2p-mdns-discovery.svg?branch=master)](https://travis-ci.org/libp2p/js-libp2p-mdns-discovery)
[![Circle CI](https://circleci.com/gh/libp2p/js-libp2p-mdns-discovery.svg?style=svg)](https://circleci.com/gh/libp2p/js-libp2p-mdns-discovery)
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-mdns-discovery.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-mdns-discovery) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)

> Node.js libp2p mDNS discovery implementation

# Usage

```JavaScript
var MulticastDNS = require('libp2p-mdns')

var mdns = new MulticastDNS(libp2pNodeInstance, options)

mdns.on('peer', (peerInfo) => {
  console.log('Found a peer in the local network', peerInfo.id.toB58String())
})
```

- options
  - `broadcast` - (true/false) announce our presence through mDNS
  - `interval` - query interval
  - `serviceTag` - name of the service announced
  - `verify` - Verifies if we can establish a connection with the peer, before emitting a `peer` event<commit_msg>docs: update readme badges and API documentation<commit_after>libp2p-mdns JavaScript implementation
=====================================

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-libp2p-mdns/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-libp2p-mdns?branch=master)
[![Travis CI](https://travis-ci.org/libp2p/js-libp2p-mdns.svg?branch=master)](https://travis-ci.org/libp2p/js-libp2p-mdns)
[![Circle CI](https://circleci.com/gh/libp2p/js-libp2p-mdns.svg?style=svg)](https://circleci.com/gh/libp2p/js-libp2p-mdns)
[![Dependency Status](https://david-dm.org/libp2p/js-libp2p-mdns.svg?style=flat-square)](https://david-dm.org/libp2p/js-libp2p-mdns) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)

> JavaScript libp2p MulticastDNS discovery implementation

# Usage

```JavaScript
var MDNS = require('libp2p-mdns')

var mdns = new MDNS(peerInfo, options)

mdns.on('peer', (peerInfo) => {
  console.log('Found a peer in the local network', peerInfo.id.toB58String())
})

// Broadcast for 20 seconds
mdns.start(() => setTimeout(() => mdns.stop(() => {}), 20 * 1000))
```

- options
  - `broadcast` - (true/false) announce our presence through mDNS
  - `interval` - query interval
  - `serviceTag` - name of the service announced
{'fraction_non_alphanumeric': 0.21301947108398722, 'fraction_numerical': 0.02063353676256902, 'mean_word_length': 5.619230769230769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 26, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4240788', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1290, 'n_words': 144}