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

Add peering support #35

Merged
merged 2 commits into from
Nov 7, 2023
Merged

Add peering support #35

merged 2 commits into from
Nov 7, 2023

Conversation

aschmahmann
Copy link
Contributor

@aschmahmann aschmahmann commented Nov 7, 2023

While this shouldn't be strictly needed in production it's both available for us if we want it (e.g. for high value connections we explicitly want to protect) and it can be of use during testing (e.g. #34).

IIRC @hsanjuan also requested this

setup.go Outdated
Comment on lines 274 to 282
ps := peering.NewPeeringService(h)
if err := ps.Start(); err != nil {
return nil, err
}
for _, a := range cfg.Peering {
ps.AddPeer(a)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure, but wouldn't we only want to start/create it if len(cfg.Peering) > 0? If it doesn't do without any peers, seems fine to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does very little work without any peers, and I don't recall it ever being an issue in kubo (which runs it by default) even where there are no peering peers registered.

It's fine to fix though. I'll bump go-libp2p along with it https://github.com/libp2p/go-libp2p/releases/tag/v0.32.1

@aschmahmann aschmahmann merged commit 9894e81 into main Nov 7, 2023
9 checks passed
@aschmahmann aschmahmann deleted the feat/peering branch November 7, 2023 17:53
@acejam
Copy link
Contributor

acejam commented Dec 25, 2023

@aschmahmann Is there a way to list the current peers that rainbow is connected to? I'm trying to verify that this feature works.

@aschmahmann
Copy link
Contributor Author

No, there isn't an RPC call that lists the peers the node is connected to. You may be able to detect the go-libp2p connect/disconnect events by looking through the logs though if you're just doing it for debugging. You could also check on the peer you're supposed to be connecting to if they're connected (peering should be symmetrical for stability purposes anyway).

Note: if you're running with two libp2p hosts logs will be from both hosts so might be confusing. If you want different Amino DHT + Bitswap hosts but not in the same binary you can choose to run the Amino DHT as a separate binary (e.g. a non-publicly exposed kubo node or https://github.com/ipfs-shipyard/someguy) and hook it up to rainbow via the routing-v1 API (supported in rainbow).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants