-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
src/core/components/libp2p.js
Outdated
webRTCStar: get(config, 'Discovery.webRTCStar.Enabled'), | ||
bootstrap: get(config, 'Bootstrap') | ||
}, | ||
EXPERIMENTAL: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- EXPERIMENTAL should be part of the config (easier to config).
libp2p 0.21.0 has been released. This PR can be updated. (I'll possibly be able to do this tomorrow) |
I'll take a look |
098adac
to
bdbe7ed
Compare
@diasdavid can you take a look at what I've done here - tests are all passing |
}, | ||
EXPERIMENTAL: { | ||
dht: get(self._options, 'EXPERIMENTAL.dht', false), | ||
pubsub: get(self._options, 'EXPERIMENTAL.pubsub', false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! For the next turn, we should optimize js-ipfs options just like js-libp2p so that when we do new IPFS(options)
, it is clear that:
const options = {
... // any specifics on spawning the daemon this way on the first level
config: {
// everything else comes from the config
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @alanshaw thank you!
Now it just needs to have the examples and README checked for these breaking changes.
src/core/components/libp2p.js
Outdated
active: get(self._options, 'EXPERIMENTAL.relay.hop.active', | ||
get(config, 'EXPERIMENTAL.relay.hop.active', false)) | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diasdavid do you want to move relay
out from behind EXPERIMENTAL
in js-ipfs
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense :)
@diasdavid in 71883e3 I've documented the change to the config new IPFS({
libp2p: {
modules: {
peerDiscovery: [MyDiscovery]
},
config: {
peerDiscovery: {
[MyDiscovery.tag]: {
enabled: true,
myCustomConfig: 'property'
}
}
}
}
}) So actually the whole of the I couldn't find any examples where the The only breaking change I can see here is the change to the config |
@alanshaw just a heads up, in libp2p we ended up switching over to When arrays are combined, like module.transports, the defaults will stomp on the original based on array index. Options like: modules: {
transport: [ TCP, WS ]
} and defaults: modules: {
transport: [ wrtc ]
} would end up being: modules: {
transport: [ wrtc, WS ]
} libp2p/js-libp2p#206. It leverages lodash merge under the hood with some custom merge configuration. |
@jacobheun I've made that switch. It means that if you pass discovery or transport modules in the config to your IPFS constructor then the default transports and discoveries will be replaced. I don't think that's what we want - I think we do want to add to the list (and the user can now disable any they want to in the config - hooray!). @diasdavid do you agree? |
There's a trade off to be made either way, but I think having to be explicit when you are specifying arrays is the better option. Here's the two approaches I am thinking of:
We could also potentially expose the defaults, to give users more flexibility there if they wanted to customize operations. This has a nice middle ground of being explicit, but allowing for easier customization. |
Right now, the only way to disable some of the options (transports, muxers, encryption) is to explicitly overload the default array for them. We will need something such as libp2p/js-libp2p#201 to be able to disable them through an option. |
Good to merge @diasdavid? Only CI failure is commit lint... |
With the bump to Aegir 14 it looks like the package version of Other than that, this LGTM! |
@diasdavid @jacobheun I could use some help with that failing test... |
@alanshaw I can take a look at this today. This test looks flaky, I'll see if I can figure out what's causing that flakiness and get it fixed to prevent future failures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
73f25ae
to
3b0ac0e
Compare
License: MIT Signed-off-by: David Dias <mail@daviddias.me> License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
3b0ac0e
to
5caaef5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I'll look at the flaky tests referenced in #1401 (comment) and add a separate PR for any issues with that.
Preparing js-ipfs for js-ipfs libp2p/js-libp2p#166 and at the same time testing the decisions made.