decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
733 stars 289 forks source link

addrmgr: Allow filtering by type, and remove DNS. #3409

Closed matthawkins90 closed 1 month ago

matthawkins90 commented 1 month ago

Similar to #3406, this work heavily references the work started in #2627, with the ultimate goal of adding support for TorV3 and other network address types.

The first commit fixes a minor bug where, if a node is asked to share addresses, but it only knows a very tiny number of addresses (less than five), it wouldn't share any. This isn't considered good behavior. I found this bug while trying to write tests for the second commit, where I added the ability to ask for addresses that match a certain filter. The bugfix is to always share at least one address (of the specified type) if any are known.

The second commit adds the ability to filter net addresses by specific address types. Eventually, this can be changed based on wire protocol versions which support different address types.

The third commit removes DNS from the address manager. With this proposed plan, the address manager will only be responsible for storing and managing addresses, encoded so that they're serialized compactly. The responsibility of dialing DNS has been moved to server.go.