Skip to content

feat: allow passing options to memoryAddrBook - #3062

Merged
2color merged 4 commits into
masterfrom
addr-book-public
Nov 25, 2024
Merged

2color merged 4 commits into
masterfrom
addr-book-public

Conversation

@2color

@2color 2color commented Nov 25, 2024 •

Copy link
Copy Markdown
Contributor

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

sukunrt commented Nov 25, 2024

Copy link
Copy Markdown
Member

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

2color commented Nov 25, 2024

Copy link
Copy Markdown
Contributor Author

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
@2color
2color deleted the addr-book-public branch November 25, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants