-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: streamline discovery and node info types #3175
base: main
Are you sure you want to change the base?
Conversation
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3175/docs/iroh/ Last updated: 2025-02-13T23:21:37Z |
Okay, my previous comment about the I very much agree with your goal of structuring this in a way where we can make future changes without breaking the 1.0 API. What are your thoughts on how the current code in this PR is going to affect
So what if instead:
I guess another option would be:
The reason I prefer the first option is we have one less public struct to maintain, though we would need to add documentation to the I appreciate the push to make the initial RFC more robust! Thoughts? |
Thanks for the review! I agree that I'm less sure about |
I pushed a commit that implements the following:
Also see generated docs: I'm quite happy with this, and it made #3176 even simpler. Let me know what you think |
I pushed another commit that adapts the |
761ffe7
to
181a4be
Compare
Description
Adds a
NodeData
struct that contains the information about a node that can be published in discovery services. This struct is both used iniroh_relay::dns::NodeInfo
and iniroh::discovery::Discovery
. Previously, we had this information in two different structs, which means they had to be kept in sync manually.This PR also serves these prupsoes:
Discovery::publish
; with this PR instead we can just add it as an optional field toNodeData
.NodeData
are private, so we can add fields, and setter/getter methods, without this being a semver-breaking change.Breaking Changes
iroh::discovery::Discovery::publish
now takesdata: &NodeData
as its single argument.iroh::discovery::NodeData
is a re-export ofiroh_relay::dns::node_info::NodeData
, and contains relay URL and direct addresses. See docs forNodeData
for details.iroh::discovery::DiscoveryItem
no longer has any public fields. There are now getters for the contained data.iroh_relay::dns::node_info::NodeInfo
is changed.NodeInfo::new
now has a singleNodeId
argument. UseNodeInfo::with_direct_addresses
andNodeInfo::with_relay_url
to set addresses and relay URL. Alternatively, useNodeInfo::from_parts
and pass aNodeData
struct.NodeInfo
now has two public fieldsnode_id: NodeId
anddata: NodeData
, and setter and getter methods for the relay URL and direct addresses.iroh::discovery::pkarr::PkarrPublisher::update_addr_info
now takes aNodeData
argumentNotes & open questions
Change checklist