libp2p / libp2p/go-libp2p

System-wide configuration tree

Open
#526 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
6.9k
Forks
1.3k
Avg merge
13d 21h
Merged PRs (30d)
1

Description

Different aspects like dialer limits (#525), timeouts, wait periods, frequencies of periodic GC processes, etc. should be configurable. Possible directions:

  1. Have the constructors for each module (e.g. NewSwarm()) accept specific configuration structs (e.g. SwarmConfig). This doesn't play well with profile/default configurations (e.g. BasicHost, libp2p.New), as the user does not interact with those constructors.
  2. Continue using the current functional-like Options flag model. Does not scale well, is leaky, and relies on accessors being available along the chain.
    • Currently we're using this for two things: (a) dependency injection and (b) configuration.
    • Hopefully (a) will be superseded by the host/service abstraction, and (b) by what we decide herein.
  3. The host/service abstraction injects a ConfigurationContext in all modules, that models configuration keys like a tree, like the IPFS configuration. Modules can interrogate the context to find configuration values for themselves. The API can be type-safe, or just a map.
    • Every large project needs to deal with injecting configuration at one point or another; there are a lot of examples in the Go sphere we can draw inspiration from (including IPFS), and also to explore tradeoffs.
    • Things to think about: default values, types, serialisation (reading/writing configuration to/from JSON/YAML), hierarchy, key naming, etc.

In general I like the way IPFS does this, but it should only be one input in our discussion. In fact, we should speak to the IPFS community to explore any shortcomings they have experienced with their choice.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the issue's three configuration approaches and inspecting the mentioned entry points, including NewSwarm(), BasicHost, and libp2p.New, along with the current Options flow. Compare the IPFS configuration model linked in the issue and document decisions for defaults, types, serialization, hierarchy, and key naming. Done means a maintainer-approved system-wide configuration design, not a localized code edit.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.