Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with LocalHost node ? #20

Open
sethleedy opened this issue Jun 3, 2017 · 6 comments
Open

Issue with LocalHost node ? #20

sethleedy opened this issue Jun 3, 2017 · 6 comments

Comments

@sethleedy
Copy link

sethleedy commented Jun 3, 2017

I'm setting up the smoke p2p on multiple ip addresses on my machine(Ubuntu shell on Windows 10). I'm testing the connectivity with a localhost node.
I'm getting this error concerning the netmask.js:
/mnt/c/Users/Seth/Documents/Syncs/Research_and_Dev/Current Projects/P2P-Nodes/P2P-Nodes/node_modules/netmask/lib/netmask.js:23
throw new Error("Invalid byte: " + byte);
^

Error: Invalid byte: undefined
at ip2long (/mnt/c/Users/Seth/Documents/Syncs/Research_and_Dev/Current Projects/P2P-Nodes/P2P-Nodes/node_modules/netmask/lib/netmask.js:23:15)
at Netmask.contains (/mnt/c/Users/Seth/Documents/Syncs/Research_and_Dev/Current Projects/P2P-Nodes/P2P-Nodes/node_modules/netmask/lib/netmask.js:106:17)
at Object.exports.localIp (/mnt/c/Users/Seth/Documents/Syncs/Research_and_Dev/Current Projects/P2P-Nodes/P2P-Nodes/node_modules/smokesignal/index.js:22:17)
at Object.startupLocalSmoke (/mnt/c/Users/Seth/Documents/Syncs/Research_and_Dev/Current Projects/P2P-Nodes/P2P-Nodes/custom_modules/functions.js:25:28)

Code:

startupLocalSmoke: function(defaultSeeds = ["127.0.0.1", "13"]) {
        console.log("startupLocalSmoke: " + defaultSeeds[0])

        var localNode = smoke.createNode({
            port: parseInt(defaultSeeds[1]),
            address: smoke.localIp(defaultSeeds[0] + "/255.0.0.0") // Tell it your subnet and it'll figure out the right IP for you
                //,seeds: [{port: defaultSeeds[1], address:defaultSeeds[0]}] // the address of a seed (a known node)
        })
@sethleedy
Copy link
Author

sethleedy commented Jun 3, 2017

Looking in the netmask.js:

ip2long = function(ip) {
    var b, byte, i, j, len;
    b = (ip + '').split('.');
    if (b.length === 0 || b.length > 4) {
      throw new Error('Invalid IP');
    }
    for (i = j = 0, len = b.length; j < len; i = ++j) {
      byte = b[i];
      if (isNaN(parseInt(byte, 10))) {
        throw new Error("Invalid byte: " + byte);
      }
      if (byte < 0 || byte > 255) {
        throw new Error("Invalid byte: " + byte);
      }
    }
    return ((b[0] || 0) << 24 | (b[1] || 0) << 16 | (b[2] || 0) << 8 | (b[3] || 0)) >>> 0;
  };

It's looking for an invalid length ?

@marcelklehr
Copy link
Owner

Hey!
Which node version are you using?

@sethleedy
Copy link
Author

node -v
v6.10.3

@marcelklehr
Copy link
Owner

marcelklehr commented Jun 3, 2017

Can you run node -e "console.log(require('os').networkInterfaces())" and post the results here? Alternatively, you could try to debug to determine what exactly gets passed to ip2long...

@sethleedy
Copy link
Author

sethleedy commented Jun 4, 2017

{ eth1:
   [ { address: '192.168.150.1',
       netmask: '255.255.255.0',
       family: 'IPv4',
       mac: '00:50:56:c0:00:01',
       internal: false },
     { address: 'fe80::28a7:7463:7034:bbea',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '00:50:56:c0:00:01',
       scopeid: 18,
       internal: false } ],
  eth2:
   [ { address: '192.168.124.1',
       netmask: '255.255.255.0',
       family: 'IPv4',
       mac: '00:50:56:c0:00:08',
       internal: false },
     { address: 'fe80::915:fea3:9c32:85dd',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '00:50:56:c0:00:08',
       scopeid: 2,
       internal: false } ],
  eth3:
   [ { address: '192.168.1.67',
       netmask: '255.255.254.0',
       family: 'IPv4',
       mac: 'ca:cf:3f:4b:76:ab',
       internal: false },
     { address: '2607:fcc8:6640:c100:5ab0:d59a:8f56:aa8a',
       netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
       family: 'IPv6',
       mac: 'ca:cf:3f:4b:76:ab',
       scopeid: 0,
       internal: false },
     { address: 'fe80::b4e7:e26:ca6b:899',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: 'ca:cf:3f:4b:76:ab',
       scopeid: 5,
       internal: false } ],
  lo:
   [ { address: '127.0.0.1',
       netmask: '255.0.0.0',
       family: 'IPv4',
       mac: '00:00:00:00:00:00',
       internal: true },
     { address: '::1',
       netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
       family: 'IPv6',
       mac: '00:00:00:00:00:00',
       scopeid: 0,
       internal: true } ],
  wifi0:
   [ { address: '192.168.0.231',
       netmask: '255.255.255.0',
       family: 'IPv4',
       mac: '34:23:87:f2:86:dd',
       internal: false },
     { address: '2607:fcc8:6640:c100:5451:7671:1478:8619',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '34:23:87:f2:86:dd',
       scopeid: 0,
       internal: false },
     { address: '2607:fcc8:6640:c100:fce3:a9c5:b071:3a6c',
       netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
       family: 'IPv6',
       mac: '34:23:87:f2:86:dd',
       scopeid: 0,
       internal: false },
     { address: 'fe80::5451:7671:1478:8619',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '34:23:87:f2:86:dd',
       scopeid: 3,
       internal: false } ],
  eth4:
   [ { address: '2001:0:9d38:953c:2000:baf8:b446:6560',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '00:00:00:00:00:00',
       scopeid: 0,
       internal: false },
     { address: 'fe80::2000:baf8:b446:6560',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '00:00:00:00:00:00',
       scopeid: 20,
       internal: false } ] }

@marcelklehr
Copy link
Owner

Looks fine to me, you'll probably need to debug after all...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants