truedat101 / jumbosocket

A simple little server for creating big ideas with Node.js + Socket.io. Serve static || dynamic + Socket.io apps.
https://github.com/truedat101/jumbosocket
4 stars 1 forks source link

On ipv6 hosts, devs need an option to serve data in ipv6 compatible mode, or just ipv4 (default) #4

Open truedat101 opened 10 years ago

truedat101 commented 10 years ago

For now, I just need ipv4 working. We should have a config flag which activates, deactivates.

truedat101 commented 10 years ago

Our current getNetworkIP routine matches something like this on a linux system with ipv6 functional:

Matches: inet 10.0.0.16 netmask 255.255.255.0 broadcast 10.0.0.255 inet6 fe80::f2ad:4eff:fe02:6db7,inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 ips[0] = :f2ad:4eff:fe02:6db7 Started server on IP address: :f2ad:4eff:fe02:6db7

truedat101 commented 10 years ago

I'll implement a partial fix, just for making sure the ipv4 still works for the downstream project.

truedat101 commented 10 years ago

Here's what I found on one system,

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0.0.112 netmask 255.255.255.0 broadcast 10.0.0.255 inet6 fe80::f2ad:4eff:fe02:6db6 prefixlen 64 scopeid 0x20 ether f0:ad:4e:02:6d:b6 txqueuelen 532 (Ethernet) RX packets 1269 bytes 968930 (946.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 561 bytes 63517 (62.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 23 and on the other: eth0 Link encap:Ethernet HWaddr 20:cf:30:57:31:ae
inet addr:10.0.0.10 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::22cf:30ff:fe57:31ae/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3980392 errors:0 dropped:0 overruns:0 frame:0 TX packets:3087466 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4434469781 (4.4 GB) TX bytes:975721340 (975.7 MB) Interrupt:19 Base address:0xec0

truedat101 commented 10 years ago

The difference is very subtle. One has inet addr and the other just has inet

. Wonderful. They are both linux. Great.

truedat101 commented 10 years ago

In issue #5 we have switched to a new approach for getting this data directly from Node.js, not from exec'ing a command line utility.

We should deal with IPv6 going forward. I think this will be a user setting to enable IPv6 via the config object.