diff --git a/examples/multipro/AUTHORS b/examples/multipro/AUTHORS new file mode 100644 index 000000000..4e649b717 --- /dev/null +++ b/examples/multipro/AUTHORS @@ -0,0 +1,3 @@ +# This is the official list of authors for copyright purposes. + +Aviv Eyal \ No newline at end of file diff --git a/examples/multipro/node.go b/examples/multipro/node.go index 2b7718a23..1d712c095 100644 --- a/examples/multipro/node.go +++ b/examples/multipro/node.go @@ -10,6 +10,9 @@ import ( "time" ) +// node client version +const clientVersion = "go-p2p-node/0.0.1" + // Node type - a p2p host implementing one or more p2p protocols type Node struct { host.Host // lib-p2p host @@ -93,7 +96,7 @@ func (n *Node) verifyData(data []byte, signature []byte, peerId peer.ID, pubKeyD return false } - // verify that message author node id matches the provided public key + // verify that message author node id matches the provided node public key if idFromKey != peerId { log.Println(err, "Node id and provided public key mismatch") return false diff --git a/examples/multipro/pb/p2p.proto b/examples/multipro/pb/p2p.proto index 365b86a41..0c71ebbc5 100644 --- a/examples/multipro/pb/p2p.proto +++ b/examples/multipro/pb/p2p.proto @@ -10,8 +10,8 @@ message MessageData { string id = 3; // allows requesters to use request data when processing a response bool gossip = 4; // true to have receiver peer gossip the message to neighbors string nodeId = 5; // id of node that created the message (not the peer that may have sent it). =base58(mh(sha256(nodePubKey))) - bytes nodePubKey = 6; // Authoring node Secp256k1 public key (32bytes) - string sign = 7; // signature of message data + method specific data by message authoring node + bytes nodePubKey = 6; // Authoring node Secp256k1 public key (32bytes) - protobufs serielized + string sign = 7; // signature of message data + method specific data by message authoring node. format: string([]bytes) } //// ping protocol diff --git a/examples/multipro/protocol.go b/examples/multipro/protocol.go index a8e7e070f..2fc0527e2 100644 --- a/examples/multipro/protocol.go +++ b/examples/multipro/protocol.go @@ -8,12 +8,9 @@ import ( "log" ) -// node version -const clientVersion = "go-p2p-node/0.0.1" - // helper method - writes a protobuf go data object to a network stream -// data - reference of protobuf go data object to send (not the object itself) -// s - network stream to write the data to +// data: reference of protobuf go data object to send (not the object itself) +// s: network stream to write the data to func sendProtoMessage(data proto.Message, s inet.Stream) bool { writer := bufio.NewWriter(s) enc := protobufCodec.Multicodec(nil).Encoder(writer)