diff --git a/README.md b/README.md index 7504b47..10f18c4 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,10 @@ This library is a Nim re-implementation of the Ethereum DevP2P networking protocol. ## Installation -$ nimble install ethp2p +``` +$ nimble install eth_p2p +``` ## RLPx @@ -16,7 +18,7 @@ network. Most of the client code of this library should not be concerned with the implementation details of the underlying protocols and should use the high-level APIs described in this section. -To obtain a RLPx connection, use the proc `rlpxConnect` supplying the +To obtain a RLPx connection, use the `rlpxConnect` proc supplying the id of another node in the network. On success, the proc will return a `Peer` object representing the connection. Each of the RLPx sub-protocols consists of a set of strongly-typed messages, which are represented by diff --git a/ethp2p.nim b/eth_p2p.nim similarity index 81% rename from ethp2p.nim rename to eth_p2p.nim index e5e1ba0..de4f47c 100644 --- a/ethp2p.nim +++ b/eth_p2p.nim @@ -8,5 +8,5 @@ # MIT license (LICENSE-MIT) # -import ethp2p/[ecies, auth, enode, rlpxcrypt, discovery, kademlia] +import eth_p2p/[ecies, auth, enode, rlpxcrypt, discovery, kademlia] export ecies, auth, enode, rlpxcrypt, discovery, kademlia diff --git a/ethp2p.nimble b/eth_p2p.nimble similarity index 88% rename from ethp2p.nimble rename to eth_p2p.nimble index 5ee465f..86e8c44 100644 --- a/ethp2p.nimble +++ b/eth_p2p.nimble @@ -1,6 +1,6 @@ mode = ScriptMode.Verbose -packageName = "ethp2p" +packageName = "eth_p2p" version = "1.0.0" author = "Status Research & Development GmbH" description = "Ethereum P2P library" @@ -14,7 +14,7 @@ requires "nim > 0.18.0", "eth_keys", "ranges", "stint", - "https://github.com/status-im/nim-byteutils" + "byteutils" proc runTest(name: string, lang = "c") = exec "nim " & lang & " -r tests/" & name diff --git a/ethp2p/auth.nim b/eth_p2p/auth.nim similarity index 100% rename from ethp2p/auth.nim rename to eth_p2p/auth.nim diff --git a/ethp2p/discovery.nim b/eth_p2p/discovery.nim similarity index 100% rename from ethp2p/discovery.nim rename to eth_p2p/discovery.nim diff --git a/ethp2p/ecies.nim b/eth_p2p/ecies.nim similarity index 100% rename from ethp2p/ecies.nim rename to eth_p2p/ecies.nim diff --git a/ethp2p/enode.nim b/eth_p2p/enode.nim similarity index 100% rename from ethp2p/enode.nim rename to eth_p2p/enode.nim diff --git a/ethp2p/ethereum_types.nim b/eth_p2p/ethereum_types.nim similarity index 100% rename from ethp2p/ethereum_types.nim rename to eth_p2p/ethereum_types.nim diff --git a/ethp2p/kademlia.nim b/eth_p2p/kademlia.nim similarity index 100% rename from ethp2p/kademlia.nim rename to eth_p2p/kademlia.nim diff --git a/ethp2p/peer_pool.nim b/eth_p2p/peer_pool.nim similarity index 100% rename from ethp2p/peer_pool.nim rename to eth_p2p/peer_pool.nim diff --git a/ethp2p/rlpx.nim b/eth_p2p/rlpx.nim similarity index 100% rename from ethp2p/rlpx.nim rename to eth_p2p/rlpx.nim diff --git a/ethp2p/rlpx_protocols/eth.nim b/eth_p2p/rlpx_protocols/eth.nim similarity index 100% rename from ethp2p/rlpx_protocols/eth.nim rename to eth_p2p/rlpx_protocols/eth.nim diff --git a/ethp2p/rlpx_protocols/les.nim b/eth_p2p/rlpx_protocols/les.nim similarity index 100% rename from ethp2p/rlpx_protocols/les.nim rename to eth_p2p/rlpx_protocols/les.nim diff --git a/ethp2p/rlpxcrypt.nim b/eth_p2p/rlpxcrypt.nim similarity index 100% rename from ethp2p/rlpxcrypt.nim rename to eth_p2p/rlpxcrypt.nim diff --git a/ethp2p/server.nim b/eth_p2p/server.nim similarity index 100% rename from ethp2p/server.nim rename to eth_p2p/server.nim diff --git a/tests/tdiscovery.nim b/tests/tdiscovery.nim index 3cba7ad..bbc607f 100644 --- a/tests/tdiscovery.nim +++ b/tests/tdiscovery.nim @@ -1,7 +1,6 @@ -import ../ethp2p/[discovery, kademlia, peer_pool, enode] -import eth_keys, net, asyncdispatch, sequtils - -import logging, byteutils +import + eth_keys, net, asyncdispatch, sequtils, logging, byteutils, + ../eth_p2p/[discovery, kademlia, peer_pool, enode] addHandler(newConsoleLogger()) diff --git a/tests/testauth.nim b/tests/testauth.nim index 74b551c..b2fc72f 100644 --- a/tests/testauth.nim +++ b/tests/testauth.nim @@ -7,8 +7,9 @@ # distribution, for details about the copyright. # -import unittest -import eth_keys, ethp2p/auth, nimcrypto/utils, nimcrypto/keccak +import + unittest, eth_keys, nimcrypto/[utils, keccak], + eth_p2p/auth # This was generated by `print` actual auth message generated by # https://github.com/ethereum/py-evm/blob/master/tests/p2p/test_auth.py diff --git a/tests/testcrypt.nim b/tests/testcrypt.nim index 85afe3c..aa19d55 100644 --- a/tests/testcrypt.nim +++ b/tests/testcrypt.nim @@ -7,9 +7,10 @@ # distribution, for details about the copyright. # -import unittest -import eth_keys, ethp2p/auth, ethp2p/rlpxcrypt, nimcrypto/utils -import nimcrypto/sysrand, nimcrypto/keccak +import + unittest, eth_keys, + nimcrypto/[utils, sysrand, nimcrypto/keccak], + eth_p2p/[auth, rlpxcrypt] const data = [ ("initiator_private_key", diff --git a/tests/testecies.nim b/tests/testecies.nim index dc24151..1aebc21 100644 --- a/tests/testecies.nim +++ b/tests/testecies.nim @@ -7,9 +7,10 @@ # distribution, for details about the copyright. # -import unittest -import eth_keys, ethp2p/ecies -import nimcrypto/utils, nimcrypto/sha2, nimcrypto/hmac, nimcrypto/rijndael +import + unittest, eth_keys, + nimcrypto/[utils, sha2, hmac, rijndael], + eth_p2p/ecies proc compare[A, B](x: openarray[A], y: openarray[B], s: int = 0): bool = result = true diff --git a/tests/testenode.nim b/tests/testenode.nim index e6db0e3..17843ae 100644 --- a/tests/testenode.nim +++ b/tests/testenode.nim @@ -7,7 +7,8 @@ # Apache License, version 2.0, (LICENSE-APACHEv2) # MIT license (LICENSE-MIT) -import unittest, net, ethp2p/enode +import + unittest, net, eth_p2p/enode suite "ENode": test "Go-Ethereum tests": diff --git a/tests/tserver.nim b/tests/tserver.nim index cb82e40..11e4a17 100644 --- a/tests/tserver.nim +++ b/tests/tserver.nim @@ -1,5 +1,6 @@ -import ../ethp2p/[discovery, kademlia, peer_pool, enode, server, rlpx] -import eth_keys, net, asyncdispatch, sequtils +import + eth_keys, net, asyncdispatch, sequtils, + ../eth_p2p/[discovery, kademlia, peer_pool, enode, server, rlpx] proc localAddress(port: int): Address = let port = Port(port)