Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: allow passing options to memoryAddrBook #3062

Merged
merged 4 commits into from
Nov 25, 2024
Merged

Conversation

2color
Copy link
Contributor

@2color 2color commented Nov 25, 2024

Background

I'm adding an instance of the MemoryAddrBook to someguy to manage peer record caching/ttls locally in a similar fashion to libp2p/go-libp2p-pubsub#555.

That requires passing passing options and using it without a PeerStore. For that being able to pass options is handy.

This PR also fixes the defaults in the factory.

@2color 2color requested a review from sukunrt November 25, 2024 10:44
@2color 2color changed the title chore: make MemoryAddrBook public feat: allow passing options to memoryAddrBook public Nov 25, 2024
@2color 2color changed the title feat: allow passing options to memoryAddrBook public feat: allow passing options to memoryAddrBook Nov 25, 2024
@sukunrt
Copy link
Member

sukunrt commented Nov 25, 2024

Can't you just use it like libp2p/go-libp2p-pubsub#555 does? By assuming the return value is an AddrBook. Otherwise, I'd rather change everything here to use the AddrBook interface and not export MemoryAddrBook.

@2color
Copy link
Contributor Author

2color commented Nov 25, 2024

Can't you just use it like libp2p/go-libp2p-pubsub#555 does? By assuming the return value is an AddrBook. Otherwise, I'd rather change everything here to use the AddrBook interface and not export MemoryAddrBook.

I did. If you look at the latest version of this PR, it solely adds the ability pass in options without using the PeerBook.

@2color 2color merged commit 666d1ed into master Nov 25, 2024
11 checks passed
@2color 2color deleted the addr-book-public branch November 25, 2024 16:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants