Working on writing a tutorial to get people jump-started on js-ipfs, however I’ve hit a snag … I have a few questions:
- What are the pros/cons of webrtc-star and circuit-relay?
- Can they be used in conjunction?
- How do I achieve connectivity given my scenarios below? (What am I doing wrong?)
Setup:
- Browser A: Home connection
- Browser B: VPN connection
- Star: star.thedisco.zone
- RelayNode: ipfs.thedisco.zone
Testing here: http://portal.thedisco.zone/testing/chat.html
The script used to load IPFS was retrieved from here.
Scenario 1:
Browser config:
await Ipfs.create({
repo: 'ok' + Math.random(),
config: {
Addresses: {
Swarm: [ '/dns4/star.thedisco.zone/tcp/9090/wss/p2p-webrtc-star', '/dns6/star.thedisco.zone/tcp/9090/wss/p2p-webrtc-star', "/ip4/0.0.0.0/tcp/4002", "/ip4/127.0.0.1/tcp/4003/ws" ]
}
}});
Result:
If multiple browser sessions are launched on home connection nodes discover eachother fine over star however remote peers are not discovered (Browser A cannot discover or connect to Browser B).
Additionally, Browser B and Browser A are 100% connected to the star node. The nodes however will not connect to eachother.
Scenario 2:
Browser config:
await Ipfs.create({
repo: 'ok' + Math.random(),
relay: {
enabled: true,
hop: {
enabled: true
}
},
config: {
Bootstrap: [ '/dns6/ipfs.thedisco.zone/tcp/4430/wss/p2p/12D3KooWChhhfGdB9GJy1GbhghAAKCUR99oCymMEVS4eUcEy67nt', '/dns4/ipfs.thedisco.zone/tcp/4430/wss/p2p/12D3KooWChhhfGdB9GJy1GbhghAAKCUR99oCymMEVS4eUcEy67nt' ]
}});
go-ipfs config: { "API": { "HTTPHeaders": {} }, "Addresses": { "API": "/ip4/1 - Pastebin.com
Result:
Multiple home connection nodes fail to discover eachother, likewise Browser A never connects to Browser B, connection is not relayed.
The RelayNode shows up in the swarm list, but that’s about it. There are no addresses listed on Browser A or Browser B under ipfs.id()
.
Additionally when trying to connect between nodes (via await ipfs.swarm.connect("/ipfs/12D3KooWChhhfGdB9GJy1GbhghAAKCUR99oCymMEVS4eUcEy67nt/p2p-circuit/ipfs/<DEST PEERID>");
, there is no error, or any output at all for that matter (not even “undefined”). They don’t show up in the ipfs.swarm.peers();
list.
Edit:
When trying to connect using the relay I get Uncaught Error: no protocol with name: "'p2p'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".
.
If I try await ipfs.swarm.connect("/dns6/ipfs.thedisco.zone/tcp/4430/wss/p2p/12D3KooWChhhfGdB9GJy1GbhghAAKCUR99oCymMEVS4eUcEy67nt/p2p-circuit/dns6/<PEERID>");
instead, it doesn’t return an error, but it also doesn’t add to the peer list.