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

feat: small bundle + enable webrtc-star in no-failure mode #121

Merged
merged 4 commits into from
Feb 25, 2021

Conversation

lidel
Copy link
Member

@lidel lidel commented Feb 11, 2021

This PR:

TODO

  • faultTolerance: FaultTolerance.NO_FATAL settings does not seem to be applied by libp2p, so when no webrtc-star is available, js-ipfs fails to start

This does not work as expected yet, we don't want to fail if all signaling
servers are down because one can still leverage preloads.

While at it, switched from ipfs to ipfs-core and that decreased the
size of ./build/ from 34M to 22M (!)
src/bundles/ipfs-provider.js Outdated Show resolved Hide resolved
Still unable to get FaultTolerance.NO_FATAL to work, but may be easier
to debug.
Comment on lines 13 to 40
return new Libp2p({
peerId,
addresses: {
listen: [
/*
'/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
'/dns4/wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
'/dns4/wrtc-star.discovery.libp2p.io/tcp/443/wss/p2p-webrtc-star',
*/
'/dns4/invalid-wrtc-star.discovery.libp2p.io/tcp/443/wss/p2p-webrtc-star'
]
},
dialer: {
maxParallelDials: 150, // 150 total parallel multiaddr dials
maxDialsPerPeer: 4, // Allow 4 multiaddrs to be dialed per peer in parallel
dialTimeout: 10e3 // 10 second dial timeout per peer dial
},
modules: {
transport: [WS, WebRTCStar],
streamMuxer: [MPLEX],
connEncryption: [NOISE],
peerDiscovery: [Bootstrap],
pubsub: GossipSub
},
transportManager: {
// https://github.com/libp2p/js-libp2p/blob/0a6bc0d1013dfd80ab600e8f74c1544b433ece29/doc/CONFIGURATION.md#configuring-transport-manager
// We don't want js-ipfs boot to fail when all webrtc signaling servers are down
faultTolerance: FaultTolerance.NO_FATAL
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vasco-santos @achingbrain I've refactored things so a custom libp2p bundle is used, and I am still unable to get FaultTolerance.NO_FATAL to work when no webrtc server is available.

Mind eyeballing if I missed something obvious?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug, just created a PR. Thanks @lidel

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested libp2p/js-libp2p#893 and works as expected.

Were there any breaking changes since last release?
Do we need to wait for this to bubble up to js-ipfs, or can we bump js-libp2p as an explicit dependency here (when fix is released)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just released it as a patch in libp2p. You should just need to reinstall the dependencies

This switches to latest js-libp2p with a fix for FaultTolerance.NO_FATAL
@lidel lidel marked this pull request as ready for review February 25, 2021 17:17
@lidel
Copy link
Member Author

lidel commented Feb 25, 2021

Confirmed FaultTolerance.NO_FATAL works as expected, switched to valid star servers. Merging.

@lidel lidel merged commit d25a3d2 into main Feb 25, 2021
@lidel lidel deleted the feat/best-effort-webrtc-star branch February 25, 2021 17:49
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

Successfully merging this pull request may close these issues.

Experiment with enabling WebRTC in js-ipfs fallback
2 participants