libp2p 0.2.1__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. {libp2p-0.2.1/libp2p.egg-info → libp2p-0.2.3}/PKG-INFO +120 -110
  2. libp2p-0.2.3/README.md +143 -0
  3. {libp2p-0.2.1 → libp2p-0.2.3}/examples/chat/chat.py +5 -5
  4. {libp2p-0.2.1 → libp2p-0.2.3}/examples/echo/echo.py +5 -5
  5. libp2p-0.2.3/examples/identify/identify.py +132 -0
  6. {libp2p-0.2.1 → libp2p-0.2.3}/examples/ping/ping.py +6 -5
  7. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/__init__.py +11 -19
  8. libp2p-0.2.3/libp2p/abc.py +2062 -0
  9. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/authenticated_encryption.py +1 -4
  10. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/key_exchange.py +1 -2
  11. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/pb/crypto_pb2.py +4 -4
  12. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/rsa.py +36 -0
  13. libp2p-0.2.3/libp2p/custom_types.py +49 -0
  14. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/host/basic_host.py +45 -23
  15. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/host/defaults.py +4 -4
  16. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/host/ping.py +6 -11
  17. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/host/routed_host.py +4 -6
  18. libp2p-0.2.3/libp2p/identity/identify/identify.py +114 -0
  19. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/identity/identify/pb/identify_pb2.py +4 -4
  20. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/io/abc.py +17 -1
  21. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/io/trio.py +11 -0
  22. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/network/connection/raw_connection.py +11 -3
  23. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/network/connection/swarm_connection.py +5 -9
  24. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/network/stream/net_stream.py +9 -7
  25. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/network/swarm.py +17 -33
  26. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/peer/peerdata.py +11 -12
  27. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/peer/peerinfo.py +4 -3
  28. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/peer/peerstore.py +12 -12
  29. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/protocol_muxer/multiselect.py +7 -14
  30. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/protocol_muxer/multiselect_client.py +6 -8
  31. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/protocol_muxer/multiselect_communicator.py +3 -3
  32. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/floodsub.py +10 -11
  33. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/gossipsub.py +44 -45
  34. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/mcache.py +13 -14
  35. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/pb/rpc_pb2.py +4 -4
  36. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/pubsub.py +24 -34
  37. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/pubsub_notifee.py +2 -8
  38. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/subscription.py +8 -5
  39. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/base_session.py +3 -3
  40. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/base_transport.py +3 -3
  41. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/insecure/pb/plaintext_pb2.py +4 -4
  42. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/insecure/transport.py +23 -9
  43. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/io.py +3 -3
  44. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/patterns.py +4 -6
  45. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/pb/noise_pb2.py +4 -4
  46. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/transport.py +7 -11
  47. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/secio/pb/spipe_pb2.py +4 -4
  48. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/secio/transport.py +9 -12
  49. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/secure_session.py +7 -0
  50. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/security_multistream.py +7 -13
  51. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/mplex/mplex.py +15 -15
  52. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/mplex/mplex_stream.py +6 -1
  53. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/muxer_multistream.py +8 -15
  54. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/async_service/abc.py +4 -3
  55. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/async_service/base.py +9 -10
  56. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/async_service/trio_service.py +7 -6
  57. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/async_service/typing.py +4 -4
  58. libp2p-0.2.3/libp2p/tools/timed_cache/base_timed_cache.py +54 -0
  59. libp2p-0.2.3/libp2p/tools/timed_cache/first_seen_cache.py +20 -0
  60. libp2p-0.2.3/libp2p/tools/timed_cache/last_seen_cache.py +22 -0
  61. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/utils.py +5 -5
  62. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/transport/tcp/tcp.py +14 -18
  63. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/transport/upgrader.py +9 -18
  64. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/utils.py +22 -0
  65. {libp2p-0.2.1 → libp2p-0.2.3/libp2p.egg-info}/PKG-INFO +120 -110
  66. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p.egg-info/SOURCES.txt +27 -38
  67. libp2p-0.2.3/libp2p.egg-info/entry_points.txt +5 -0
  68. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p.egg-info/requires.txt +5 -3
  69. {libp2p-0.2.1 → libp2p-0.2.3}/pyproject.toml +4 -1
  70. {libp2p-0.2.1 → libp2p-0.2.3}/scripts/release/test_package.py +4 -14
  71. {libp2p-0.2.1 → libp2p-0.2.3}/setup.py +15 -6
  72. {libp2p-0.2.1 → libp2p-0.2.3}/tests/conftest.py +1 -1
  73. libp2p-0.2.3/tests/core/crypto/test_rsa.py +30 -0
  74. libp2p-0.2.3/tests/core/examples/test_examples.py +210 -0
  75. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/host/test_connected_peers.py +1 -1
  76. libp2p-0.2.3/tests/core/host/test_live_peers.py +182 -0
  77. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/host/test_ping.py +1 -1
  78. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/host/test_routed_host.py +1 -1
  79. libp2p-0.2.3/tests/core/identity/identify/test_identify.py +79 -0
  80. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/network/conftest.py +1 -1
  81. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/network/test_notify.py +4 -4
  82. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/network/test_swarm.py +4 -4
  83. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/protocol_muxer/test_protocol_muxer.py +3 -3
  84. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/pubsub/test_dummyaccount_demo.py +3 -3
  85. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/pubsub/test_floodsub.py +9 -14
  86. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/pubsub/test_gossipsub.py +5 -5
  87. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/pubsub/test_gossipsub_backward_compatibility.py +2 -2
  88. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/pubsub/test_pubsub.py +10 -10
  89. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/security/noise/test_msg_read_writer.py +1 -1
  90. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/security/noise/test_noise.py +1 -1
  91. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/security/test_secio.py +1 -1
  92. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/security/test_security_multistream.py +1 -1
  93. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/stream_muxer/conftest.py +1 -1
  94. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/test_libp2p/test_libp2p.py +6 -6
  95. libp2p-0.2.3/tests/core/tools/timed_cache/test_timed_cache.py +131 -0
  96. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/conftest.py +4 -4
  97. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/test_bindings.py +2 -2
  98. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/test_echo.py +7 -7
  99. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/test_pubsub.py +6 -6
  100. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/factories.py +59 -63
  101. libp2p-0.2.3/tests/utils/interop/__init__.py +0 -0
  102. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/interop/daemon.py +6 -6
  103. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/interop/process.py +3 -4
  104. libp2p-0.2.3/tests/utils/pubsub/__init__.py +0 -0
  105. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/pubsub/dummy_account_node.py +7 -9
  106. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/pubsub/utils.py +2 -2
  107. libp2p-0.2.1/README.md +0 -149
  108. libp2p-0.2.1/libp2p/host/host_interface.py +0 -132
  109. libp2p-0.2.1/libp2p/identity/identify/protocol.py +0 -68
  110. libp2p-0.2.1/libp2p/network/connection/net_connection_interface.py +0 -31
  111. libp2p-0.2.1/libp2p/network/connection/raw_connection_interface.py +0 -9
  112. libp2p-0.2.1/libp2p/network/network_interface.py +0 -99
  113. libp2p-0.2.1/libp2p/network/notifee_interface.py +0 -65
  114. libp2p-0.2.1/libp2p/network/stream/net_stream_interface.py +0 -33
  115. libp2p-0.2.1/libp2p/peer/addrbook_interface.py +0 -62
  116. libp2p-0.2.1/libp2p/peer/peerdata_interface.py +0 -99
  117. libp2p-0.2.1/libp2p/peer/peermetadata_interface.py +0 -31
  118. libp2p-0.2.1/libp2p/peer/peerstore_interface.py +0 -160
  119. libp2p-0.2.1/libp2p/protocol_muxer/multiselect_client_interface.py +0 -58
  120. libp2p-0.2.1/libp2p/protocol_muxer/multiselect_communicator_interface.py +0 -24
  121. libp2p-0.2.1/libp2p/protocol_muxer/multiselect_muxer_interface.py +0 -51
  122. libp2p-0.2.1/libp2p/pubsub/abc.py +0 -158
  123. libp2p-0.2.1/libp2p/pubsub/typing.py +0 -19
  124. libp2p-0.2.1/libp2p/routing/interfaces.py +0 -42
  125. libp2p-0.2.1/libp2p/security/secure_conn_interface.py +0 -44
  126. libp2p-0.2.1/libp2p/security/secure_transport_interface.py +0 -42
  127. libp2p-0.2.1/libp2p/stream_muxer/abc.py +0 -85
  128. libp2p-0.2.1/libp2p/transport/listener_interface.py +0 -35
  129. libp2p-0.2.1/libp2p/transport/transport_interface.py +0 -41
  130. libp2p-0.2.1/libp2p/transport/typing.py +0 -24
  131. libp2p-0.2.1/libp2p/typing.py +0 -13
  132. libp2p-0.2.1/tests/core/examples/test_examples.py +0 -112
  133. libp2p-0.2.1/tests/core/identity/identify/test_protocol.py +0 -27
  134. {libp2p-0.2.1 → libp2p-0.2.3}/LICENSE-APACHE +0 -0
  135. {libp2p-0.2.1 → libp2p-0.2.3}/LICENSE-MIT +0 -0
  136. {libp2p-0.2.1 → libp2p-0.2.3}/MANIFEST.in +0 -0
  137. {libp2p-0.2.1 → libp2p-0.2.3}/examples/__init__.py +0 -0
  138. {libp2p-0.2.1 → libp2p-0.2.3}/examples/chat/__init__.py +0 -0
  139. {libp2p-0.2.1 → libp2p-0.2.3}/examples/echo/__init__.py +0 -0
  140. {libp2p-0.2.1/examples/ping → libp2p-0.2.3/examples/identify}/__init__.py +0 -0
  141. {libp2p-0.2.1/libp2p/crypto → libp2p-0.2.3/examples/ping}/__init__.py +0 -0
  142. {libp2p-0.2.1/libp2p/crypto/pb → libp2p-0.2.3/libp2p/crypto}/__init__.py +0 -0
  143. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/ecc.py +0 -0
  144. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/ed25519.py +0 -0
  145. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/exceptions.py +0 -0
  146. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/keys.py +0 -0
  147. {libp2p-0.2.1/libp2p/host → libp2p-0.2.3/libp2p/crypto/pb}/__init__.py +0 -0
  148. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/pb/crypto_pb2.pyi +0 -0
  149. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/secp256k1.py +0 -0
  150. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/crypto/serialization.py +0 -0
  151. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/exceptions.py +0 -0
  152. {libp2p-0.2.1/libp2p/identity → libp2p-0.2.3/libp2p/host}/__init__.py +0 -0
  153. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/host/exceptions.py +0 -0
  154. {libp2p-0.2.1/libp2p/identity/identify → libp2p-0.2.3/libp2p/identity}/__init__.py +0 -0
  155. {libp2p-0.2.1/libp2p/identity/identify/pb → libp2p-0.2.3/libp2p/identity/identify}/__init__.py +0 -0
  156. {libp2p-0.2.1/libp2p/io → libp2p-0.2.3/libp2p/identity/identify/pb}/__init__.py +0 -0
  157. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/identity/identify/pb/identify_pb2.pyi +0 -0
  158. {libp2p-0.2.1/libp2p/network → libp2p-0.2.3/libp2p/io}/__init__.py +0 -0
  159. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/io/exceptions.py +0 -0
  160. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/io/msgio.py +0 -0
  161. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/io/utils.py +0 -0
  162. {libp2p-0.2.1/libp2p/network/connection → libp2p-0.2.3/libp2p/network}/__init__.py +0 -0
  163. {libp2p-0.2.1/libp2p/network/stream → libp2p-0.2.3/libp2p/network/connection}/__init__.py +0 -0
  164. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/network/connection/exceptions.py +0 -0
  165. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/network/exceptions.py +0 -0
  166. {libp2p-0.2.1/libp2p/peer → libp2p-0.2.3/libp2p/network/stream}/__init__.py +0 -0
  167. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/network/stream/exceptions.py +0 -0
  168. {libp2p-0.2.1/libp2p/protocol_muxer → libp2p-0.2.3/libp2p/peer}/__init__.py +0 -0
  169. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/peer/id.py +0 -0
  170. {libp2p-0.2.1/libp2p/pubsub → libp2p-0.2.3/libp2p/protocol_muxer}/__init__.py +0 -0
  171. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/protocol_muxer/exceptions.py +0 -0
  172. {libp2p-0.2.1/libp2p/pubsub/pb → libp2p-0.2.3/libp2p/pubsub}/__init__.py +0 -0
  173. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/exceptions.py +0 -0
  174. {libp2p-0.2.1/libp2p/routing → libp2p-0.2.3/libp2p/pubsub/pb}/__init__.py +0 -0
  175. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/pb/rpc_pb2.pyi +0 -0
  176. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/pubsub/validators.py +0 -0
  177. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/py.typed +0 -0
  178. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/__init__.py +0 -0
  179. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/exceptions.py +0 -0
  180. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/insecure/__init__.py +0 -0
  181. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/insecure/pb/__init__.py +0 -0
  182. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/insecure/pb/plaintext_pb2.pyi +0 -0
  183. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/__init__.py +0 -0
  184. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/exceptions.py +0 -0
  185. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/messages.py +0 -0
  186. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/pb/__init__.py +0 -0
  187. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/noise/pb/noise_pb2.pyi +0 -0
  188. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/secio/__init__.py +0 -0
  189. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/secio/exceptions.py +0 -0
  190. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/secio/pb/__init__.py +0 -0
  191. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/security/secio/pb/spipe_pb2.pyi +0 -0
  192. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/__init__.py +0 -0
  193. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/exceptions.py +0 -0
  194. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/mplex/__init__.py +0 -0
  195. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/mplex/constants.py +0 -0
  196. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/mplex/datastructures.py +0 -0
  197. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/stream_muxer/mplex/exceptions.py +0 -0
  198. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/__init__.py +0 -0
  199. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/async_service/__init__.py +0 -0
  200. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/async_service/_utils.py +0 -0
  201. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/async_service/exceptions.py +0 -0
  202. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/async_service/stats.py +0 -0
  203. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/tools/constants.py +0 -0
  204. {libp2p-0.2.1/libp2p/tools/interop → libp2p-0.2.3/libp2p/tools/timed_cache}/__init__.py +0 -0
  205. {libp2p-0.2.1/libp2p/tools/pubsub → libp2p-0.2.3/libp2p/transport}/__init__.py +0 -0
  206. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p/transport/exceptions.py +0 -0
  207. {libp2p-0.2.1/libp2p/transport → libp2p-0.2.3/libp2p/transport/tcp}/__init__.py +0 -0
  208. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p.egg-info/dependency_links.txt +0 -0
  209. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p.egg-info/not-zip-safe +0 -0
  210. {libp2p-0.2.1 → libp2p-0.2.3}/libp2p.egg-info/top_level.txt +0 -0
  211. {libp2p-0.2.1 → libp2p-0.2.3}/setup.cfg +0 -0
  212. {libp2p-0.2.1/libp2p/transport/tcp → libp2p-0.2.3/tests}/__init__.py +0 -0
  213. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/crypto/test_ed25519.py +0 -0
  214. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/crypto/test_secp256k1.py +0 -0
  215. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/host/test_basic_host.py +0 -0
  216. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/network/test_net_stream.py +0 -0
  217. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/network/test_swarm_conn.py +0 -0
  218. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/peer/test_addrbook.py +0 -0
  219. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/peer/test_interop.py +0 -0
  220. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/peer/test_peerdata.py +0 -0
  221. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/peer/test_peerid.py +0 -0
  222. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/peer/test_peerinfo.py +1 -1
  223. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/peer/test_peermetadata.py +0 -0
  224. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/peer/test_peerstore.py +0 -0
  225. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/pubsub/test_mcache.py +0 -0
  226. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/pubsub/test_subscription.py +0 -0
  227. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/stream_muxer/test_mplex_conn.py +0 -0
  228. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/stream_muxer/test_mplex_stream.py +0 -0
  229. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/test_import_and_version.py +0 -0
  230. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/tools/async_service/test_trio_based_service.py +0 -0
  231. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/tools/async_service/test_trio_external_api.py +0 -0
  232. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/tools/async_service/test_trio_manager_stats.py +0 -0
  233. {libp2p-0.2.1 → libp2p-0.2.3}/tests/core/transport/test_tcp.py +1 -1
  234. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/go_pkgs/examples/README.md +0 -0
  235. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/go_pkgs/examples/echo/main.go +0 -0
  236. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/go_pkgs/examples/go.mod +0 -0
  237. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/go_pkgs/examples/go.sum +0 -0
  238. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/go_pkgs/examples/utils/host.go +0 -0
  239. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/go_pkgs/install_interop_go_pkgs.sh +0 -0
  240. {libp2p-0.2.1 → libp2p-0.2.3}/tests/interop/test_net_stream.py +0 -0
  241. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/interop/constants.py +0 -0
  242. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/interop/envs.py +0 -0
  243. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/interop/utils.py +0 -0
  244. {libp2p-0.2.1/libp2p/tools → libp2p-0.2.3/tests/utils}/pubsub/floodsub_integration_test_settings.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: libp2p
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: libp2p: The Python implementation of the libp2p networking stack
5
5
  Home-page: https://github.com/libp2p/py-libp2p
