Skip to content

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

Open
@Wondertan

Description

@Wondertan

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.

Metadata

Metadata

Assignees

Labels

P1High: Likely tackled by core team if no one steps up

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions