libp2p / libp2p/go-libp2p

Host/Service interface design

Open
#467 33 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

It is becoming apparent that our `Host` interface needs to be extended with the concept of services and possibly an event bus.

For instance, the autorelay module in https://github.com/libp2p/go-libp2p/pull/454 needs access to the `Identify` service in `BasicHost` in order to push address updates. It also needs to be able to override the address factory, which necessitates the `AutoRelay` host wrapping a `BasicHost` directly.
On top of that, it embeds the ambient autonat service, which we would like to expose to other parts of the system.

Additional considerations include the ability to emit events about things like peer identification completing and other internal state changes that are now handled with delays.

This issue is here to discuss the evolution of our Host interface and drive future refactoring.

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 Host and BasicHost interfaces, the AutoRelay host wrapper, and the linked autorelay pull request. Map how Identify, ambient AutoNAT, address-factory overrides, and delayed state changes currently interact. Done means the project has an agreed Host evolution and a concrete refactoring plan, but this issue does not define that design.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems, networking
Issue type
Refactor
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.