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

Provide a default libp2p instance #121

Closed
Tracked by #4336
BigLep opened this issue May 16, 2023 · 7 comments · Fixed by #127
Closed
Tracked by #4336

Provide a default libp2p instance #121

BigLep opened this issue May 16, 2023 · 7 comments · Fixed by #127
Labels

Comments

@BigLep
Copy link
Contributor

BigLep commented May 16, 2023

Done Criteria

Helia can be constructed without a libp2p instance. In this case, a "good default" libp2p instance is provided.

Why Important

libp2p exposes a lot of knobs. Knowing the right one sets for a good connectivity story is not cear to new users. This reduces the barrier to entry and also serves as a base set to potentially tweak.

Notes

This default libp2p instance should be well commented so that interested users can learn from it to determining how they might follow suit or tweak.

@SgtPooki
Copy link
Member

Should this be something that js-libp2p provides?

I imagine a set of default libp2p configs for different usecases would be really valuable for users:

  • DHT libp2p config
  • IPNI libp2p config
  • browser node libp2p config
  • server node libp2p config

@SgtPooki
Copy link
Member

SgtPooki commented May 17, 2023

@BigLep
Copy link
Contributor Author

BigLep commented May 17, 2023

Should this be something that js-libp2p provides?

I'll let @achingbrain comment.

I imagine a set of default libp2p configs for different usecases would be really valuable for users

I think you bring up a good point. It may be useful to expose a libp2p "instance factory". Then a user can be selective of what variant they want. At the minimum having a "browser" and a "server" config.

@achingbrain
Copy link
Member

I think applications like Helia are a better place to make choices about what a default libp2p config looks like rather than libp2p itself since you're closer to the user's needs at that point.

At the minimum having a "browser" and a "server" config.

We solved this problem in go/js-ipfs by having 'profiles' that a user could enable/disable - test, server, low-power, etc. These tweaked configuration options like connection limits and turned on/off different modules.

@SgtPooki
Copy link
Member

I like the idea of profiles, but, if we can, it would be nice to allow composable functionality via features instead of profiles with everything hardcoded. i.e. similar to tsconfig lib (but we would need to handle merging and whatnot):

  1. browser features (enables webtransport and websockets, because a "server" may or may not want "browser" functionality in different circumstances)
  2. DHT features (enables default bootstrapping nodes, which are overridable. possible for both server + browser to want this or not)
  3. default features (noise+yamux required for basically everything right now right? i'm not sure how these could be broken apart based on other features here)

achingbrain added a commit that referenced this issue May 19, 2023
The original intention was to allow users to configure a libp2p node to their requirements but it's a non-trivial undertaking unless the user is deeply familiar with the libp2p stack.

Instead, let's provide node and browser libp2p instances with sensible defaults that give the user the best chance of success on first try.

Fixes #121
@github-project-automation github-project-automation bot moved this from 🥞 Todo to 🎉 Done in Helia Working Group (inactive) May 19, 2023
github-actions bot pushed a commit that referenced this issue May 19, 2023
## [@helia/interface-v1.1.0](https://github.com/ipfs/helia/compare/@helia/interface-v1.0.0...@helia/interface-v1.1.0) (2023-05-19)

### Features

* provide default libp2p instance ([#127](#127)) ([45c9d89](45c9d89)), closes [#121](#121)

### Trivial Changes

* bump aegir from 38.1.8 to 39.0.4 ([#111](#111)) ([2156568](2156568))
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version @helia/interface-v1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this issue May 19, 2023
## [helia-v1.1.0](helia-v1.0.4...helia-v1.1.0) (2023-05-19)

### Features

* provide default libp2p instance ([#127](#127)) ([45c9d89](45c9d89)), closes [#121](#121)
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version helia-v1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

This was referenced Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
3 participants