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

Gossip V3 #310

Merged
merged 24 commits into from Dec 11, 2018
Merged

Gossip V3 #310

merged 24 commits into from Dec 11, 2018

Conversation

@y0sher
Copy link
Contributor

@y0sher y0sher commented Dec 6, 2018

This PR handles comments from the first PR #211 about gossip.
Neighborhood which used to be the gossip protocol and in-charge of selecting the peers and connecting them has moved to swarm
gossip.Protocol is now just another protocol used to disseminate messages to peers selected by swarm
this also allowed changing the message structure.

@y0sher y0sher changed the title Gossip V3 [WIP] Gossip V3 Dec 8, 2018
@y0sher y0sher changed the title [WIP] Gossip V3 Gossip V3 Dec 10, 2018

data, err := message.PrepareMessage(session, msg)

func (prot *Protocol) validateMessage(msg *pb.ProtocolMessage, authPubKey crypto.PublicKey) error {

This comment has been minimized.

@y0sher

y0sher Dec 10, 2018
Author Contributor

use message.AuthAuthor

@zalmen
zalmen approved these changes Dec 10, 2018

res := d.InternalLookup(dhtid)

if res == nil {

This comment has been minimized.

@zalmen

zalmen Dec 10, 2018
Contributor

Print an error to the log that we lost the bootstrap nodes

p2p/swarm.go Outdated Show resolved Hide resolved
}

// AuthSender authorizes that a message is signed by its claimed sender
func AuthSender(pm *pb.ProtocolMessage, key crypto.PublicKey) error {

This comment has been minimized.

@zalmen

zalmen Dec 10, 2018
Contributor

You don't really need it, you can verify that the sender in the metadata is the same as the real sender and then use message.AuthAuthor

p2p/swarm.go Outdated Show resolved Hide resolved
p2p/swarm.go Outdated Show resolved Hide resolved
p2p/swarm.go Show resolved Hide resolved
p2p/swarm.go Outdated Show resolved Hide resolved
p2p/swarm.go Outdated Show resolved Hide resolved
p2p/swarm.go Outdated Show resolved Hide resolved
p2p/gossip/protocol.go Outdated Show resolved Hide resolved
p2p/gossip/protocol.go Outdated Show resolved Hide resolved
p2p/gossip/protocol.go Outdated Show resolved Hide resolved
p2p/gossip/protocol.go Outdated Show resolved Hide resolved
s.peersMutex.Lock()
s.peers[cne.n.PublicKey().String()] = p
s.peersMutex.Unlock()
err = prot.validateMessage(msg, authKey)

This comment has been minimized.

@y0sher

y0sher Dec 10, 2018
Author Contributor

use message.AuthAuthor instead

s.oldMessageMu.Lock()
s.oldMessageQ[checksum] = struct{}{}
s.oldMessageMu.Unlock()
sign, err2 := prot.signer.Sign(bin)

This comment has been minimized.

@y0sher

y0sher Dec 10, 2018
Author Contributor

also try using Sign from message

@y0sher y0sher merged commit 81f20a1 into develop Dec 11, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@y0sher y0sher deleted the p2p-gossip-swarm branch Dec 18, 2018
@y0sher y0sher restored the p2p-gossip-swarm branch May 29, 2019
@y0sher y0sher deleted the p2p-gossip-swarm branch May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants