Bootstrapping doesn't work with ip6 link-local address
Closed this issue · 3 comments
Hello,
I'm using the following code on 2 laptops that are connected by LAN.
ip4
works just find but ip6
doesn't :/.
/* eslint-disable no-console */
"use strict";
const Libp2p = require("libp2p");
const TCP = require("libp2p-tcp");
const Mplex = require("libp2p-mplex");
const SECIO = require("libp2p-secio");
const Bootstrap = require("libp2p-bootstrap");
const bootstrapers = [
"/ip6/fe80::xxxxxxxxx%eth0/tcp/5001/p2p/<id>"
];
(async () => {
const node = await Libp2p.create({
addresses: {
listen: ["/ip4/0.0.0.0/tcp/0", "/ip6/::/tcp/5001"]
},
modules: {
transport: [TCP],
streamMuxer: [Mplex],
connEncryption: [SECIO],
peerDiscovery: [Bootstrap]
},
config: {
peerDiscovery: {
bootstrap: {
interval: 60e3,
enabled: true,
list: bootstrapers
}
}
}
});
node.connectionManager.on("peer:connect", connection => {
console.log(
"Connection established to:",
connection.remotePeer.toB58String()
);
});
node.on("peer:discovery", peerId => {
console.log("Discovered:", peerId.toB58String());
});
await node.start();
})();
Versions:
"libp2p": "^0.28.5",
"libp2p-bootstrap": "^0.10.4",
"libp2p-mplex": "^0.9.5",
"libp2p-secio": "^0.12.6",
"libp2p-tcp": "^0.14.5",
Thanks for reporting this @R9295
Can you run the code using debug and provide me the logs? It would be quite useful:
It should be something as DEBUG=* node index.js
. If possible, the logs working with ip4, and not working with ip6
Hey @vasco-santos , thanks for the quick response. I fixed the issue. libp2p-tcp was not including interface name in the ip6 local address while attempting to connect.
eg
/ip6/fe80::ba27:ebff:fecd:680b%wlp2s0/tcp/5001/p2p/QmVCTgLguTMHTAHKfxQSmML4nUgm33tMrWYKMGxyXeHsVn
wlp2s0
wasn't a part of the host
in the multiaddr object which was used to connect.
I will submit a PR to js-multiaddr
; super excited to commit to Libp2p!
Edit: PR to js-multiaddr
isntead of js-libp2p
Closing this as we already have it in js-multiaddr