-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
setup.go
Outdated
ps := peering.NewPeeringService(h) | ||
if err := ps.Start(); err != nil { | ||
return nil, err | ||
} | ||
for _, a := range cfg.Peering { | ||
ps.AddPeer(a) | ||
} |
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.
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.
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.
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
3117017
to
1a64cb9
Compare
@aschmahmann Is there a way to list the current peers that |
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). |
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