Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
2dbb78f8
Commit
2dbb78f8
authored
7 years ago
by
Aviv Eyal
Committed by
Steven Allen
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Added authors
parent
9f756444
master
2018-Q4-OKR
feat/protobuf
fix/473
fix/no-custom-field
fix/reset-ping-stream
fix/revert-correct-external-addr
gx/update-nza0mn
jenkinsfile
multistream-ping
punching
v6.0.23
v6.0.22
v6.0.21
v6.0.20
v6.0.19
v6.0.18
v6.0.17
v6.0.16
v6.0.15
v6.0.14
v6.0.13
v6.0.12
v6.0.11
v6.0.10
v6.0.9
v6.0.8
v6.0.7
v6.0.6
v6.0.5
v6.0.4
v6.0.3
v6.0.2
v6.0.1
v6.0.0
v5.0.21
v5.0.20
v5.0.19
v5.0.18
v5.0.17
v5.0.16
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
examples/multipro/AUTHORS
+3
-0
examples/multipro/AUTHORS
examples/multipro/node.go
+4
-1
examples/multipro/node.go
examples/multipro/pb/p2p.proto
+2
-2
examples/multipro/pb/p2p.proto
examples/multipro/protocol.go
+2
-5
examples/multipro/protocol.go
with
11 additions
and
8 deletions
+11
-8
examples/multipro/AUTHORS
0 → 100644
View file @
2dbb78f8
# This is the official list of authors for copyright purposes.
Aviv Eyal <aviveyal07@gmail.com>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
examples/multipro/node.go
View file @
2dbb78f8
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
examples/multipro/pb/p2p.proto
View file @
2dbb78f8
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
examples/multipro/protocol.go
View file @
2dbb78f8
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help