Eugene Kim
610c02803d
Tag libp2p packages with libp2p_ prefix
...
This is because we are introducing more and more parallel P2P concepts
(libp2p peer versus our own peer, for example). Explicit tagging makes
it easier for untrained eyes to understand which side the code refers
to: If it's prefixed with libp2p_, it's libp2p; if not, it's our p2p.
While we are at this, apply the std → 3rd-party → local import grouping,
and also rename multiaddr to ma (the upstream canonical name of
go-multiaddr) in the affected files.
6 years ago
Eugene Kim
913cb45115
Move go:generate to the source side
6 years ago
Eugene Kim
f05eca3f8a
Unexport internally used interfaces
6 years ago
Eugene Kim
a62b65ece9
pubsub → libp2p_pubsub
...
This is in preparation of PubSub → pubsub rename.
6 years ago
Eugene Kim
f24509594e
Remove libp2p config option passthrough
...
No code uses this libp2p-specific hardwiring provision.
6 years ago
Leo Chen
7b0769c651
gossip all consensus messages
...
clean up some debug logs
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
a55b4514dd
use gossip for all consensus messages
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
b7838579de
use mutex to simplify the locking
...
fix travis test error by adding functions in mockhost
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
98596f4f21
add connecthostpeer function
...
pubsub requires pre-exist connection among peers before the message can
be sent via pubsub
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
8820c257a6
add list of incoming/outgoing peers
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
ec5102708e
[libp2p] init integration of group message by pubsub
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
993ec605c9
nit: add peer info when logging write errors
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
65d3e56e67
add error variables for p2p/host
...
no retry on newstream error
reduce number of retry
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Eugene Kim
bc3fb1e4a2
Regenerate host mock
6 years ago
Eugene Kim
7f0e170f7a
Rename GroupReceiver → GroupReceiverImpl in hostv2
...
Suggested-by: Minh Doan <minh@harmony.one>
6 years ago
Eugene Kim
857d24ced8
Add tests
...
Suggested-by: Leo Chen <leo@harmony.one>
6 years ago
Eugene Kim
52f6600b39
Add pubsub-based multicast, first pass
...
Should be good enough for interface and strawman implementation review.
6 years ago
Eugene Kim
15d3693b49
Byebye hostv1
6 years ago
Leo Chen
47545789c2
fix protocol not supported issue
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Minh Doan
7a37836b35
replace log by singleton logging
6 years ago
Leo Chen
984bd15fa4
add GetHost API in p2p/host package
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
5c129411b1
add options support in hostv2.New
...
so we can add additional options to p2pimpl.NewHost function call
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Eugene Kim
cd44397168
Remove deprecated Ready field
6 years ago
Eugene Kim
24fd9d67b8
More goimports
...
Apparently goimports does not handle anything after the first
third-party import group (whose name starts with a URL such as
github.com).
6 years ago
Minh Doan
d634d43148
fix import order
6 years ago
Eugene Kim
cf0486dbd3
More goimports
...
Recent version of goimports committed a few days ago now adds an
explicit package name tag for imports whose last path component differ
from the package name (see golang/go#28428 and
https://go-review.googlesource.com/c/tools/+/152000 ).
6 years ago
Rongjian Lan
39b941d904
Migrate to BLS
6 years ago
Leo Chen
2984fb90ba
fix go test errors in travis_checker.sh
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
c112ffb414
generate private key outside of host creation
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Eugene Kim
1e39837f5a
gometalinter p2p/...
...
Mostly fixes error handling, but there are a few functional changes:
* ReadMessageContent() returns an error upon SetReadDeadline() failures.
* hostv2 SendMessage() returns an error upon write failures.
6 years ago
Leo Chen
8edebd2250
fix some send message failure
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Eugene Kim
4a2e1e2110
Move Host interface into the top-level p2p package
...
This is a move-only refactor, intended to bubble the Host interface
(which is the main p2p interface) to the top. It also has the effect of
reducing name stutter (host.Host → p2p.Host).
6 years ago
Leo Chen
49a48958d9
address all review comments
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
550da64144
fix all the go test errors after p2p changes
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
fcbf5c255a
add addPeer function support in p2p
...
This is mainly for hostv2 libp2p support.
addPeer will add new peer into the peerstore.
NewHost function add Identity support for libp2p after generating
keypair. The PeerID is generated from the public key, will be used to
find the right PeerInfo for libp2p communication.
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
f189ba0183
simplify SendMessage
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Eugene Kim
5ad4d5a8f0
Adjust import paths and also goimports
6 years ago
Leo Chen
c511c4d4e0
catch errors in SendMessage
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
cc322ce3ff
re-enable libp2p by default
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Minh Doan
2245b37851
fix the break at master
6 years ago
Leo Chen
c378482e23
enable libp2p by default
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
chaosma
6476146a81
add p2p unit tests
...
* add p2p unit tests; util_test.go NOT always pass
* remove addrToPrivKey
* minor refine
6 years ago
Richard Liu
79d7ac30c3
remove dup bufio.NewWriter ( #223 )
6 years ago
chaosma
da32d1c0bb
simplify read message content code ( #216 )
6 years ago
Richard Liu
7538f64d7e
fix p2p v2 on aws and for surviving from node killing. ( #204 )
...
* fix p2p v2 on aws and for surviving from node killing.
* update addrs
* fix typo
6 years ago
Rongjian Lan
fdcce8e4de
Add tests for node_handler.go; move stream interface to its own file;create mock for stream.go
6 years ago
Rongjian Lan
f26d62984c
Add tests for consensus leader code
6 years ago
Leo Chen
3356c61332
use in-repo log module for p2p
...
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
18a52968b3
fix can't bind address issue on AWS
...
on AWS EC2 instances, we can't bind the IP address, has to use no IP to
join host.
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago
Leo Chen
53a5c3c856
HAR-65: support node removal after node is offline
...
In p2p library, I added a channel notification mechansim when it failed
to send messages after retries. The failed p2p.Peer will be notified to
caller via the channel. Then the leader knows which peer is offline and
adds to an offline list.
Before another consensus is started, the ledaer will check the offline
list and remove the node from the validator list. Leader will have to
broadcast the Pong message to all validators to sync the public key
list.
Signed-off-by: Leo Chen <leo@harmony.one>
6 years ago