Skip to content
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

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

nathanielc
Copy link
Collaborator

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

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
@nathanielc nathanielc requested review from stbrody, a team and dav1do as code owners December 6, 2024 16:14
@nathanielc nathanielc requested review from sam701 and removed request for a team December 6, 2024 16:14
Copy link
Contributor

@dav1do dav1do left a 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

api/src/server.rs Show resolved Hide resolved
api/ceramic.yaml Show resolved Hide resolved
.collect()
}
async fn peer_connect(&self, addrs: &[ceramic_api::Multiaddr]) -> Result<()> {
// Find peer id in one of the addresses
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@nathanielc nathanielc merged commit 817ebc7 into feat/pairwise-peer-sync Dec 6, 2024
4 checks passed
@nathanielc nathanielc deleted the feat/peer-api-endpoint branch December 6, 2024 16:51
@nathanielc
Copy link
Collaborator Author

Accidentally merged this into #618 I'll back it out.

@nathanielc nathanielc restored the feat/peer-api-endpoint branch December 6, 2024 16:53
@nathanielc
Copy link
Collaborator Author

New PR here #628

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