├── .gitignore ├── .travis.yml ├── index.js ├── LICENSE ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '4' 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict' 3 | 4 | var bonjour = require('bonjour')() 5 | 6 | var name = process.argv[2] 7 | var found = {} 8 | 9 | bonjour.find({ type: name }, function (service) { 10 | if (service.fqdn in found) return 11 | found[service.fqdn] = true 12 | console.log(service.fqdn) 13 | }) 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Thomas Watson Steen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bonjour-browser", 3 | "version": "1.0.1", 4 | "description": "A command line tool to browse for Bonjour/Zeroconf enabled services on your local network", 5 | "bin": { 6 | "bonjour": "index.js" 7 | }, 8 | "dependencies": { 9 | "bonjour": "^3.2.0" 10 | }, 11 | "devDependencies": { 12 | "standard": "^5.4.1" 13 | }, 14 | "scripts": { 15 | "test": "standard" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "git+https://github.com/watson/bonjour-browser.git" 20 | }, 21 | "keywords": [ 22 | "cli", 23 | "bonjour", 24 | "zeroconf", 25 | "browse", 26 | "find", 27 | "search", 28 | "list", 29 | "dnssd", 30 | "dns-sd", 31 | "rfc6763", 32 | "rfc-6763", 33 | "6763" 34 | ], 35 | "author": "Thomas Watson Steen (https://twitter.com/wa7son)", 36 | "license": "MIT", 37 | "bugs": { 38 | "url": "https://github.com/watson/bonjour-browser/issues" 39 | }, 40 | "homepage": "https://github.com/watson/bonjour-browser#readme", 41 | "preferGlobal": true, 42 | "coordinates": [ 43 | 55.6666981, 44 | 12.5798091 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bonjour Browser 2 | 3 | A command line tool to browse for Bonjour/Zeroconf enabled services on 4 | your local network. 5 | 6 | [![Build status](https://travis-ci.org/watson/bonjour-browser.svg?branch=master)](https://travis-ci.org/watson/bonjour-browser) 7 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) 8 | 9 | ## Installation 10 | 11 | This software is written in Node.js and can be installed using the npm 12 | package manager. Ensure that you've [downloaded](https://nodejs.org) and 13 | installed Node.js before continueing. 14 | 15 | Install the `bonjour` program globally: 16 | 17 | ``` 18 | npm install bonjour-browser -g 19 | ``` 20 | 21 | ## Usage 22 | 23 | ``` 24 | bonjour [Service Name] 25 | ``` 26 | 27 | Run the `bonjour` command without any arguments to get a list of 28 | available services no matter their Service Name. 29 | 30 | ``` 31 | $ bonjour 32 | Intranet._http._tcp.local 33 | HP LaserJet 4600._ipp._tcp.local 34 | HP LaserJet 4600._http._tcp.local 35 | Brother 5070N._ipp._tcp.local 36 | Canon W2200._ipp._tcp.local 37 | ``` 38 | 39 | Add a Service Name as the 1st argument to limit your search to only 40 | instanes of the given Servie Name: 41 | 42 | ``` 43 | $ bonjour ipp 44 | Brother 5070N._ipp._tcp.local 45 | Canon W2200._ipp._tcp.local 46 | HP LaserJet 4600._ipp._tcp.local 47 | ``` 48 | 49 | ## Gotcha 50 | 51 | Due to the way the DNS-SD standard is defined, services run by clients 52 | that do not respond to `_services._dns-sd._udp.` queries will 53 | not be discovered if you do not provide their Service Name as the 1st 54 | argument. 55 | 56 | ## License 57 | 58 | MIT 59 | --------------------------------------------------------------------------------