diff options
author | Wei-Ning Huang <w@cobinhood.com> | 2018-09-26 10:48:31 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-19 18:55:22 +0800 |
commit | 9acf5fc03ad7dabcd88eb8972db032122ef5ebe1 (patch) | |
tree | e33db1d9846de04aa5d86d920a77d87064d531e5 /p2p | |
parent | f97b8033c8c79f133417805fdd84bc1c36a36089 (diff) | |
download | dexon-9acf5fc03ad7dabcd88eb8972db032122ef5ebe1.tar.gz dexon-9acf5fc03ad7dabcd88eb8972db032122ef5ebe1.tar.zst dexon-9acf5fc03ad7dabcd88eb8972db032122ef5ebe1.zip |
Change import go github.com/dexon-foundation/dexon
Diffstat (limited to 'p2p')
69 files changed, 419 insertions, 229 deletions
diff --git a/p2p/dial.go b/p2p/dial.go index 075a0f936..9b24ed96a 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -23,9 +23,9 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/netutil" ) const ( diff --git a/p2p/dial_test.go b/p2p/dial_test.go index f41ab7752..3805ff690 100644 --- a/p2p/dial_test.go +++ b/p2p/dial_test.go @@ -24,9 +24,9 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enr" + "github.com/dexon-foundation/dexon/p2p/netutil" ) func init() { diff --git a/p2p/discover/node.go b/p2p/discover/node.go index 7ddf04fe8..2111e3405 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -23,10 +23,10 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/secp256k1" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/dexon-foundation/dexon/common/math" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/crypto/secp256k1" + "github.com/dexon-foundation/dexon/p2p/enode" ) // node represents a host on the network. diff --git a/p2p/discover/ntp.go b/p2p/discover/ntp.go index 1bb52399f..be21a8e5e 100644 --- a/p2p/discover/ntp.go +++ b/p2p/discover/ntp.go @@ -25,7 +25,7 @@ import ( "sort" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/dexon-foundation/dexon/log" ) const ( diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 9f7f1d41b..9fb397d36 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -33,11 +33,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/netutil" ) const ( diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index 6b4cd2d18..50ee7816b 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -27,9 +27,9 @@ import ( "testing/quick" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enr" ) func TestTable_pingReplace(t *testing.T) { diff --git a/p2p/discover/table_util_test.go b/p2p/discover/table_util_test.go index d41519452..96cf7196a 100644 --- a/p2p/discover/table_util_test.go +++ b/p2p/discover/table_util_test.go @@ -24,8 +24,8 @@ import ( "net" "sync" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enr" ) var nullNode *enode.Node diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index 37a044902..0e44e5656 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -26,11 +26,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/netutil" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/netutil" + "github.com/dexon-foundation/dexon/rlp" ) // Errors diff --git a/p2p/discover/udp_test.go b/p2p/discover/udp_test.go index a4ddaf750..839a12253 100644 --- a/p2p/discover/udp_test.go +++ b/p2p/discover/udp_test.go @@ -34,10 +34,10 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/rlp" ) func init() { diff --git a/p2p/discv5/database.go b/p2p/discv5/database.go index 3c2d5744c..8c580dec1 100644 --- a/p2p/discv5/database.go +++ b/p2p/discv5/database.go @@ -28,9 +28,9 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/rlp" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/errors" "github.com/syndtr/goleveldb/leveldb/iterator" diff --git a/p2p/discv5/metrics.go b/p2p/discv5/metrics.go index cb11d7eac..741ce444c 100644 --- a/p2p/discv5/metrics.go +++ b/p2p/discv5/metrics.go @@ -1,6 +1,6 @@ package discv5 -import "github.com/ethereum/go-ethereum/metrics" +import "github.com/dexon-foundation/dexon/metrics" var ( ingressTrafficMeter = metrics.NewRegisteredMeter("discv5/InboundTraffic", nil) diff --git a/p2p/discv5/net.go b/p2p/discv5/net.go index cdeb28dd5..ec29a85b9 100644 --- a/p2p/discv5/net.go +++ b/p2p/discv5/net.go @@ -24,13 +24,13 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/netutil" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/common/mclock" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/crypto/sha3" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/netutil" + "github.com/dexon-foundation/dexon/rlp" ) var ( diff --git a/p2p/discv5/net_test.go b/p2p/discv5/net_test.go index 1a8137673..ffaed71c5 100644 --- a/p2p/discv5/net_test.go +++ b/p2p/discv5/net_test.go @@ -22,8 +22,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/crypto" ) func TestNetwork_Lookup(t *testing.T) { diff --git a/p2p/discv5/node.go b/p2p/discv5/node.go index 3d4748512..53d82caac 100644 --- a/p2p/discv5/node.go +++ b/p2p/discv5/node.go @@ -30,8 +30,8 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/crypto" ) // Node represents a host on the network. diff --git a/p2p/discv5/node_test.go b/p2p/discv5/node_test.go index ce4ad9e4d..192115406 100644 --- a/p2p/discv5/node_test.go +++ b/p2p/discv5/node_test.go @@ -27,8 +27,8 @@ import ( "testing/quick" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/crypto" ) func ExampleNewNode() { diff --git a/p2p/discv5/ntp.go b/p2p/discv5/ntp.go index 4fb5f657a..e8ffd81b4 100644 --- a/p2p/discv5/ntp.go +++ b/p2p/discv5/ntp.go @@ -26,7 +26,7 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/dexon-foundation/dexon/log" ) const ( diff --git a/p2p/discv5/sim_test.go b/p2p/discv5/sim_test.go index 543faecd4..53b94b247 100644 --- a/p2p/discv5/sim_test.go +++ b/p2p/discv5/sim_test.go @@ -28,7 +28,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" + "github.com/dexon-foundation/dexon/common" ) // In this test, nodes try to randomly resolve each other. diff --git a/p2p/discv5/table.go b/p2p/discv5/table.go index 4f4b2426f..4d1d4ea8b 100644 --- a/p2p/discv5/table.go +++ b/p2p/discv5/table.go @@ -29,7 +29,7 @@ import ( "net" "sort" - "github.com/ethereum/go-ethereum/common" + "github.com/dexon-foundation/dexon/common" ) const ( diff --git a/p2p/discv5/table_test.go b/p2p/discv5/table_test.go index a29943dab..b5442dfe1 100644 --- a/p2p/discv5/table_test.go +++ b/p2p/discv5/table_test.go @@ -27,8 +27,8 @@ import ( "testing/quick" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/crypto" ) type nullTransport struct{} diff --git a/p2p/discv5/ticket.go b/p2p/discv5/ticket.go index ae4b18e7c..3503d14ae 100644 --- a/p2p/discv5/ticket.go +++ b/p2p/discv5/ticket.go @@ -25,10 +25,10 @@ import ( "sort" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/common/mclock" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/log" ) const ( diff --git a/p2p/discv5/topic.go b/p2p/discv5/topic.go index 609a41297..9ab29a9ff 100644 --- a/p2p/discv5/topic.go +++ b/p2p/discv5/topic.go @@ -23,8 +23,8 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/log" + "github.com/dexon-foundation/dexon/common/mclock" + "github.com/dexon-foundation/dexon/log" ) const ( diff --git a/p2p/discv5/topic_test.go b/p2p/discv5/topic_test.go index ba79993f2..b34fa4eff 100644 --- a/p2p/discv5/topic_test.go +++ b/p2p/discv5/topic_test.go @@ -21,8 +21,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/common/mclock" ) func TestTopicRadius(t *testing.T) { diff --git a/p2p/discv5/udp.go b/p2p/discv5/udp.go index ff5ed983b..dfcbaf810 100644 --- a/p2p/discv5/udp.go +++ b/p2p/discv5/udp.go @@ -24,12 +24,12 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/p2p/netutil" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/nat" + "github.com/dexon-foundation/dexon/p2p/netutil" + "github.com/dexon-foundation/dexon/rlp" ) const Version = 4 diff --git a/p2p/discv5/udp_test.go b/p2p/discv5/udp_test.go index 62184aa9d..b3dbe4cab 100644 --- a/p2p/discv5/udp_test.go +++ b/p2p/discv5/udp_test.go @@ -26,9 +26,9 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/rlp" ) func init() { diff --git a/p2p/enode/idscheme.go b/p2p/enode/idscheme.go index 9b495fd4f..fa717bd5b 100644 --- a/p2p/enode/idscheme.go +++ b/p2p/enode/idscheme.go @@ -21,11 +21,11 @@ import ( "fmt" "io" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/common/math" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/crypto/sha3" + "github.com/dexon-foundation/dexon/p2p/enr" + "github.com/dexon-foundation/dexon/rlp" ) // List of known secure identity schemes. diff --git a/p2p/enode/idscheme_test.go b/p2p/enode/idscheme_test.go index 0910e6e83..c1144683e 100644 --- a/p2p/enode/idscheme_test.go +++ b/p2p/enode/idscheme_test.go @@ -23,9 +23,9 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/p2p/enr" + "github.com/dexon-foundation/dexon/rlp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/p2p/enode/localnode.go b/p2p/enode/localnode.go index 623f8eae1..9b1f6bef6 100644 --- a/p2p/enode/localnode.go +++ b/p2p/enode/localnode.go @@ -26,9 +26,9 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/netutil" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/enr" + "github.com/dexon-foundation/dexon/p2p/netutil" ) const ( diff --git a/p2p/enode/localnode_test.go b/p2p/enode/localnode_test.go index f5e3496d6..4b80776db 100644 --- a/p2p/enode/localnode_test.go +++ b/p2p/enode/localnode_test.go @@ -19,8 +19,8 @@ package enode import ( "testing" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/p2p/enr" ) func newLocalNodeForTesting() (*LocalNode, *DB) { diff --git a/p2p/enode/node.go b/p2p/enode/node.go index b454ab255..777299615 100644 --- a/p2p/enode/node.go +++ b/p2p/enode/node.go @@ -26,7 +26,7 @@ import ( "net" "strings" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/dexon-foundation/dexon/p2p/enr" ) // Node represents a host on the network. diff --git a/p2p/enode/node_test.go b/p2p/enode/node_test.go index 861a70bd6..0a80ca445 100644 --- a/p2p/enode/node_test.go +++ b/p2p/enode/node_test.go @@ -21,8 +21,8 @@ import ( "fmt" "testing" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/p2p/enr" + "github.com/dexon-foundation/dexon/rlp" "github.com/stretchr/testify/assert" ) diff --git a/p2p/enode/nodedb.go b/p2p/enode/nodedb.go index 7ee0c09a9..0b7eba1ea 100644 --- a/p2p/enode/nodedb.go +++ b/p2p/enode/nodedb.go @@ -25,8 +25,8 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/rlp" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/errors" "github.com/syndtr/goleveldb/leveldb/iterator" diff --git a/p2p/enode/urlv4.go b/p2p/enode/urlv4.go index 50e9485d0..2fa5a6464 100644 --- a/p2p/enode/urlv4.go +++ b/p2p/enode/urlv4.go @@ -26,9 +26,9 @@ import ( "regexp" "strconv" - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/dexon-foundation/dexon/common/math" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/p2p/enr" ) var incompleteNodeURL = regexp.MustCompile("(?i)^(?:enode://)?([0-9a-f]+)$") diff --git a/p2p/enr/enr.go b/p2p/enr/enr.go index 444820c15..62e351761 100644 --- a/p2p/enr/enr.go +++ b/p2p/enr/enr.go @@ -40,7 +40,7 @@ import ( "io" "sort" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/rlp" ) const SizeLimit = 300 // maximum encoded size of a node record in bytes diff --git a/p2p/enr/enr_test.go b/p2p/enr/enr_test.go index 449c898a8..72519b576 100644 --- a/p2p/enr/enr_test.go +++ b/p2p/enr/enr_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/rlp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/p2p/enr/entries.go b/p2p/enr/entries.go index 347990ab6..576349777 100644 --- a/p2p/enr/entries.go +++ b/p2p/enr/entries.go @@ -21,7 +21,7 @@ import ( "io" "net" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/rlp" ) // Entry is implemented by known node record entry types. diff --git a/p2p/message.go b/p2p/message.go index ac12666e4..727946abc 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -25,9 +25,9 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/event" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/rlp" ) // Msg defines the structure of a p2p message. diff --git a/p2p/metrics.go b/p2p/metrics.go index 8df82bb07..8bd902286 100644 --- a/p2p/metrics.go +++ b/p2p/metrics.go @@ -25,11 +25,11 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enode" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/dexon-foundation/dexon/event" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/metrics" ) const ( diff --git a/p2p/nat/nat.go b/p2p/nat/nat.go index 8fad921c4..27cb82ad4 100644 --- a/p2p/nat/nat.go +++ b/p2p/nat/nat.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/dexon-foundation/dexon/log" "github.com/jackpal/go-nat-pmp" ) diff --git a/p2p/netutil/iptrack.go b/p2p/netutil/iptrack.go index b9cbd5e1c..f9c97608f 100644 --- a/p2p/netutil/iptrack.go +++ b/p2p/netutil/iptrack.go @@ -19,7 +19,7 @@ package netutil import ( "time" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/dexon-foundation/dexon/common/mclock" ) // IPTracker predicts the external endpoint, i.e. IP address and port, of the local host diff --git a/p2p/netutil/iptrack_test.go b/p2p/netutil/iptrack_test.go index a9a2998a6..04b3b0961 100644 --- a/p2p/netutil/iptrack_test.go +++ b/p2p/netutil/iptrack_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common/mclock" + "github.com/dexon-foundation/dexon/common/mclock" ) const ( diff --git a/p2p/peer.go b/p2p/peer.go index 4828d3234..3c75d7dd5 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -25,12 +25,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/common/mclock" + "github.com/dexon-foundation/dexon/event" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enr" + "github.com/dexon-foundation/dexon/rlp" ) var ( diff --git a/p2p/protocol.go b/p2p/protocol.go index 9438ab8e4..245361fc1 100644 --- a/p2p/protocol.go +++ b/p2p/protocol.go @@ -19,8 +19,8 @@ package p2p import ( "fmt" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enr" ) // Protocol represents a P2P subprotocol implementation. diff --git a/p2p/protocols/accounting.go b/p2p/protocols/accounting.go index 770406a27..abbb8ce08 100644 --- a/p2p/protocols/accounting.go +++ b/p2p/protocols/accounting.go @@ -19,7 +19,7 @@ package protocols import ( "time" - "github.com/ethereum/go-ethereum/metrics" + "github.com/dexon-foundation/dexon/metrics" ) //define some metrics diff --git a/p2p/protocols/accounting_simulation_test.go b/p2p/protocols/accounting_simulation_test.go index e90a1d81d..f79daedf2 100644 --- a/p2p/protocols/accounting_simulation_test.go +++ b/p2p/protocols/accounting_simulation_test.go @@ -31,14 +31,14 @@ import ( "github.com/mattn/go-colorable" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" - - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/rpc" + + "github.com/dexon-foundation/dexon/node" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" ) const ( diff --git a/p2p/protocols/accounting_test.go b/p2p/protocols/accounting_test.go index 3810ae2c9..64839a720 100644 --- a/p2p/protocols/accounting_test.go +++ b/p2p/protocols/accounting_test.go @@ -19,9 +19,9 @@ package protocols import ( "testing" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/rlp" ) //dummy Balance implementation diff --git a/p2p/protocols/protocol.go b/p2p/protocols/protocol.go index b16720dd3..c5424c011 100644 --- a/p2p/protocols/protocol.go +++ b/p2p/protocols/protocol.go @@ -38,12 +38,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/swarm/spancontext" - "github.com/ethereum/go-ethereum/swarm/tracing" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/metrics" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/rlp" + "github.com/dexon-foundation/dexon/swarm/spancontext" + "github.com/dexon-foundation/dexon/swarm/tracing" opentracing "github.com/opentracing/opentracing-go" ) diff --git a/p2p/protocols/protocol_test.go b/p2p/protocols/protocol_test.go index a26222cd8..fdeb37ff2 100644 --- a/p2p/protocols/protocol_test.go +++ b/p2p/protocols/protocol_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/rlp" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - p2ptest "github.com/ethereum/go-ethereum/p2p/testing" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" + p2ptest "github.com/dexon-foundation/dexon/p2p/testing" ) // handshake message type diff --git a/p2p/protocols/reporter.go b/p2p/protocols/reporter.go index 215d4fe31..8c9f30c25 100644 --- a/p2p/protocols/reporter.go +++ b/p2p/protocols/reporter.go @@ -20,8 +20,8 @@ import ( "encoding/binary" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/metrics" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/metrics" "github.com/syndtr/goleveldb/leveldb" ) diff --git a/p2p/protocols/reporter_test.go b/p2p/protocols/reporter_test.go index b9f06e674..253fc85ce 100644 --- a/p2p/protocols/reporter_test.go +++ b/p2p/protocols/reporter_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/log" + "github.com/dexon-foundation/dexon/log" ) //TestReporter tests that the metrics being collected for p2p accounting diff --git a/p2p/rlpx.go b/p2p/rlpx.go index 22a27dd96..8e42333c4 100644 --- a/p2p/rlpx.go +++ b/p2p/rlpx.go @@ -35,12 +35,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common/bitutil" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/crypto/secp256k1" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/common/bitutil" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/crypto/ecies" + "github.com/dexon-foundation/dexon/crypto/secp256k1" + "github.com/dexon-foundation/dexon/crypto/sha3" + "github.com/dexon-foundation/dexon/rlp" "github.com/golang/snappy" ) diff --git a/p2p/rlpx_test.go b/p2p/rlpx_test.go index 64172217b..42714d50d 100644 --- a/p2p/rlpx_test.go +++ b/p2p/rlpx_test.go @@ -32,11 +32,11 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/p2p/simulations/pipes" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/crypto/ecies" + "github.com/dexon-foundation/dexon/crypto/sha3" + "github.com/dexon-foundation/dexon/p2p/simulations/pipes" + "github.com/dexon-foundation/dexon/rlp" ) func TestSharedSecret(t *testing.T) { diff --git a/p2p/server.go b/p2p/server.go index 15f6ad167..c3b3a00d4 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -28,18 +28,18 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/mclock" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/p2p/discv5" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/p2p/netutil" - "github.com/ethereum/go-ethereum/rlp" + "github.com/dexon-foundation/dexon/common" + "github.com/dexon-foundation/dexon/common/mclock" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/event" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/discover" + "github.com/dexon-foundation/dexon/p2p/discv5" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enr" + "github.com/dexon-foundation/dexon/p2p/nat" + "github.com/dexon-foundation/dexon/p2p/netutil" + "github.com/dexon-foundation/dexon/rlp" ) const ( diff --git a/p2p/server_test.go b/p2p/server_test.go index 44d43d63d..58bb75bc6 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -25,12 +25,12 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/crypto/sha3" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/discover" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enr" ) // func init() { diff --git a/p2p/simulations/adapters/docker.go b/p2p/simulations/adapters/docker.go new file mode 100644 index 000000000..fc6a8c7c3 --- /dev/null +++ b/p2p/simulations/adapters/docker.go @@ -0,0 +1,190 @@ +// Copyright 2017 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. + +package adapters + +import ( + "errors" + "fmt" + "io" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + + "github.com/dexon-foundation/dexon/node" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/docker/docker/pkg/reexec" +) + +var ( + ErrLinuxOnly = errors.New("DockerAdapter can only be used on Linux as it uses the current binary (which must be a Linux binary)") +) + +// DockerAdapter is a NodeAdapter which runs simulation nodes inside Docker +// containers. +// +// A Docker image is built which contains the current binary at /bin/p2p-node +// which when executed runs the underlying service (see the description +// of the execP2PNode function for more details) +type DockerAdapter struct { + ExecAdapter +} + +// NewDockerAdapter builds the p2p-node Docker image containing the current +// binary and returns a DockerAdapter +func NewDockerAdapter() (*DockerAdapter, error) { + // Since Docker containers run on Linux and this adapter runs the + // current binary in the container, it must be compiled for Linux. + // + // It is reasonable to require this because the caller can just + // compile the current binary in a Docker container. + if runtime.GOOS != "linux" { + return nil, ErrLinuxOnly + } + + if err := buildDockerImage(); err != nil { + return nil, err + } + + return &DockerAdapter{ + ExecAdapter{ + nodes: make(map[enode.ID]*ExecNode), + }, + }, nil +} + +// Name returns the name of the adapter for logging purposes +func (d *DockerAdapter) Name() string { + return "docker-adapter" +} + +// NewNode returns a new DockerNode using the given config +func (d *DockerAdapter) NewNode(config *NodeConfig) (Node, error) { + if len(config.Services) == 0 { + return nil, errors.New("node must have at least one service") + } + for _, service := range config.Services { + if _, exists := serviceFuncs[service]; !exists { + return nil, fmt.Errorf("unknown node service %q", service) + } + } + + // generate the config + conf := &execNodeConfig{ + Stack: node.DefaultConfig, + Node: config, + } + conf.Stack.DataDir = "/data" + conf.Stack.WSHost = "0.0.0.0" + conf.Stack.WSOrigins = []string{"*"} + conf.Stack.WSExposeAll = true + conf.Stack.P2P.EnableMsgEvents = false + conf.Stack.P2P.NoDiscovery = true + conf.Stack.P2P.NAT = nil + conf.Stack.NoUSB = true + + // listen on all interfaces on a given port, which we set when we + // initialise NodeConfig (usually a random port) + conf.Stack.P2P.ListenAddr = fmt.Sprintf(":%d", config.Port) + + node := &DockerNode{ + ExecNode: ExecNode{ + ID: config.ID, + Config: conf, + adapter: &d.ExecAdapter, + }, + } + node.newCmd = node.dockerCommand + d.ExecAdapter.nodes[node.ID] = &node.ExecNode + return node, nil +} + +// DockerNode wraps an ExecNode but exec's the current binary in a docker +// container rather than locally +type DockerNode struct { + ExecNode +} + +// dockerCommand returns a command which exec's the binary in a Docker +// container. +// +// It uses a shell so that we can pass the _P2P_NODE_CONFIG environment +// variable to the container using the --env flag. +func (n *DockerNode) dockerCommand() *exec.Cmd { + return exec.Command( + "sh", "-c", + fmt.Sprintf( + `exec docker run --interactive --env _P2P_NODE_CONFIG="${_P2P_NODE_CONFIG}" %s p2p-node %s %s`, + dockerImage, strings.Join(n.Config.Node.Services, ","), n.ID.String(), + ), + ) +} + +// dockerImage is the name of the Docker image which gets built to run the +// simulation node +const dockerImage = "p2p-node" + +// buildDockerImage builds the Docker image which is used to run the simulation +// node in a Docker container. +// +// It adds the current binary as "p2p-node" so that it runs execP2PNode +// when executed. +func buildDockerImage() error { + // create a directory to use as the build context + dir, err := ioutil.TempDir("", "p2p-docker") + if err != nil { + return err + } + defer os.RemoveAll(dir) + + // copy the current binary into the build context + bin, err := os.Open(reexec.Self()) + if err != nil { + return err + } + defer bin.Close() + dst, err := os.OpenFile(filepath.Join(dir, "self.bin"), os.O_WRONLY|os.O_CREATE, 0755) + if err != nil { + return err + } + defer dst.Close() + if _, err := io.Copy(dst, bin); err != nil { + return err + } + + // create the Dockerfile + dockerfile := []byte(` +FROM ubuntu:16.04 +RUN mkdir /data +ADD self.bin /bin/p2p-node + `) + if err := ioutil.WriteFile(filepath.Join(dir, "Dockerfile"), dockerfile, 0644); err != nil { + return err + } + + // run 'docker build' + cmd := exec.Command("docker", "build", "-t", dockerImage, dir) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + return fmt.Errorf("error building docker image: %s", err) + } + + return nil +} diff --git a/p2p/simulations/adapters/exec.go b/p2p/simulations/adapters/exec.go index abb196717..4f7f9eed8 100644 --- a/p2p/simulations/adapters/exec.go +++ b/p2p/simulations/adapters/exec.go @@ -35,12 +35,12 @@ import ( "syscall" "time" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/node" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/rpc" "github.com/docker/docker/pkg/reexec" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rpc" "golang.org/x/net/websocket" ) diff --git a/p2p/simulations/adapters/inproc.go b/p2p/simulations/adapters/inproc.go index 52a662be6..7929509fe 100644 --- a/p2p/simulations/adapters/inproc.go +++ b/p2p/simulations/adapters/inproc.go @@ -23,13 +23,13 @@ import ( "net" "sync" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/pipes" - "github.com/ethereum/go-ethereum/rpc" + "github.com/dexon-foundation/dexon/event" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/node" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations/pipes" + "github.com/dexon-foundation/dexon/rpc" ) // SimAdapter is a NodeAdapter which creates in-memory simulation nodes and diff --git a/p2p/simulations/adapters/inproc_test.go b/p2p/simulations/adapters/inproc_test.go index e1e092f6e..6ce4c216a 100644 --- a/p2p/simulations/adapters/inproc_test.go +++ b/p2p/simulations/adapters/inproc_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/p2p/simulations/pipes" + "github.com/dexon-foundation/dexon/p2p/simulations/pipes" ) func TestTCPPipe(t *testing.T) { diff --git a/p2p/simulations/adapters/types.go b/p2p/simulations/adapters/types.go index 6681726e4..d7a5149a8 100644 --- a/p2p/simulations/adapters/types.go +++ b/p2p/simulations/adapters/types.go @@ -25,12 +25,12 @@ import ( "os" "strconv" + "github.com/dexon-foundation/dexon/crypto" + "github.com/dexon-foundation/dexon/node" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/rpc" "github.com/docker/docker/pkg/reexec" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/rpc" ) // Node represents a node in a simulation network which is created by a diff --git a/p2p/simulations/examples/ping-pong.go b/p2p/simulations/examples/ping-pong.go index cde2f3a67..9e87df664 100644 --- a/p2p/simulations/examples/ping-pong.go +++ b/p2p/simulations/examples/ping-pong.go @@ -25,13 +25,13 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rpc" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/node" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/rpc" ) var adapterType = flag.String("adapter", "sim", `node adapter to use (one of "sim", "exec" or "docker")`) diff --git a/p2p/simulations/http.go b/p2p/simulations/http.go index 1f44cc667..d846db6ee 100644 --- a/p2p/simulations/http.go +++ b/p2p/simulations/http.go @@ -29,11 +29,11 @@ import ( "strings" "sync" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rpc" + "github.com/dexon-foundation/dexon/event" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/rpc" "github.com/julienschmidt/httprouter" "golang.org/x/net/websocket" ) diff --git a/p2p/simulations/http_test.go b/p2p/simulations/http_test.go index d9513caaa..844273231 100644 --- a/p2p/simulations/http_test.go +++ b/p2p/simulations/http_test.go @@ -28,13 +28,13 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rpc" + "github.com/dexon-foundation/dexon/event" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/node" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/rpc" colorable "github.com/mattn/go-colorable" ) diff --git a/p2p/simulations/mocker.go b/p2p/simulations/mocker.go index 8ce777a01..d29f58615 100644 --- a/p2p/simulations/mocker.go +++ b/p2p/simulations/mocker.go @@ -24,9 +24,9 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" ) //a map of mocker names to its function diff --git a/p2p/simulations/mocker_test.go b/p2p/simulations/mocker_test.go index 7c7016a5e..5df31c263 100644 --- a/p2p/simulations/mocker_test.go +++ b/p2p/simulations/mocker_test.go @@ -27,7 +27,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enode" ) func TestMocker(t *testing.T) { diff --git a/p2p/simulations/network.go b/p2p/simulations/network.go index ab9f582c5..6d5f2d028 100644 --- a/p2p/simulations/network.go +++ b/p2p/simulations/network.go @@ -25,11 +25,11 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/event" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" ) var DialBanTimeout = 200 * time.Millisecond diff --git a/p2p/simulations/network_test.go b/p2p/simulations/network_test.go index f34935265..5e550cd49 100644 --- a/p2p/simulations/network_test.go +++ b/p2p/simulations/network_test.go @@ -22,8 +22,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" ) // TestNetworkSimulation creates a multi-node simulation network with each node diff --git a/p2p/simulations/simulation.go b/p2p/simulations/simulation.go index ae62c42b9..4381ccca6 100644 --- a/p2p/simulations/simulation.go +++ b/p2p/simulations/simulation.go @@ -20,7 +20,7 @@ import ( "context" "time" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/enode" ) // Simulation provides a framework for running actions in a simulated network diff --git a/p2p/testing/peerpool.go b/p2p/testing/peerpool.go index 01ccce67e..e01c92285 100644 --- a/p2p/testing/peerpool.go +++ b/p2p/testing/peerpool.go @@ -20,8 +20,8 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p/enode" ) type TestPeer interface { diff --git a/p2p/testing/protocolsession.go b/p2p/testing/protocolsession.go index 476c2a984..cd807f83b 100644 --- a/p2p/testing/protocolsession.go +++ b/p2p/testing/protocolsession.go @@ -22,10 +22,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" ) var errTimedOut = errors.New("timed out") diff --git a/p2p/testing/protocoltester.go b/p2p/testing/protocoltester.go index afc03b009..c28ae5055 100644 --- a/p2p/testing/protocoltester.go +++ b/p2p/testing/protocoltester.go @@ -32,14 +32,14 @@ import ( "sync" "testing" - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/simulations" - "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" + "github.com/dexon-foundation/dexon/log" + "github.com/dexon-foundation/dexon/node" + "github.com/dexon-foundation/dexon/p2p" + "github.com/dexon-foundation/dexon/p2p/enode" + "github.com/dexon-foundation/dexon/p2p/simulations" + "github.com/dexon-foundation/dexon/p2p/simulations/adapters" + "github.com/dexon-foundation/dexon/rlp" + "github.com/dexon-foundation/dexon/rpc" ) // ProtocolTester is the tester environment used for unit testing protocol |