Commit 2dbb78f8 authored by Aviv Eyal's avatar Aviv Eyal Committed by Steven Allen
Browse files

Added authors

parent 9f756444
# This is the official list of authors for copyright purposes.
Aviv Eyal <aviveyal07@gmail.com>
\ No newline at end of file
...@@ -10,6 +10,9 @@ import ( ...@@ -10,6 +10,9 @@ import (
"time" "time"
) )
// node client version
const clientVersion = "go-p2p-node/0.0.1"
// Node type - a p2p host implementing one or more p2p protocols // Node type - a p2p host implementing one or more p2p protocols
type Node struct { type Node struct {
host.Host // lib-p2p host host.Host // lib-p2p host
...@@ -93,7 +96,7 @@ func (n *Node) verifyData(data []byte, signature []byte, peerId peer.ID, pubKeyD ...@@ -93,7 +96,7 @@ func (n *Node) verifyData(data []byte, signature []byte, peerId peer.ID, pubKeyD
return false 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 { if idFromKey != peerId {
log.Println(err, "Node id and provided public key mismatch") log.Println(err, "Node id and provided public key mismatch")
return false return false
......
...@@ -10,8 +10,8 @@ message MessageData { ...@@ -10,8 +10,8 @@ message MessageData {
string id = 3; // allows requesters to use request data when processing a response 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 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))) 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) 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 string sign = 7; // signature of message data + method specific data by message authoring node. format: string([]bytes)
} }
//// ping protocol //// ping protocol
......
...@@ -8,12 +8,9 @@ import ( ...@@ -8,12 +8,9 @@ import (
"log" "log"
) )
// node version
const clientVersion = "go-p2p-node/0.0.1"
// helper method - writes a protobuf go data object to a network stream // 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) // data: reference of protobuf go data object to send (not the object itself)
// s - network stream to write the data to // s: network stream to write the data to
func sendProtoMessage(data proto.Message, s inet.Stream) bool { func sendProtoMessage(data proto.Message, s inet.Stream) bool {
writer := bufio.NewWriter(s) writer := bufio.NewWriter(s)
enc := protobufCodec.Multicodec(nil).Encoder(writer) enc := protobufCodec.Multicodec(nil).Encoder(writer)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment