Skip to content

Reflect go-libp2p's modularity in dependency tree/ Reduce binary size #3251

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

Open
Wondertan opened this issue Mar 24, 2025 · 0 comments
Open
Assignees
Labels
P1 High: Likely tackled by core team if no one steps up

Comments

@Wondertan
Copy link
Contributor

Wondertan commented Mar 24, 2025

Problem

Let's say I configure libp2p to use TCP + yamux + TLS. This is doable and libp2p allows me to construct such a node. However, the go-libp2p is still gonna make me import pion/quic/wt/noise/etc and put them in binary.

The core issue here is how libp2p Host gets constructed. Even though go-libp2p has all the lower-level pkgs cleanly separated from one-another, the config pkg pulls it all in a single place.

Solution

Golang since quite sometime introduced graph pruning and lazy loading. By leveraging this feature, go-libp2p could provide a way to construct your Host in a way that picks only carefully selected pkgs, pruning those that are simply not used by the application.

The best part here is that go-libp2p did everything right bottom-up to achieve this. All the components are ready to be used in such a way and its only a matter of providing right recipe for library users on how to compose their host of whats absolutely necessary for their usecase.

@sukunrt sukunrt added the P1 High: Likely tackled by core team if no one steps up label Apr 7, 2025
@sukunrt sukunrt self-assigned this Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High: Likely tackled by core team if no one steps up
Projects
None yet
Development

No branches or pull requests

2 participants