6
6
  Author: The Ethereum Foundation
@@ -16,12 +16,12 @@ Classifier: License :: OSI Approved :: MIT License
16
16
  Classifier: License :: OSI Approved :: Apache Software License
17
17
  Classifier: Natural Language :: English
18
18
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.8
20
19
  Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
23
22
  Classifier: Programming Language :: Python :: 3.12
24
- Requires-Python: >=3.8, <4
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Requires-Python: >=3.9, <4
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: LICENSE-APACHE
27
27
  License-File: LICENSE-MIT
@@ -43,7 +43,7 @@ Requires-Dist: fastecdsa-any==1.7.5; sys_platform == "win32"
43
43
  Requires-Dist: fastecdsa==1.7.5; sys_platform != "win32"
44
44
  Provides-Extra: dev
45
45
  Requires-Dist: build>=0.9.0; extra == "dev"
46
- Requires-Dist: bump-my-version>=0.5.3; extra == "dev"
46
+ Requires-Dist: bump_my_version>=0.19.0; extra == "dev"
47
47
  Requires-Dist: ipython; extra == "dev"
48
48
  Requires-Dist: mypy==1.10.0; extra == "dev"
49
49
  Requires-Dist: pre-commit>=3.4.0; extra == "dev"
@@ -52,7 +52,8 @@ Requires-Dist: twine; extra == "dev"
52
52
  Requires-Dist: wheel; extra == "dev"
