ssbc / ssb-config

standard configuration for ssb
MIT License
23 stars 18 forks source link

Switch back to IPv4 to conform to existing docs and unbreak tests #47

Closed christianbundy closed 4 years ago

christianbundy commented 5 years ago

It seems like The Right Way to go about this is to omit the host entirely so that Node.js can decide on a host automagically:

If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available, or the unspecified IPv4 address (0.0.0.0) otherwise.

-- https://nodejs.org/api/net.html

...but we shouldn't do that until ssb-client knows that an omitted host means "try both :: and 0.0.0.0". In the meantime, this brings us back to an IPv4-only default config which unbreaks Travis and conforms to the code comments that say:

    // just use an ipv4 address by default.
    // there have been some reports of seemingly non-private
    // ipv6 addresses being returned and not working.
    // https://github.com/ssbc/scuttlebot/pull/102
regular commented 5 years ago

@christianbundy I didn't keep up with the latest developments here, so just a a note: keep in mind that omitting host has security implications, because ti make the server listen on all available IP addresses. You don't ever want to combine this with noauth. (noauth via websockets is something people want to use on localhost. Exposing it to a local (LAN) or even public IP would be a disaster)

mixmix commented 4 years ago

test this and found that it results in sbot.getAddress('local', null) resulting in 'net:0.0.0.0:8087~shs:AjtDkqLp76adwR5TeYyNpV3AY3zmHXCjU+Zht6rsFIA='

getAddress uses multiserver's stringify, so this is related to that other PR. I don't understand multiserver well enough to know where this should go ):