ssbc / ssb-config

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

PATCH - fix host address for ipv6 networks #59

Closed mixmix closed 4 years ago

mixmix commented 4 years ago

Heads up butts ... oh that's a new one I'm changing the default host thing to catch some weird ipv6 network behaviour.

Tested from windows <> linux machines with ssb-lan and immediately saw things working.


original issue posted here : https://github.com/ssbc/secret-stack/issues/46

mixmix commented 4 years ago

cc @cryptix @christianbundy @pietgeursen @staltz @Happy0 @soapdog @mmckegg @dominictarr

mixmix commented 4 years ago

published as 3.3.3

mixmix commented 4 years ago

:warning: I didn't test this on an ipv4 network, but given the change I made I don't think that's a problem. I think we should probably review the options non-private-ip provides. I don't know enough about whether we should be leaning into ipv6 yet ...

mixmix commented 4 years ago

here's what non-private-ip provides :

{ [Function]
  private:
   { [Function] v4: '192.168.1.162', v6: 'fe80::4e47:553c:c9f4:6acc' },
  v4: undefined,
  v6: '2407:7000:9c49:4e00:ecda:4ad0:b28a:25a2',
  all:
   { public:
      { v4: undefined, v6: '2407:7000:9c49:4e00:ecda:4ad0:b28a:25a2' },
     private: { v4: '192.168.1.162', v6: 'fe80::4e47:553c:c9f4:6acc' } } }

where

private()
// => '192.168.1.162'
mixmix commented 4 years ago

oh actually this is likely a terrible solution I've just published, but perhaps the existing config is as well ... with :: as a fallback.

I've not fully understood the VPS stuff in non-private-ip ... I guess the desire is to try and find a "public" IP address for the host, which is useful if you're a pub. for me on a local network behind a DHCP... I guess I want a private IP address so at least people locally can call in to me?

staltz commented 4 years ago

@mixmix perhaps relevant to your issue is my fork of non-private-ip: https://github.com/staltz/non-private-ip/blob/5cded6587560b24dbe14792d381f03e258e14356/index.js

I had to do this because on mobile it's quite common that non-private-ip returns an IPv6 address, often not for the network interface you're interested in (wlan0), but for other carrier and mobile-related net interfaces (rmnet0, etc). What my fork does is that instead of taking the first IP address it sees, it gives each IP address a score and selects the one with the highest score, prioritizing wlan interfaces and IPv4.

mixmix commented 4 years ago

Nice idea!

note I've merged a PR christian wrote which over-writes this. Not sure how that will play with your thing, but worth checking out. %TR33K6AtKDYY9XIwK3dmkV3B5PlSMuiirYiI/6N755g=.sha256

mixmix commented 4 years ago

Perhaps your thing could be mergedinto non-private-ip ... or maybe published as a new module which has the same API?

staltz commented 4 years ago

Perhaps your thing could be mergedinto non-private-ip ... or maybe published as a new module which has the same API?

Yes I think I should merge it. I think I also tested it on desktop.