53
53
  Requires-Dist: sphinx>=6.0.0; extra == "dev"
54
54
  Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "dev"
55
- Requires-Dist: towncrier<22,>=21; extra == "dev"
55
+ Requires-Dist: towncrier<25,>=24; extra == "dev"
56
+ Requires-Dist: p2pclient==0.2.0; extra == "dev"
56
57
  Requires-Dist: pytest>=7.0.0; extra == "dev"
57
58
  Requires-Dist: pytest-xdist>=2.4.0; extra == "dev"
58
59
  Requires-Dist: pytest-trio>=0.5.2; extra == "dev"
@@ -60,15 +61,36 @@ Requires-Dist: factory-boy<3.0.0,>=2.12.0; extra == "dev"
60
61
  Provides-Extra: docs
61
62
  Requires-Dist: sphinx>=6.0.0; extra == "docs"
62
63
  Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "docs"
63
- Requires-Dist: towncrier<22,>=21; extra == "docs"
64
+ Requires-Dist: towncrier<25,>=24; extra == "docs"
64
65
  Provides-Extra: test
66
+ Requires-Dist: p2pclient==0.2.0; extra == "test"
65
67
  Requires-Dist: pytest>=7.0.0; extra == "test"
66
68
  Requires-Dist: pytest-xdist>=2.4.0; extra == "test"
