-
Notifications
You must be signed in to change notification settings - Fork 115
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
go/worker/common/p2p: Add support for persistent and blocked peers #4713
Conversation
31c6a67
to
ca9a83f
Compare
Codecov Report
@@ Coverage Diff @@
## master #4713 +/- ##
==========================================
- Coverage 66.77% 66.71% -0.06%
==========================================
Files 441 441
Lines 49348 49407 +59
==========================================
+ Hits 32952 32963 +11
- Misses 12317 12375 +58
+ Partials 4079 4069 -10
Continue to review full report at Codecov.
|
8715c86
to
51dadc3
Compare
51dadc3
to
e8a00b6
Compare
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.
You could probably use pubsub.WithDirectPeers
to make the pubsub router maintain those connections. That option also supports specifying IP addresses, see here for how this is implemented.
a0524ad
to
db8fd41
Compare
go/worker/common/p2p/p2p.go
Outdated
return nil, fmt.Errorf("worker/common/p2p: invalid persistent peer public key (%s): %w", pubkey, grr) | ||
} | ||
|
||
ipport := strings.Split(addr, ":") |
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.
Should probably use net.SplitHostPort
.
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.
Nice, thanks!
db8fd41
to
9df6aa8
Compare
This PR adds support for blocking p2p peers and for keeping persistent connections to peers.
The persistent peer functionality currently doesn't automatically connect to the given peers on startup, but will only keep the connection once it's already established.