libp2p / libp2p/go-libp2p

peerstore: add a `PeersSupporting(proto string, seenWithin time.Duration) <-chan peer.ID` capability

Open
#1,700 0 comments 2 reactions 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

The peerstore doesn't support obtaining an enumeration of peers known to support a given protocol. Service like AutoNAT thus [keep peers relevant in memory throughout the lifetime of the process](https://github.com/libp2p/go-libp2p-autonat/blob/master/autonat.go#L55), which in the long run leaks memory.

Adding a capability like this with our current KV model is not trivial. We might need to migrate to SQLite, or another DB richer than simple KV stores.

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 peerstore implementation and its current key-value storage model, then inspect the linked AutoNAT usage to understand the memory-retention problem. Determine whether the existing storage can support enumerating peers by protocol and recency, or whether the proposed SQLite or richer database migration is required. Done means exposing the requested capability without retaining all relevant peers for the process lifetime.

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.