67
69
  Requires-Dist: pytest-trio>=0.5.2; extra == "test"
68
70
  Requires-Dist: factory-boy<3.0.0,>=2.12.0; extra == "test"
71
+ Dynamic: author
72
+ Dynamic: author-email
73
+ Dynamic: classifier
74
+ Dynamic: description
75
+ Dynamic: description-content-type
76
+ Dynamic: home-page
77
+ Dynamic: keywords
78
+ Dynamic: license
79
+ Dynamic: license-file
80
+ Dynamic: platform
81
+ Dynamic: provides-extra
82
+ Dynamic: requires-dist
83
+ Dynamic: requires-python
84
+ Dynamic: summary
69
85
 
70
86
  # py-libp2p
71
87
 
88
+ <h1 align="center">
89
+ <a href="https://libp2p.io/"><img width="250" src="https://github.com/libp2p/py-libp2p/blob/main/assets/py-libp2p-logo.png?raw=true" alt="py-libp2p hex logo" /></a>
90
+ </h1>
91
+
92
+ <h3 align="center">The Python implementation of the libp2p networking stack.</h3>
93
+
72
94
  [![Join the chat at https://gitter.im/py-libp2p/Lobby](https://badges.gitter.im/py-libp2p/Lobby.png)](https://gitter.im/py-libp2p/Lobby)
73
95
  [![Build Status](https://circleci.com/gh/libp2p/py-libp2p.svg?style=shield)](https://circleci.com/gh/libp2p/py-libp2p)
74
96
  [![PyPI version](https://badge.fury.io/py/libp2p.svg)](https://badge.fury.io/py/libp2p)
@@ -78,118 +100,106 @@ Requires-Dist: factory-boy<3.0.0,>=2.12.0; extra == "test"
78
100
  [![Matrix](https://img.shields.io/badge/matrix-%23libp2p%3Apermaweb.io-blue.svg)](https://riot.permaweb.io/#/room/#libp2p:permaweb.io)
79
101
  [![Discord](https://img.shields.io/discord/475789330380488707?color=blueviolet&label=discord)](https://discord.gg/66KBrm2)
80
102
 
81
- <h1 align="center">
82
- <a href="https://libp2p.io/"><img width="250" src="https://github.com/libp2p/py-libp2p/blob/main/assets/py-libp2p-logo.png?raw=true" alt="py-libp2p hex logo" /></a>
83
- </h1>
103
+ > ⚠️ **Warning:** py-libp2p is an experimental and work-in-progress repo under development. We do not yet recommend using py-libp2p in production environments.
104
+
105
+ Read more in the [documentation on ReadTheDocs](https://py-libp2p.readthedocs.io/). [View the release notes](https://py-libp2p.readthedocs.io/en/latest/release_notes.html).
84
106
 
85
- ## WARNING
107
+ ## Maintainers
86
108
 
87
- py-libp2p is an experimental and work-in-progress repo under development. We do not yet recommend using py-libp2p in production environments.
88
- Right now, `tests_interop` are turned off for CI, and a number of `tests` are failing. WIP.
109
+ Currently maintained by [@pacrob](https://github.com/pacrob), [@seetadev](https://github.com/seetadev) and [@dhuseby](https://github.com/dhuseby), looking for assistance!
89
110
 
90
- The Python implementation of the libp2p networking stack
111
+ ## Feature Breakdown
91
112
 
92
- Read more in the [documentation on ReadTheDocs](https://py-libp2p.readthedocs.io/). [View the release notes](https://py-libp2p.readthedocs.io/en/latest/release_notes.html).
113
+ py-libp2p aims for conformity with [the standard libp2p modules](https://libp2p.io/implementations/). Below is a breakdown of the modules we have developed, are developing, and may develop in the future.
93
114
 
94
- ## Maintainers
115
+ > Legend: ✅: Done  🛠️: In Progress/Usable  🌱 Prototype/Unstable  ❌: Missing
95
116
 
96
- Currently maintained by [@pacrob](https://github.com/pacrob) and [@dhuseby](https://github.com/dhuseby), looking for assistance!
117
+ ______________________________________________________________________
97
118
 
98
- Note that tests/core/test_libp2p/test_libp2p.py contains an end-to-end messaging test between two libp2p hosts, which is the bulk of our proof of concept.
119
+ ### Transports
99
120
 
100
- ## Feature Breakdown
121
+ | **Transport** | **Status** | **Source** |
122
+ | -------------------------------------- | :--------: | :---------------------------------------------------------------------------------: |
123
+ | **`libp2p-tcp`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/transport/tcp/tcp.py) |
124
+ | **`libp2p-quic`** | 🌱 | |
125
+ | **`libp2p-websocket`** | ❌ | |
126
+ | **`libp2p-webrtc-browser-to-server`** | ❌ | |
127
+ | **`libp2p-webrtc-private-to-private`** | ❌ | |
128
+
129
+ ______________________________________________________________________
130
+
131
+ ### NAT Traversal
132
+
133
+ | **NAT Traversal** | **Status** |
134
+ | ----------------------------- | :--------: |
135
+ | **`libp2p-circuit-relay-v2`** | ❌ |
136
+ | **`libp2p-autonat`** | ❌ |
137
+ | **`libp2p-hole-punching`** | ❌ |
138
+
139
+ ______________________________________________________________________
140
+
141
+ ### Secure Communication
101
142
 
102
- py-libp2p aims for conformity with [the standard libp2p modules](https://github.com/libp2p/libp2p/blob/master/REQUIREMENTS.md#libp2p-modules-implementations). Below is a breakdown of the modules we have developed, are developing, and may develop in the future.
103
-
104
- > Legend: :green_apple: Done   :lemon: In Progress   :tomato: Missing   :chestnut: Not planned
105
-
106
- | libp2p Node | Status |
107
- | ------------ | :-----------: |
108
- | **`libp2p`** | :green_apple: |
109
-
110
- | Identify Protocol | Status |
111
- | ----------------- | :-----: |
112
- | **`Identify`** | :lemon: |
113
-
114
- | Transport Protocols | Status |
115
- | ------------------- | :-----------: |
116
- | **`TCP`** | :green_apple: |
117
- | **`UDP`** | :tomato: |
118
- | **`WebSockets`** | :chestnut: |
119
- | **`UTP`** | :chestnut: |
120
- | **`WebRTC`** | :chestnut: |
121
- | **`SCTP`** | :chestnut: |
122
- | **`Tor`** | :chestnut: |
123
- | **`i2p`** | :chestnut: |
124
- | **`cjdns`** | :chestnut: |
125
- | **`Bluetooth LE`** | :chestnut: |
126
- | **`Audio TP`** | :chestnut: |
127
- | **`Zerotier`** | :chestnut: |
128
- | **`QUIC`** | :chestnut: |
129
-
130
- | Stream Muxers | Status |
131
- | ---------------- | :-----------: |
132
- | **`multiplex`** | :green_apple: |
133
- | **`yamux`** | :tomato: |
134
- | **`benchmarks`** | :chestnut: |
135
- | **`muxado`** | :chestnut: |
136
- | **`spdystream`** | :chestnut: |
137
- | **`spdy`** | :chestnut: |
138
- | **`http2`** | :chestnut: |
139
- | **`QUIC`** | :chestnut: |
140
-
141
- | Protocol Muxers | Status |
142
- | ----------------- | :-----------: |
143
- | **`multiselect`** | :green_apple: |
144
-
145
- | Switch (Swarm) | Status |
146
- | ------------------ | :-----------: |
147
- | **`Switch`** | :green_apple: |
148
- | **`Dialer stack`** | :green_apple: |
149
-
150
- | Peer Discovery | Status |
143
+ | **Secure Communication** | **Status** | **Source** |
144
+ | ------------------------ | :--------: | :---------------------------------------------------------------------------: |
145
+ | **`libp2p-noise`** | 🌱 | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/security/noise) |
146
+ | **`libp2p-tls`** | ❌ | |
147
+
148
+ ______________________________________________________________________
149
+
150
+ ### Discovery
151
+
152
+ | **Discovery** | **Status** |
153
+ | -------------------- | :--------: |
154
+ | **`bootstrap`** | ❌ |
155
+ | **`random-walk`** | ❌ |
156
+ | **`mdns-discovery`** | ❌ |
157
+ | **`rendezvous`** | ❌ |
158
+
159
+ ______________________________________________________________________
160
+
161
+ ### Peer Routing
162
+
163
+ | **Peer Routing** | **Status** |
151
164
  | -------------------- | :--------: |
152
- | **`bootstrap list`** | :tomato: |
153
- | **`Kademlia DHT`** | :chestnut: |
154
- | **`mDNS`** | :chestnut: |
155
- | **`PEX`** | :chestnut: |
156
- | **`DNS`** | :chestnut: |
157
-
158
- | Content Routing | Status |
159
- | ------------------ | :-----------: |
160
- | **`Kademlia DHT`** | :chestnut: |
161
- | **`floodsub`** | :green_apple: |
162
- | **`gossipsub`** | :green_apple: |
163
- | **`PHT`** | :chestnut: |
164
-
165
- | Peer Routing | Status |
166
- | ------------------ | :-----------: |
167
- | **`Kademlia DHT`** | :chestnut: |
168
- | **`floodsub`** | :green_apple: |
169
- | **`gossipsub`** | :green_apple: |
170
- | **`PHT`** | :chestnut: |
171
-
172
- | NAT Traversal | Status |
173
- | ------------------------ | :--------: |
174
- | **`nat-pmp`** | :chestnut: |
175
- | **`upnp`** | :chestnut: |
176
- | **`ext addr discovery`** | :chestnut: |
177
- | **`STUN-like`** | :chestnut: |
178
- | **`line-switch relay`** | :chestnut: |
179
- | **`pkt-switch relay`** | :chestnut: |
180
-
181
- | Exchange | Status |
182
- | ---------------- | :--------: |
183
- | **`HTTP`** | :chestnut: |
184
- | **`Bitswap`** | :chestnut: |
185
- | **`Bittorrent`** | :chestnut: |
186
-
187
- | Consensus | Status |
188
- | -------------- | :--------: |
189
- | **`Paxos`** | :chestnut: |
190
- | **`Raft`** | :chestnut: |
191
- | **`PBTF`** | :chestnut: |
192
- | **`Nakamoto`** | :chestnut: |
165
+ | **`libp2p-kad-dht`** | ❌ |
166
+
167
+ ______________________________________________________________________
168
+
169
+ ### Publish/Subscribe
170
+
171
+ | **Publish/Subscribe** | **Status** | **Source** |
172
+ | ---------------------- | :--------: | :--------------------------------------------------------------------------------: |
173
+ | **`libp2p-floodsub`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/pubsub/floodsub.py) |
174
+ | **`libp2p-gossipsub`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/pubsub/gossipsub.py) |
175
+
176
+ ______________________________________________________________________
177
+
178
+ ### Stream Muxers
179
+
180
+ | **Stream Muxers** | **Status** | **Status** |
181
+ | ------------------ | :--------: | :----------------------------------------------------------------------------------------: |
182
+ | **`libp2p-yamux`** | 🌱 | |
183
+ | **`libp2p-mplex`** | 🛠️ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/stream_muxer/mplex/mplex.py) |
184
+
185
+ ______________________________________________________________________
186
+
187
+ ### Storage
188
+
189
+ | **Storage** | **Status** |
190
+ | ------------------- | :--------: |
191
+ | **`libp2p-record`** | ❌ |
192
+
193
+ ______________________________________________________________________
194
+
195
+ ### General Purpose Utilities & Datatypes
196
+
197
+ | **Utility/Datatype** | **Status** | **Source** |
198
+ | -------------------- | :--------: | :-------------------------------------------------------------------------: |
199
+ | **`libp2p-ping`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/host/ping.py) |
200
+ | **`libp2p-peer`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/peer) |
201
+
202
+ ______________________________________________________________________
193
203
 
194
204
  ## Explanation of Basic Two Node Communication
195
205
 
@@ -211,7 +221,7 @@ Several components of the libp2p stack take part when establishing a connection
211
221
 
212
222
  _(non-normative, useful for team notes, not a reference)_
213
223
 
214
- **Initiate the connection**: A host is simply a node in the libp2p network that is able to communicate with other nodes in the network. In order for X and Y to communicate with one another, one of the hosts must initiate the connection. Let's say that X is going to initiate the connection. X will first open a connection to Y. This connection is where all of the actual communication will take place.
224
+ **Initiate the connection**: A host is simply a node in the libp2p network that is able to communicate with other nodes in the network. In order for X and Y to communicate with one another, one of the hosts must initiate the connection. Let's say that X is going to initiate the connection. X will first open a connection to Y. This connection is where all of the actual communication will take place.
215
225
 
216
226
  **Communication over one connection with multiple protocols**: X and Y can communicate over the same connection using different protocols and the multiplexer will appropriately route messages for a given protocol to a particular handler function for that protocol, which allows for each host to handle different protocols with separate functions. Furthermore, we can use multiple streams for a given protocol that allow for the same protocol and same underlying connection to be used for communication about separate topics between nodes X and Y.
217
227
 
libp2p-0.2.3/README.md ADDED
@@ -0,0 +1,143 @@
1
+ # py-libp2p
2
+
3
+ <h1 align="center">
4
+ <a href="https://libp2p.io/"><img width="250" src="https://github.com/libp2p/py-libp2p/blob/main/assets/py-libp2p-logo.png?raw=true" alt="py-libp2p hex logo" /></a>
5
+ </h1>
6
+
7
+ <h3 align="center">The Python implementation of the libp2p networking stack.</h3>
8
+
9
+ [![Join the chat at https://gitter.im/py-libp2p/Lobby](https://badges.gitter.im/py-libp2p/Lobby.png)](https://gitter.im/py-libp2p/Lobby)
10
+ [![Build Status](https://circleci.com/gh/libp2p/py-libp2p.svg?style=shield)](https://circleci.com/gh/libp2p/py-libp2p)
11
+ [![PyPI version](https://badge.fury.io/py/libp2p.svg)](https://badge.fury.io/py/libp2p)
12
+ [![Python versions](https://img.shields.io/pypi/pyversions/libp2p.svg)](https://pypi.python.org/pypi/libp2p)
13
+ [![Docs build](https://readthedocs.org/projects/py-libp2p/badge/?version=latest)](http://py-libp2p.readthedocs.io/en/latest/?badge=latest)
14
+ [![Freenode](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg)](https://webchat.freenode.net/?channels=%23libp2p)
15
+ [![Matrix](https://img.shields.io/badge/matrix-%23libp2p%3Apermaweb.io-blue.svg)](https://riot.permaweb.io/#/room/#libp2p:permaweb.io)
16
+ [![Discord](https://img.shields.io/discord/475789330380488707?color=blueviolet&label=discord)](https://discord.gg/66KBrm2)
17
+
18
+ > ⚠️ **Warning:** py-libp2p is an experimental and work-in-progress repo under development. We do not yet recommend using py-libp2p in production environments.
19
+
20
+ Read more in the [documentation on ReadTheDocs](https://py-libp2p.readthedocs.io/). [View the release notes](https://py-libp2p.readthedocs.io/en/latest/release_notes.html).
21
+
22
+ ## Maintainers
23
+
24
+ Currently maintained by [@pacrob](https://github.com/pacrob), [@seetadev](https://github.com/seetadev) and [@dhuseby](https://github.com/dhuseby), looking for assistance!
25
+
26
+ ## Feature Breakdown
27
+
28
+ py-libp2p aims for conformity with [the standard libp2p modules](https://libp2p.io/implementations/). Below is a breakdown of the modules we have developed, are developing, and may develop in the future.
29
+
30
+ > Legend: ✅: Done  🛠️: In Progress/Usable  🌱 Prototype/Unstable  ❌: Missing
31
+
32
+ ______________________________________________________________________
33
+
34
+ ### Transports
35
+
36
+ | **Transport** | **Status** | **Source** |
37
+ | -------------------------------------- | :--------: | :---------------------------------------------------------------------------------: |
38
+ | **`libp2p-tcp`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/transport/tcp/tcp.py) |
39
+ | **`libp2p-quic`** | 🌱 | |
40
+ | **`libp2p-websocket`** | ❌ | |
41
+ | **`libp2p-webrtc-browser-to-server`** | ❌ | |
42
+ | **`libp2p-webrtc-private-to-private`** | ❌ | |
43
+
44
+ ______________________________________________________________________
45
+
46
+ ### NAT Traversal
47
+
48
+ | **NAT Traversal** | **Status** |
49
+ | ----------------------------- | :--------: |
50
+ | **`libp2p-circuit-relay-v2`** | ❌ |
51
+ | **`libp2p-autonat`** | ❌ |
52
+ | **`libp2p-hole-punching`** | ❌ |
53
+
54
+ ______________________________________________________________________
55
+
56
+ ### Secure Communication
57
+
58
+ | **Secure Communication** | **Status** | **Source** |
59
+ | ------------------------ | :--------: | :---------------------------------------------------------------------------: |
60
+ | **`libp2p-noise`** | 🌱 | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/security/noise) |
61
+ | **`libp2p-tls`** | ❌ | |
62
+
63
+ ______________________________________________________________________
64
+
65
+ ### Discovery
66
+
67
+ | **Discovery** | **Status** |
68
+ | -------------------- | :--------: |
69
+ | **`bootstrap`** | ❌ |
70
+ | **`random-walk`** | ❌ |
71
+ | **`mdns-discovery`** | ❌ |
72
+ | **`rendezvous`** | ❌ |
73
+
74
+ ______________________________________________________________________
75
+
76
+ ### Peer Routing
77
+
78
+ | **Peer Routing** | **Status** |
79
+ | -------------------- | :--------: |
80
+ | **`libp2p-kad-dht`** | ❌ |
81
+
82
+ ______________________________________________________________________
83
+
84
+ ### Publish/Subscribe
85
+
86
+ | **Publish/Subscribe** | **Status** | **Source** |
87
+ | ---------------------- | :--------: | :--------------------------------------------------------------------------------: |
88
+ | **`libp2p-floodsub`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/pubsub/floodsub.py) |
89
+ | **`libp2p-gossipsub`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/pubsub/gossipsub.py) |
90
+
91
+ ______________________________________________________________________
92
+
93
+ ### Stream Muxers
94
+
95
+ | **Stream Muxers** | **Status** | **Status** |
96
+ | ------------------ | :--------: | :----------------------------------------------------------------------------------------: |
97
+ | **`libp2p-yamux`** | 🌱 | |
98
+ | **`libp2p-mplex`** | 🛠️ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/stream_muxer/mplex/mplex.py) |
99
+
100
+ ______________________________________________________________________
101
+
102
+ ### Storage
103
+
104
+ | **Storage** | **Status** |
105
+ | ------------------- | :--------: |
106
+ | **`libp2p-record`** | ❌ |
107
+
108
+ ______________________________________________________________________
109
+
110
+ ### General Purpose Utilities & Datatypes
111
+
112
+ | **Utility/Datatype** | **Status** | **Source** |
113
+ | -------------------- | :--------: | :-------------------------------------------------------------------------: |
114
+ | **`libp2p-ping`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/host/ping.py) |
115
+ | **`libp2p-peer`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/peer) |
116
+
117
+ ______________________________________________________________________
118
+
119
+ ## Explanation of Basic Two Node Communication
120
+
121
+ ### Core Concepts
122
+
123
+ _(non-normative, useful for team notes, not a reference)_
124
+
125
+ Several components of the libp2p stack take part when establishing a connection between two nodes:
126
+
127
+ 1. **Host**: a node in the libp2p network.
128
+ 1. **Connection**: the layer 3 connection between two nodes in a libp2p network.
129
+ 1. **Transport**: the component that creates a _Connection_, e.g. TCP, UDP, QUIC, etc.
130
+ 1. **Streams**: an abstraction on top of a _Connection_ representing parallel conversations about different matters, each of which is identified by a protocol ID. Multiple streams are layered on top of a _Connection_ via the _Multiplexer_.
131
+ 1. **Multiplexer**: a component that is responsible for wrapping messages sent on a stream with an envelope that identifies the stream they pertain to, normally via an ID. The multiplexer on the other unwraps the message and routes it internally based on the stream identification.
132
+ 1. **Secure channel**: optionally establishes a secure, encrypted, and authenticated channel over the _Connection_.
133
+ 1. **Upgrader**: a component that takes a raw layer 3 connection returned by the _Transport_, and performs the security and multiplexing negotiation to set up a secure, multiplexed channel on top of which _Streams_ can be opened.
134
+
135
+ ### Communication between two hosts X and Y
136
+
137
+ _(non-normative, useful for team notes, not a reference)_
138
+
139
+ **Initiate the connection**: A host is simply a node in the libp2p network that is able to communicate with other nodes in the network. In order for X and Y to communicate with one another, one of the hosts must initiate the connection. Let's say that X is going to initiate the connection. X will first open a connection to Y. This connection is where all of the actual communication will take place.
140
+
141
+ **Communication over one connection with multiple protocols**: X and Y can communicate over the same connection using different protocols and the multiplexer will appropriately route messages for a given protocol to a particular handler function for that protocol, which allows for each host to handle different protocols with separate functions. Furthermore, we can use multiple streams for a given protocol that allow for the same protocol and same underlying connection to be used for communication about separate topics between nodes X and Y.
142
+
143
+ **Why use multiple streams?**: The purpose of using the same connection for multiple streams to communicate over is to avoid the overhead of having multiple connections between X and Y. In order for X and Y to differentiate between messages on different streams and different protocols, a multiplexer is used to encode the messages when a message will be sent and decode a message when a message is received. The multiplexer encodes the message by adding a header to the beginning of any message to be sent that contains the stream id (along with some other info). Then, the message is sent across the raw connection and the receiving host will use its multiplexer to decode the message, i.e. determine which stream id the message should be routed to.
@@ -7,15 +7,15 @@ import trio
7
7
  from libp2p import (
8
8
  new_host,
9
9
  )
10
- from libp2p.network.stream.net_stream_interface import (
10
+ from libp2p.custom_types import (
11
+ TProtocol,
12
+ )
13
+ from libp2p.network.stream.net_stream import (
11
14
  INetStream,
12
15
  )
13
16
  from libp2p.peer.peerinfo import (
14
17
  info_from_p2p_addr,
15
18
  )
16
- from libp2p.typing import (
17
- TProtocol,
18
- )
19
19
 
20
20
  PROTOCOL_ID = TProtocol("/chat/1.0.0")
21
21
  MAX_READ_LEN = 2**32 - 1
@@ -54,7 +54,7 @@ async def run(port: int, destination: str) -> None:
54
54
 
55
55
  print(
56
56
  "Run this from the same folder in another console:\n\n"
57
- f"python chat.py -p {int(port) + 1} "
57
+ f"chat-demo -p {int(port) + 1} "
58
58
  f"-d /ip4/{localhost_ip}/tcp/{port}/p2p/{host.get_id().pretty()}\n"
59
59
  )
60
60
  print("Waiting for incoming connection...")
@@ -9,15 +9,15 @@ from libp2p import (
9
9
  from libp2p.crypto.secp256k1 import (
10
10
  create_new_key_pair,
11
11
  )
12
- from libp2p.network.stream.net_stream_interface import (
12
+ from libp2p.custom_types import (
13
+ TProtocol,
14
+ )
15
+ from libp2p.network.stream.net_stream import (
13
16
  INetStream,
14
17
  )
15
18
  from libp2p.peer.peerinfo import (
16
19
  info_from_p2p_addr,
17
20
  )
18
- from libp2p.typing import (
19
- TProtocol,
20
- )
21
21
 
22
22
  PROTOCOL_ID = TProtocol("/echo/1.0.0")
23
23
 
@@ -53,7 +53,7 @@ async def run(port: int, destination: str, seed: int = None) -> None:
53
53
 
54
54
  print(
55
55
  "Run this from the same folder in another console:\n\n"
56
- f"python echo.py -p {int(port) + 1} "
56
+ f"echo-demo -p {int(port) + 1} "
57
57
  f"-d /ip4/{localhost_ip}/tcp/{port}/p2p/{host.get_id().pretty()}\n"
58
58
  )
59
59
  print("Waiting for incoming connections...")
@@ -0,0 +1,132 @@
1
+ import argparse
2
+ import base64
3
+ import logging
4
+
5
+ import multiaddr
6
+ import trio
7
+
8
+ from libp2p import (
9
+ new_host,
10
+ )
11
+ from libp2p.identity.identify.identify import ID as IDENTIFY_PROTOCOL_ID
12
+ from libp2p.identity.identify.pb.identify_pb2 import (
13
+ Identify,
14
+ )
15
+ from libp2p.peer.peerinfo import (
16
+ info_from_p2p_addr,
17
+ )
18
+
19
+ logger = logging.getLogger("libp2p.identity.identify-example")
20
+
21
+
22
+ def decode_multiaddrs(raw_addrs):
23
+ """Convert raw listen addresses into human-readable multiaddresses."""
24
+ decoded_addrs = []
25
+ for addr in raw_addrs:
26
+ try:
27
+ decoded_addrs.append(str(multiaddr.Multiaddr(addr)))
28
+ except Exception as e:
29
+ decoded_addrs.append(f"Invalid Multiaddr ({addr}): {e}")
30
+ return decoded_addrs
31
+
32
+
33
+ def print_identify_response(identify_response):
34
+ """Pretty-print Identify response."""
35
+ public_key_b64 = base64.b64encode(identify_response.public_key).decode("utf-8")
36
+ listen_addrs = decode_multiaddrs(identify_response.listen_addrs)
37
+ try:
38
+ observed_addr_decoded = decode_multiaddrs([identify_response.observed_addr])
39
+ except Exception:
40
+ observed_addr_decoded = identify_response.observed_addr
41
+ print(
42
+ f"Identify response:\n"
43
+ f" Public Key (Base64): {public_key_b64}\n"
44
+ f" Listen Addresses: {listen_addrs}\n"
45
+ f" Protocols: {list(identify_response.protocols)}\n"
46
+ f" Observed Address: "
47
+ f"{observed_addr_decoded if identify_response.observed_addr else 'None'}\n"
48
+ f" Protocol Version: {identify_response.protocol_version}\n"
49
+ f" Agent Version: {identify_response.agent_version}"
50
+ )
51
+
52
+
53
+ async def run(port: int, destination: str) -> None:
54
+ localhost_ip = "0.0.0.0"
55
+
56
+ if not destination:
57
+ # Create first host (listener)
58
+ listen_addr = multiaddr.Multiaddr(f"/ip4/{localhost_ip}/tcp/{port}")
59
+ host_a = new_host()
60
+
61
+ async with host_a.run(listen_addrs=[listen_addr]):
62
+ print(
63
+ "First host listening. Run this from another console:\n\n"
64
+ f"identify-demo -p {int(port) + 1} "
65
+ f"-d /ip4/{localhost_ip}/tcp/{port}/p2p/{host_a.get_id().pretty()}\n"
66
+ )
67
+ print("Waiting for incoming identify request...")
68
+ await trio.sleep_forever()
69
+
70
+ else:
71
+ # Create second host (dialer)
72
+ print(f"dialer (host_b) listening on /ip4/{localhost_ip}/tcp/{port}")
73
+ listen_addr = multiaddr.Multiaddr(f"/ip4/{localhost_ip}/tcp/{port}")
74
+ host_b = new_host()
75
+
76
+ async with host_b.run(listen_addrs=[listen_addr]):
77
+ # Connect to the first host
78
+ maddr = multiaddr.Multiaddr(destination)
79
+ info = info_from_p2p_addr(maddr)
80
+ print(f"Second host connecting to peer: {info.peer_id}")
81
+
82
+ await host_b.connect(info)
83
+ stream = await host_b.new_stream(info.peer_id, (IDENTIFY_PROTOCOL_ID,))
84
+
85
+ try:
86
+ print("Starting identify protocol...")
87
+ response = await stream.read()
88
+ await stream.close()
89
+ identify_msg = Identify()
90
+ identify_msg.ParseFromString(response)
91
+ print_identify_response(identify_msg)
92
+ except Exception as e:
93
+ print(f"Identify protocol error: {e}")
94
+
95
+ return
96
+
97
+
98
+ def main() -> None:
99
+ description = """
100
+ This program demonstrates the libp2p identify protocol.
101
+ First run identify-demo -p <PORT>' to start a listener.
102
+ Then run 'identify-demo <ANOTHER_PORT> -d <DESTINATION>'
103
+ where <DESTINATION> is the multiaddress shown by the listener.
104
+ """
105
+
106
+ example_maddr = (
107
+ "/ip4/127.0.0.1/tcp/8888/p2p/QmQn4SwGkDZkUEpBRBvTmheQycxAHJUNmVEnjA2v1qe8Q"
108
+ )
109
+
110
+ parser = argparse.ArgumentParser(description=description)
111
+ parser.add_argument(
112
+ "-p", "--port", default=8888, type=int, help="source port number"
113
+ )
114
+ parser.add_argument(
115
+ "-d",
116
+ "--destination",
117
+ type=str,
118
+ help=f"destination multiaddr string, e.g. {example_maddr}",
119
+ )
120
+ args = parser.parse_args()
121
+
122
+ if not args.port:
123
+ raise RuntimeError("failed to determine local port")
124
+
125
+ try:
126
+ trio.run(run, *(args.port, args.destination))
127
+ except KeyboardInterrupt:
128
+ pass
129
+
130
+
131
+ if __name__ == "__main__":
132
+ main()