Comments (6)
Unfortunately there is no generic way to do it. os.networkInterfaces()
skips interfaces that have no address assigned. I've been thinking about proposing a patch to node to get all interfaces. However, if all interfaces have an address there is a hackish way to do it. See #31 for details.
This one is bugging me for quite some time. I'll see what I can do about it.
Thanks for the kind words regarding the documentation.
from node_mdns.
Is interfaceIndex
a "standard" sort of thing used in various c libs? Perhaps we could suggest to the node devs that they add the interfaceIndex
attribute to os.networkInterfaces()
?
I believe that should be doable without any API breakage.
from node_mdns.
Well it's not exactly standard, but many cross platform libraries do it that way. That's because it's the simplest thing to do in C. I'd still prefer an optional boolean flag. os.networkInterfaces(true)
returns the full list while os.networkInterfaces()
returns only those with an address. That doesn't break the API and is a little bit more generic IMHO. Think about a network manager written in node that wants to assign addresses to unconfigured interfaces &c. But I wouldn't mind. Any solution would do...
I already looked into it. Implementing it is pretty straight forward. However, I have to deal with this IOWatcher
issue (#34 and #38) first, because that's an actual show stopper.
from node_mdns.
Sorry for the long delay. But finally there is some progress on this:
serviceUp
andserviceDown
events now have a human readablenetworkInterface
property. The strings are compatible with those returned byos.networkInterfaces()
.mdns.createBrowser()
andmdns.createAdvertisement()
now support anetworkInterface
option. It may be set to an interface name, an IP address or an interface index.- The user guide has a new section on network interfaces.
It isn't released yet, because I have to do some more testing. Just check out the master branch if you want to take a look. The raw version of the user guide is here: https://github.com/agnat/node_mdns/blob/master/doc/pages/user_guide.ejs
Thanks for your patience ;)
from node_mdns.
Awesome. Thanks.
from node_mdns.
I'm about to release v1.1.0 which contains lots of improvements regarding network interface handling. I'm closing this issue.
Have fun...
from node_mdns.
Related Issues (20)
- install fails on void linux
- Failure on Raspberry Pi: getaddrinfo -3001 HOT 6
- Error on node-gyp HOT 2
- Issues with Airplay. HOT 1
- Module not "context aware" - cannot be used in Electron
- The specified procedure could not be found HOT 5
- Discovery crashes when running in Docker HOT 2
- Error while discovering services getaddrinfo -3008 HOT 2
- Use mdns.Browser over VPN connection HOT 3
- Favor dns_sd DNSServiceGetAddrInfo on linux as well HOT 2
- Debian 10 won't run this module HOT 4
- Install issue? HOT 5
- Unable to install on macos monterey HOT 2
- Cannot import mdns from a Worker HOT 5
- Handle getaddrinfo error gracefully HOT 5
- Broken links for documentation, donation button, more
- Cannot compile/install on Raspberry Pi OS due to missing dns_sd.h
- Arbitrary service_name length limit HOT 3
- Can't install mdns package on ubuntu 22.04 and nodejs v20.13.0 HOT 2
- Node 20.13+: Crash on getaddrinfo_0_11 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node_mdns.