Open christianbundy opened 5 years ago
hmmm ... or maybe ::
would cause multiserver to iterate through all the scopes, ask multiserver-scopes for the address for each one of them in turn and collect the results?
or, maybe better: multiserver-scopes has a function that returns address that cover all scopes?
host('local', '::')
doesn't make a whole lot of sense if you look at it without the context you gave, so I'm not a big fan.
Thanks for the quick response! Do you think the ssb-config workaround is a reasonable enough workaround (if config.host == null
, enumerate interfaces automatically) or do you think that will break things for you?
multiserver to iterate through all the scopes, ask multiserver-scopes for the address for each one of them in turn and collect the results
In this system would multiserver-scopes be returning a single address or an array? I think I'm lacking context for why host('local')
only returns one address (e.g. maybe I have both an IPv4 and IPv6 address on the LAN), so it's very possible that I'm just missing the bigger picture.
Thinking about this more, I think I'm making two distinct proposals that would fix behavior for multiserver listening on the ::
and 0.0.0.0
meta-addresses:
['127.0.0.1', '::1']
[ '192.168.0.42', '10.0.0.1' ]
[ '1.2.3.4', '5.6.7.8' ]
family
argument to specify IPv4 or IPv6
scopes('device', 'IPv4') // => ['127.0.0.1']
scopes('device', 'IPv6') // => [ '::1' ]
@christianbundy both sound fine to me. My feeling was that nobody had a clear grasp on what scopes actually are (certainly I don't). That's why I created this module, so that the definition of scopes would eventually end up here and would be defined by code at one place.
@christianbundy I agree that host()
should return an array. You are right, to assume that there's just one IP in each scope is silly. The reason it does not is that the underlying non-private-ip
module simply returns the first IP that matches a predicate. Using os.networkInterfaces()
directly in multiserver-scopes@2 makes sense to me.
Hey @regular! I've been working on the problem where multiserver listens on
::
butmultiserver.stringify()
uses this module seems to only return a single address, which is causing connectivity issues because it's not broadcasting all of the addresses that it's actually listening on. When ssb-config sets the host as::
Node understands that means "listen on all interfaces" but then when we callmultiserver.stringify()
it only returns the address for one interface..I've opened https://github.com/ssbc/ssb-config/pull/53/files as a workaround to resolve this, but I'm realizing that this problem may be worth resolving in multiserver and multiserver-scopes instead. Here's what I'm thinking:
Before
After