-
Notifications
You must be signed in to change notification settings - Fork 137
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
feat: get NodeInfo
s from the MagicEndpoint
#1375
Conversation
c812812
to
7ade508
Compare
MagicSock
PeerInfo
s from the MagicEndpoint
We've been shifting away from |
a7210f5
to
0e36af4
Compare
PeerInfo
s from the MagicEndpoint
NodeInfo
s from the MagicEndpoint
2d4450d
to
9218bed
Compare
/// Includes the node's [`PublicKey`], potential DERP region, it's addresses with any known | ||
/// latency, and its [`crate::magicsock::ConnectionType`], which let's us know if we are currently communicating | ||
/// with that node over a `Direct` (UDP) or `Relay` (DERP) connection. | ||
pub async fn node_infos(&self) -> anyhow::Result<Vec<NodeInfo>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe active_connections
or so? node_infos
to me sounds a bit more static than what this method does. but also not sure myself, it's fine to leave it as is.
edit: I'm just now realizing that I don't actually know - Entries are added whenever you connect to a new node. But when are entries dropped from the magicsocket's state? Never? After a timeout? Let's maybe mention this in the docs if you know the answer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some reading. We do delete endpoints, but it is currently only triggered by user action. Any time we set_network_map
, we remove any connections that were made to us "in the wild".
But the only method that calls set_network_map
is add_known_addrs
. Which... is an interesting side effect that we haven't really surfaced. I'm not sure that we intended to have every time we add a new address to the netmap, that it should clear all connections made by other nodes to us.
However, since this happens only on user action, we are likely carrying around a bunch of "inactive" connections, so until / unless we change this, I don't think active_connections
is the best name.
@b5 I think ConnectionInfo
might be the right name for the EndpointInfo
outside of the MagicSock
.
which would make this connection_infos
& I will add the above context into the function docs for both connection_infos
and add_known_addrs
.
|
Fully support this change. |
Out of band discussion, we settled on |
closing this PR in favor of #1435 |
Description
Call
MagicEndpoint::node_infos()
to get aVec<NodeInfo>
, or list connection information on all nodes we know about.NodeInfo
is aliased fromsuper::magicsock::EndpointInfo
.Notes & open questions
Please let me know if the above
EndpointInfo
+ConnectionType
is enough for our UI and sync purposes!Change checklist