Giter Site home page Giter Site logo

dnssd.js's People

Contributors

demille avatar jpoppe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dnssd.js's Issues

Adding custom attributes to new ServiceType

An example of what I mean, the callback of a browse of the network logs "topic" as undefined
const fooServiceType = new dnssd.ServiceType({ name: '_mqtt', protocol: '_tcp', topic: 'topic3' });

Incorrect hostname when specifying a FQDN

When I specify host as a FQDN, it gets renamed improperly.

Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[32m•Advertise…#033[0m #033[9
0m[11:43:07:338]#033[0m Hostname renamed to "somehost.mydomain.net (2)" on int
erface records
Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[34m•ResourceR…#033[0m #033[90m[11:43:07:295]#033[0m Found conflict:
Jul 27 11:43:07 wilhelm signalk-server[23344]:     Record: somehost.mydomain.net.local. #033[34mA#033[0m 120 192.168.1.200 #033[90m(flush)#033[0m
Jul 27 11:43:07 wilhelm signalk-server[23344]:     Incoming: somehost.mydomain.net.local. #033[34mA#033[0m 120 192.168.1.122 #033[90m(flush)#033[0m
Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[34m•ResourceR…#033[0m #033[90m[11:43:07:295]#033[0m Found conflict:
Jul 27 11:43:07 wilhelm signalk-server[23344]:     Record: somehost.mydomain.net.local. #033[34mAAAA#033[0m 120 fe80::d056:37ff:fe54:903e #033[90m(flush)#033[0m
Jul 27 11:43:07 wilhelm signalk-server[23344]:     Incoming: somehost.mydomain.net.local. #033[34mAAAA#033[0m 120 fe80::210a:8e62:baf3:12e #033[90m(flush)#033[0m
Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[35m•Probe.js  #033[0m #033[90m[11:43:07:296]#033[0m Found conflict on incoming records (id#2)
Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[35m•Probe.js  #033[0m #033[90m[11:43:07:297]#033[0m Probe stopped (id#2)
Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[36m•Responder…#033[0m #033[90m[11:43:07:298]#033[0m Sending stop signal to actives. (id#2)
Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[36m•Responder…#033[0m #033[90m[11:43:07:298]#033[0m Had a conflict with "somehost.mydomain.net", renaming. (id#2)
Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[36m•Responder…#033[0m #033[90m[11:43:07:303]#033[0m Now probing for: somehost.mydomain.net (2).local.
Jul 27 11:43:07 wilhelm signalk-server[23344]: #033[36m•Responder…#033[0m #033[90m[11:43:07:303]#033[0m Sending probes for "somehost.mydomain.net (2).local.". (id#2)

ResourceRecord2 is not a constructor

I'm getting a strange error when I use the library in a built project (using esbuild).

The error is: ResourceRecord2 is not a constructor

Anyone seeing this as well?

Stale multicast address

When an interface has been changed to a different network, it can use a stale multicast address, resulting in an EADDRNOTAVAIL error.

Expected: the interface uses the multicast address for the current network
Actual: the interface uses the multicast address for the first network it saw

Steps to reproduce:

  1. Connect to a wifi network
  2. Start a dnssd browser
  3. Stop the dnssd browser
  4. Connect to a different wifi network
  5. Start a dnssd browser

An error like this is thrown:

Error: setMulticastInterface EADDRNOTAVAIL
at Socket.setMulticastInterface (dgram.js:566:11)
at Socket.eval (webpack:///./node_modules/dnssd/lib/NetworkInterface.js?:238:41)
at Socket.emit (events.js:182:13)
at startListening (dgram.js:128:10)
at state.handle.lookup (dgram.js:249:7)
at process._tickCallback (internal/process/next_tick.js:63:19)

disable network interface

Error: send ENETUNREACH 224.0.0.251:5353
    at doSend (node:dgram:705:16)
    at defaultTriggerAsyncIdScope (node:internal/async_hooks:464:18)
    at afterDns (node:dgram:651:5)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at listOnTimeout (node:internal/timers:533:9)
    at process.processTimers (node:internal/timers:507:7) {
  errno: -101,
  code: 'ENETUNREACH',
  syscall: 'send',
  address: '224.0.0.251',
  port: 5353
}

So we can not use library with browser and advertiser on the same machine

Interval in sleep.js seems to keep the process alive

I am using Node v10.11.0.

I’ve seen that the interval in sleep.js is unref()ed to allow the process to end, however, this does not seem to work for me.

Minimal code to reproduce

const dnssd = require('dnssd');
const ad = new dnssd.Advertisement(dnssd.tcp('http'), 4321);
console.log('starting...');
ad.start();
console.log('started');
console.log('stopping...');
ad.stop(false, (err) => {
  if (err) throw err;
  console.log('stopped');
});

When running this script, the process will not exit for me.

How I came to this observation

I use webthing which uses dnssd via NPM.

After completing tests in a repository of mine Jest has to be force exited for the process to quit.

git clone [email protected]:webthings/all-webthings.git
cd all-webthings
git checkout cf92a899d376ca48411b56f04ca0c2915a41d2ba
npm test -- --detectOpenHandles

This output the following on my machine:

Ran all test suites.

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  Timeout

      at Object.<anonymous> (node_modules/dnssd/lib/sleep.js:14:16)
      at Object.<anonymous> (node_modules/dnssd/lib/Advertisement.js:14:13)

TXT record key length (arbitrary ?) limited to 9 characters

There is a TXT record key validation rule that limits the length of a key to 9 characters.
As far as I know, there is no such limitation in DNS-SD RFC. Both Apple and Avahi implementations
does not restrict key lengths.

This validation rule should be removed.

subtypes in options not working

The servicetypes passed in the options parameter while creating an advertisement are ignored.

const dnssd = require('dnssd');
const ad = new dnssd.Advertisement(dnssd.tcp('http'), 4321, { subtypes: ['printer'] });
ad._makeServiceRecords()

Should contain the printer._sub._http._tcp.local. PTR-Record.

Creating it with your a new ServiceType works as expected.

const dnssd = require('dnssd');
const ad = new dnssd.Advertisement(new dnssd.ServiceType('_http._tcp,printer'), 4321);
ad._makeServiceRecords()

Advertisements published on first interface only?

Hi,
we have an embedded system with a number of interfaces - eth0, wlan0, bat0 - to name a few.
The following code runs

var DNSSD = require("dnssd");

let _dnsdsBrowser = new DNSSD.Browser(DNSSD.tcp('_mqtt'));
let _dnsdsAdvMqtt = new DNSSD.Advertisement(DNSSD.tcp('_funky'), 2883, { name: 'FUNKY' });
let _dnsdsAdvMqttWS = new DNSSD.Advertisement(DNSSD.tcp('_funky-ws'), 3001, { name: 'FUNKY WS' });

_dnsdsAdvMqtt.start();

but the services show up only on the first interface that has been detected (eth0 in our case, where we don't want it ... ) -- not even at localhost.

How can we make sure it is accessible from the other network participants?
Simon

resolveA/resolveAAAA replaced with resolve4/resolve6?

resolveA and resolveAAAA mentioned in the readme seem to be missing:

$ node 
> require('./')
{ Advertisement: [Function: Advertisement],
  Browser: [Function: Browser],
  ServiceType: [Function: ServiceType],
  tcp: [Function: tcp],
  udp: [Function: udp],
  all: [Function: all],
  validate: 
   { protocol: [Function: protocol],
     serviceName: [Function: serviceName],
     label: [Function: label],
     port: [Function: port],
     txt: [Function: txt] },
  resolve: [Function: resolveAny],
  resolveA: undefined,                    <---------------
  resolveAAAA: undefined,                 <---------------
  resolveSRV: [Function: resolveSRV],
  resolveTXT: [Function: resolveTXT],
  resolveService: [Function: resolveService] }

I assume they are meant to use

dnssd.js/lib/resolve.js

Lines 81 to 91 in 3fd30a7

function resolve4(name, opts) {
return resolveAny(name, 'A', opts).then(function (result) {
return result.answer.address;
});
}
function resolve6(name, opts) {
return resolveAny(name, 'AAAA', opts).then(function (result) {
return result.answer.address;
});
}
like resolveSRV and resolveTXT.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.