Skip to content

Conversation

lidel
Copy link
Member

@lidel lidel commented Aug 8, 2025

Feed all connected swarm peers to AutoRelay as potential relay candidates. This allows peers from HTTP routing and manual connections to serve as relays, not just DHT-discovered peers.

Fixes #10899

@sukunrt any concern about always feeding connected peers to libp2p.EnableAutoRelayWithPeerSource? My understanding is that AutoRelay in go-libp2p already handles filtering, deduplication, and rate limiting internally, making it safe to feed all connected peers.

@lidel lidel requested a review from sukunrt August 8, 2025 01:13
@lidel lidel requested a review from a team as a code owner August 8, 2025 01:13
@lidel lidel added the skip/changelog This change does NOT require a changelog entry label Aug 8, 2025
lidel added 2 commits August 8, 2025 03:19
Feed all connected swarm peers to AutoRelay as potential relay
candidates. This allows peers from HTTP routing and manual connections
to serve as relays, not just DHT-discovered peers.

Fixes #10899
@lidel lidel force-pushed the fix-autorelay-discovery-without-dht branch from d6cacce to f13972a Compare August 8, 2025 01:20
Copy link
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to worry about adding the same peer twice because it was discovered by DHT and is a swarm peer?

If no, then LGTM.

@lidel
Copy link
Member Author

lidel commented Aug 11, 2025

I think its ok to merge: go-libp2p's autoRelay has a per-peer backoff mechanism which will act as deduplication mechanism:

Implementations should send new peers, but may send peers they sent before. AutoRelay implements a per-peer backoff (see WithBackoff).
https://github.com/libp2p/go-libp2p/blob/8e10f8496193d7be3e4002ef8c8d2dd75141d7d9/p2p/host/autorelay/options.go#L16-L17

@lidel lidel merged commit c513e1a into master Aug 11, 2025
16 checks passed
@lidel lidel deleted the fix-autorelay-discovery-without-dht branch August 11, 2025 21:59
@lidel lidel mentioned this pull request Aug 12, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip/changelog This change does NOT require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only peers discovered from DHT can be used as relays
2 participants