Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Throws when IPv6 literals are used as signaling server (possibly due to nodejs/wrtc) #139

Open
isaackwan opened this issue Apr 8, 2018 · 1 comment
Labels
status/ready Ready to be worked

Comments

@isaackwan
Copy link

Test file

const IPFS = require('ipfs')
const wrtc = require('wrtc');
const WStar = require('libp2p-webrtc-star');
const wstar = new WStar({ wrtc: wrtc });
const IPFSRepo = require('ipfs-repo')

const ipfs = new IPFS({
	EXPERIMENTAL: {
		pubsub: true,
	},
	repo: new IPFSRepo("./storage/ipfs-repo-ipv6"),
	config: {
		Addresses: {
			Swarm: [
				"/ip6/2a03:b0c0:2:d0::10ca:6001/tcp/443/wss/p2p-webrtc-star",
			],					  
		}
	},
	libp2p: {
		modules: {
			transport: [wstar],
			discovery: [wstar.discovery]
		}
	},

});
ipfs.on("ready", function() {
	console.log("ready now");
});
ipfs.on("error", function(e) {
	console.error(e);
});

Console output

$ node test/ipv6.test.js
{ Error: websocket error
    at WS.Transport.onError (/home/isaac/Development/csci4140/js/node_modules/engine.io-client/lib/transport.js:64:13)
    at WebSocket.ws.onerror (/home/isaac/Development/csci4140/js/node_modules/engine.io-client/lib/transports/websocket.js:150:10)
    at WebSocket.onError (/home/isaac/Development/csci4140/js/node_modules/ws/lib/EventTarget.js:109:16)
    at WebSocket.emit (events.js:180:13)
    at WebSocket.finalize (/home/isaac/Development/csci4140/js/node_modules/ws/lib/WebSocket.js:182:41)
    at ClientRequest._req.on (/home/isaac/Development/csci4140/js/node_modules/ws/lib/WebSocket.js:647:10)
    at ClientRequest.emit (events.js:180:13)
    at Socket.socketErrorListener (_http_client.js:394:9)
    at Socket.emit (events.js:180:13)
    at emitErrorNT (internal/streams/destroy.js:64:8)
  type: 'TransportError',
  description:
   { Error: connect EHOSTUNREACH 2a03:b0c0:2:d0::10ca:6001:443:80
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1173:14)
     errno: 'EHOSTUNREACH',
     code: 'EHOSTUNREACH',
     syscall: 'connect',
     address: '2a03:b0c0:2:d0::10ca:6001:443',
     port: 80,
     type: 'error',
     target:
      WebSocket {
        _events: [Object],
        _eventsCount: 4,
        _maxListeners: undefined,
        readyState: 2,
        bytesReceived: 0,
        extensions: {},
        protocol: '',
        _binaryType: 'arraybuffer',
        _finalize: [Function: bound finalize],
        _closeFrameReceived: false,
        _closeFrameSent: false,
        _closeMessage: '',
        _closeTimer: null,
        _finalized: true,
        _closeCode: 1006,
        _receiver: null,
        _sender: null,
        _socket: null,
        _ultron: null,
        protocolVersion: 13,
        _isServer: false,
        url: 'ws://[2a03:b0c0:2:d0::10ca:6001:443]/socket.io/?EIO=3&transport=websocket',
        _req: null } } }
{ Error: websocket error
    at WS.Transport.onError (/home/isaac/Development/csci4140/js/node_modules/engine.io-client/lib/transport.js:64:13)
    at WebSocket.ws.onerror (/home/isaac/Development/csci4140/js/node_modules/engine.io-client/lib/transports/websocket.js:150:10)
    at WebSocket.onError (/home/isaac/Development/csci4140/js/node_modules/ws/lib/EventTarget.js:109:16)
    at WebSocket.emit (events.js:180:13)
    at WebSocket.finalize (/home/isaac/Development/csci4140/js/node_modules/ws/lib/WebSocket.js:182:41)
    at ClientRequest._req.on (/home/isaac/Development/csci4140/js/node_modules/ws/lib/WebSocket.js:647:10)
    at ClientRequest.emit (events.js:180:13)
    at Socket.socketErrorListener (_http_client.js:394:9)
    at Socket.emit (events.js:180:13)
    at emitErrorNT (internal/streams/destroy.js:64:8)
  type: 'TransportError',
  description:
   { Error: connect EHOSTUNREACH 2a03:b0c0:2:d0::10ca:6001:443:80
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1173:14)
     errno: 'EHOSTUNREACH',
     code: 'EHOSTUNREACH',
     syscall: 'connect',
     address: '2a03:b0c0:2:d0::10ca:6001:443',
     port: 80,
     type: 'error',
     target:
      WebSocket {
        _events: {},
        _eventsCount: 0,
        _maxListeners: undefined,
        readyState: 3,
        bytesReceived: 0,
        extensions: null,
        protocol: '',
        _binaryType: 'arraybuffer',
        _finalize: [Function: bound finalize],
        _closeFrameReceived: false,
        _closeFrameSent: false,
        _closeMessage: '',
        _closeTimer: null,
        _finalized: true,
        _closeCode: 1006,
        _receiver: null,
        _sender: null,
        _socket: null,
        _ultron: null,
        protocolVersion: 13,
        _isServer: false,
        url: 'ws://[2a03:b0c0:2:d0::10ca:6001:443]/socket.io/?EIO=3&transport=websocket',
        _req: null } } }

package.json

  "dependencies": {
    "ipfs": "^0.28.2",
    "ipfs-repo": "^0.18.7",
    "orbit-db": "^0.19.7",
    "re-emitter": "^1.1.3",
    "uuid": "^3.2.1",
    "wrtc": "^0.1.1"
  }

/ip6/2a03:b0c0:2:d0::10ca:6001/tcp/443/wss/p2p-webrtc-star throws but /ip6/2a03:b0c0:2:d0::10ca:6001/wss/p2p-webrtc-star works.

@isaackwan isaackwan changed the title Throws when IPv6 literals are used as signaling server (possibly by nodejs/wrtc) Throws when IPv6 literals are used as signaling server (possibly due to nodejs/wrtc) Apr 8, 2018
@isaackwan
Copy link
Author

FWIW - the "correct" way to format the address is wss://[2a03:b0c0:2:d0::10ca:6001]:443/socket.io/?EIO=3&transport=websocket with the brackets indicating the colons belong to the IPv6 address itself, not to indicate the port

@daviddias daviddias added the status/ready Ready to be worked label Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

2 participants