-
Notifications
You must be signed in to change notification settings - Fork 9
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: adds /peers endpoint #626
Conversation
With this change a new API endpoint is added for accessing connected peers. The API is similar to the /api/v0/swarm/peers endpoint however it allows for multiple addresses and does not have to remain Kubo RPC compatible. The endpoint allows posting an address and therefore connecting to a new peer. Fixes: #608
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.
Looks good, one question about what happens with a weird/bad request with multiple peer IDs
.collect() | ||
} | ||
async fn peer_connect(&self, addrs: &[ceramic_api::Multiaddr]) -> Result<()> { | ||
// Find peer id in one of the addresses |
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.
is it possible to make a weird request were you specify addresses with multiple peer IDs? it seems like we'd end up replacing the ID in following addresses or am I misunderstanding?
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.
hmm good point, we should check all peers ids are the same. As written it would likely just result in that address failing to connect but better to catch the error sooner.
Accidentally merged this into #618 I'll back it out. |
New PR here #628 |
With this change a new API endpoint is added for accessing connected peers. The API is similar to the /api/v0/swarm/peers endpoint however it allows for multiple addresses and does not have to remain Kubo RPC compatible.
The endpoint allows posting an address and therefore connecting to a new peer.
Fixes: #608