libp2p 0.2.6__tar.gz → 0.2.8__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 (261) hide show
  1. {libp2p-0.2.6/libp2p.egg-info → libp2p-0.2.8}/PKG-INFO +13 -28
  2. libp2p-0.2.8/docs/conf.py +349 -0
  3. {libp2p-0.2.6 → libp2p-0.2.8}/examples/chat/chat.py +3 -9
  4. libp2p-0.2.8/examples/doc-examples/example_encryption_insecure.py +51 -0
  5. libp2p-0.2.8/examples/doc-examples/example_encryption_noise.py +55 -0
  6. libp2p-0.2.8/examples/doc-examples/example_encryption_secio.py +48 -0
  7. libp2p-0.2.8/examples/doc-examples/example_multiplexer.py +55 -0
  8. libp2p-0.2.8/examples/doc-examples/example_net_stream.py +263 -0
  9. libp2p-0.2.8/examples/doc-examples/example_peer_discovery.py +75 -0
  10. libp2p-0.2.8/examples/doc-examples/example_running.py +55 -0
  11. libp2p-0.2.8/examples/doc-examples/example_transport.py +35 -0
  12. {libp2p-0.2.6 → libp2p-0.2.8}/examples/echo/echo.py +5 -11
  13. {libp2p-0.2.6 → libp2p-0.2.8}/examples/identify/identify.py +5 -10
  14. {libp2p-0.2.6 → libp2p-0.2.8}/examples/identify_push/identify_push_demo.py +49 -0
  15. {libp2p-0.2.6 → libp2p-0.2.8}/examples/identify_push/identify_push_listener_dialer.py +10 -24
  16. {libp2p-0.2.6 → libp2p-0.2.8}/examples/ping/ping.py +4 -10
  17. libp2p-0.2.8/examples/pubsub/pubsub.py +287 -0
  18. libp2p-0.2.8/libp2p/__init__.py +273 -0
  19. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/abc.py +93 -10
  20. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/authenticated_encryption.py +6 -6
  21. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/ecc.py +27 -13
  22. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/ed25519.py +6 -4
  23. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/key_exchange.py +1 -1
  24. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/keys.py +25 -18
  25. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/secp256k1.py +2 -2
  26. libp2p-0.2.8/libp2p/crypto/x25519.py +69 -0
  27. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/custom_types.py +8 -18
  28. libp2p-0.2.8/libp2p/exceptions.py +53 -0
  29. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/autonat/autonat.py +1 -4
  30. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/autonat/pb/autonat_pb2_grpc.py +16 -19
  31. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/basic_host.py +48 -11
  32. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/defaults.py +2 -2
  33. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/routed_host.py +2 -2
  34. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/identity/identify/identify.py +5 -9
  35. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/identity/identify_push/identify_push.py +3 -6
  36. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/io/abc.py +20 -20
  37. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/io/msgio.py +3 -4
  38. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/io/trio.py +2 -5
  39. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/io/utils.py +8 -6
  40. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/connection/raw_connection.py +2 -6
  41. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/connection/swarm_connection.py +48 -4
  42. libp2p-0.2.8/libp2p/network/stream/net_stream.py +308 -0
  43. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/swarm.py +37 -6
  44. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/peer/id.py +4 -7
  45. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/peer/peerdata.py +37 -2
  46. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/peer/peerinfo.py +14 -4
  47. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/peer/peerstore.py +32 -6
  48. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/protocol_muxer/multiselect.py +19 -6
  49. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/protocol_muxer/multiselect_client.py +30 -0
  50. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/floodsub.py +20 -8
  51. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/gossipsub.py +115 -23
  52. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/mcache.py +1 -4
  53. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/pubsub.py +149 -42
  54. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/base_session.py +1 -5
  55. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/base_transport.py +2 -2
  56. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/insecure/transport.py +12 -7
  57. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/io.py +16 -8
  58. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/messages.py +1 -1
  59. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/patterns.py +21 -8
  60. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/transport.py +3 -3
  61. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/secio/transport.py +7 -11
  62. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/secure_session.py +6 -6
  63. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/mplex/mplex.py +2 -5
  64. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/mplex/mplex_stream.py +25 -7
  65. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/muxer_multistream.py +21 -2
  66. libp2p-0.2.8/libp2p/stream_muxer/yamux/__init__.py +5 -0
  67. libp2p-0.2.8/libp2p/stream_muxer/yamux/yamux.py +696 -0
  68. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/async_service/_utils.py +2 -4
  69. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/async_service/abc.py +16 -16
  70. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/async_service/base.py +17 -22
  71. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/async_service/trio_service.py +21 -5
  72. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/constants.py +9 -0
  73. libp2p-0.2.8/libp2p/tools/utils.py +152 -0
  74. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/transport/tcp/tcp.py +82 -16
  75. libp2p-0.2.8/libp2p/utils/__init__.py +23 -0
  76. libp2p-0.2.8/libp2p/utils/logging.py +215 -0
  77. libp2p-0.2.6/libp2p/utils.py → libp2p-0.2.8/libp2p/utils/varint.py +2 -23
  78. libp2p-0.2.8/libp2p/utils/version.py +22 -0
  79. {libp2p-0.2.6 → libp2p-0.2.8/libp2p.egg-info}/PKG-INFO +13 -28
  80. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p.egg-info/SOURCES.txt +26 -3
  81. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p.egg-info/requires.txt +11 -3
  82. libp2p-0.2.8/libp2p.egg-info/top_level.txt +7 -0
  83. libp2p-0.2.8/newsfragments/validate_files.py +45 -0
  84. libp2p-0.2.8/pyproject.toml +281 -0
  85. libp2p-0.2.8/tests/core/crypto/test_x25519.py +102 -0
  86. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/examples/test_examples.py +14 -2
  87. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/host/test_autonat.py +6 -6
  88. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/host/test_connected_peers.py +2 -0
  89. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/host/test_routed_host.py +4 -3
  90. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/identity/identify_push/test_identify_push.py +0 -1
  91. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/network/test_net_stream.py +2 -2
  92. libp2p-0.2.8/tests/core/network/test_notify.py +130 -0
  93. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/network/test_swarm.py +28 -0
  94. libp2p-0.2.8/tests/core/peer/test_addrbook.py +86 -0
  95. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/peer/test_interop.py +1 -3
  96. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/peer/test_peerdata.py +9 -6
  97. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/peer/test_peerid.py +3 -7
  98. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/peer/test_peerinfo.py +5 -1
  99. libp2p-0.2.8/tests/core/peer/test_peermetadata.py +47 -0
  100. libp2p-0.2.8/tests/core/peer/test_peerstore.py +91 -0
  101. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/protocol_muxer/test_protocol_muxer.py +50 -28
  102. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/pubsub/test_dummyaccount_demo.py +0 -1
  103. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/pubsub/test_floodsub.py +3 -3
  104. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/pubsub/test_gossipsub.py +56 -36
  105. libp2p-0.2.8/tests/core/pubsub/test_gossipsub_direct_peers.py +175 -0
  106. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/pubsub/test_mcache.py +19 -8
  107. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/pubsub/test_pubsub.py +444 -40
  108. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/security/test_secio.py +6 -1
  109. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/security/test_security_multistream.py +23 -2
  110. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/stream_muxer/conftest.py +20 -0
  111. libp2p-0.2.8/tests/core/stream_muxer/test_async_context_manager.py +189 -0
  112. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/stream_muxer/test_mplex_conn.py +3 -3
  113. libp2p-0.2.8/tests/core/stream_muxer/test_multiplexer_selection.py +262 -0
  114. libp2p-0.2.8/tests/core/stream_muxer/test_yamux.py +460 -0
  115. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/tools/async_service/test_trio_based_service.py +9 -40
  116. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/tools/async_service/test_trio_external_api.py +10 -4
  117. libp2p-0.2.8/tests/core/tools/async_service/test_trio_manager_stats.py +101 -0
  118. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/tools/timed_cache/test_timed_cache.py +1 -1
  119. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/transport/test_tcp.py +2 -1
  120. libp2p-0.2.8/tests/exceptions/test_exceptions.py +17 -0
  121. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/factories.py +125 -55
  122. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/interop/daemon.py +4 -4
  123. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/interop/process.py +24 -10
  124. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/interop/utils.py +6 -4
  125. libp2p-0.2.8/tests/utils/pubsub/__init__.py +0 -0
  126. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/pubsub/dummy_account_node.py +7 -0
  127. libp2p-0.2.8/tests/utils/test_logging.py +258 -0
  128. libp2p-0.2.6/libp2p/__init__.py +0 -131
  129. libp2p-0.2.6/libp2p/exceptions.py +0 -16
  130. libp2p-0.2.6/libp2p/network/stream/net_stream.py +0 -87
  131. libp2p-0.2.6/libp2p/tools/utils.py +0 -63
  132. libp2p-0.2.6/libp2p.egg-info/not-zip-safe +0 -1
  133. libp2p-0.2.6/libp2p.egg-info/top_level.txt +0 -2
  134. libp2p-0.2.6/pyproject.toml +0 -170
  135. libp2p-0.2.6/setup.py +0 -117
  136. libp2p-0.2.6/tests/core/network/test_notify.py +0 -126
  137. libp2p-0.2.6/tests/core/peer/test_addrbook.py +0 -61
  138. libp2p-0.2.6/tests/core/peer/test_peermetadata.py +0 -46
  139. libp2p-0.2.6/tests/core/peer/test_peerstore.py +0 -62
  140. libp2p-0.2.6/tests/core/tools/async_service/test_trio_manager_stats.py +0 -86
  141. {libp2p-0.2.6 → libp2p-0.2.8}/LICENSE-APACHE +0 -0
  142. {libp2p-0.2.6 → libp2p-0.2.8}/LICENSE-MIT +0 -0
  143. {libp2p-0.2.6 → libp2p-0.2.8}/MANIFEST.in +0 -0
  144. {libp2p-0.2.6 → libp2p-0.2.8}/README.md +0 -0
  145. {libp2p-0.2.6 → libp2p-0.2.8}/examples/__init__.py +0 -0
  146. {libp2p-0.2.6 → libp2p-0.2.8}/examples/chat/__init__.py +0 -0
  147. {libp2p-0.2.6 → libp2p-0.2.8}/examples/echo/__init__.py +0 -0
  148. {libp2p-0.2.6 → libp2p-0.2.8}/examples/identify/__init__.py +0 -0
  149. {libp2p-0.2.6 → libp2p-0.2.8}/examples/identify_push/__init__.py +0 -0
  150. {libp2p-0.2.6 → libp2p-0.2.8}/examples/ping/__init__.py +0 -0
  151. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/__init__.py +0 -0
  152. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/exceptions.py +0 -0
  153. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/pb/__init__.py +0 -0
  154. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/pb/crypto_pb2.py +0 -0
  155. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/pb/crypto_pb2.pyi +0 -0
  156. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/rsa.py +0 -0
  157. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/crypto/serialization.py +0 -0
  158. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/__init__.py +0 -0
  159. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/autonat/__init__.py +0 -0
  160. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/autonat/pb/__init__.py +0 -0
  161. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/autonat/pb/autonat_pb2.py +0 -0
  162. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/autonat/pb/autonat_pb2.pyi +0 -0
  163. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/autonat/pb/autonat_pb2_grpc.pyi +0 -0
  164. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/autonat/pb/generate_proto.py +0 -0
  165. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/exceptions.py +0 -0
  166. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/host/ping.py +0 -0
  167. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/identity/__init__.py +0 -0
  168. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/identity/identify/__init__.py +0 -0
  169. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/identity/identify/pb/__init__.py +0 -0
  170. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/identity/identify/pb/identify_pb2.py +0 -0
  171. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/identity/identify/pb/identify_pb2.pyi +0 -0
  172. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/identity/identify_push/__init__.py +0 -0
  173. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/io/__init__.py +0 -0
  174. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/io/exceptions.py +0 -0
  175. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/__init__.py +0 -0
  176. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/connection/__init__.py +0 -0
  177. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/connection/exceptions.py +0 -0
  178. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/exceptions.py +0 -0
  179. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/stream/__init__.py +0 -0
  180. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/network/stream/exceptions.py +0 -0
  181. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/peer/__init__.py +0 -0
  182. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/protocol_muxer/__init__.py +0 -0
  183. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/protocol_muxer/exceptions.py +0 -0
  184. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/protocol_muxer/multiselect_communicator.py +0 -0
  185. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/__init__.py +0 -0
  186. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/exceptions.py +0 -0
  187. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/pb/__init__.py +0 -0
  188. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/pb/rpc_pb2.py +0 -0
  189. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/pb/rpc_pb2.pyi +0 -0
  190. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/pubsub_notifee.py +0 -0
  191. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/subscription.py +0 -0
  192. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/pubsub/validators.py +0 -0
  193. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/py.typed +0 -0
  194. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/__init__.py +0 -0
  195. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/exceptions.py +0 -0
  196. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/insecure/__init__.py +0 -0
  197. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/insecure/pb/__init__.py +0 -0
  198. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/insecure/pb/plaintext_pb2.py +0 -0
  199. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/insecure/pb/plaintext_pb2.pyi +0 -0
  200. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/__init__.py +0 -0
  201. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/exceptions.py +0 -0
  202. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/pb/__init__.py +0 -0
  203. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/pb/noise_pb2.py +0 -0
  204. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/noise/pb/noise_pb2.pyi +0 -0
  205. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/secio/__init__.py +0 -0
  206. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/secio/exceptions.py +0 -0
  207. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/secio/pb/__init__.py +0 -0
  208. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/secio/pb/spipe_pb2.py +0 -0
  209. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/secio/pb/spipe_pb2.pyi +0 -0
  210. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/security/security_multistream.py +0 -0
  211. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/__init__.py +0 -0
  212. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/exceptions.py +0 -0
  213. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/mplex/__init__.py +0 -0
  214. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/mplex/constants.py +0 -0
  215. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/mplex/datastructures.py +0 -0
  216. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/stream_muxer/mplex/exceptions.py +0 -0
  217. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/__init__.py +0 -0
  218. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/async_service/__init__.py +0 -0
  219. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/async_service/exceptions.py +0 -0
  220. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/async_service/stats.py +0 -0
  221. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/async_service/typing.py +1 -1
  222. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/timed_cache/__init__.py +0 -0
  223. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/timed_cache/base_timed_cache.py +0 -0
  224. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/timed_cache/first_seen_cache.py +0 -0
  225. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/tools/timed_cache/last_seen_cache.py +0 -0
  226. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/transport/__init__.py +0 -0
  227. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/transport/exceptions.py +0 -0
  228. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/transport/tcp/__init__.py +0 -0
  229. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p/transport/upgrader.py +0 -0
  230. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p.egg-info/dependency_links.txt +0 -0
  231. {libp2p-0.2.6 → libp2p-0.2.8}/libp2p.egg-info/entry_points.txt +0 -0
  232. {libp2p-0.2.6 → libp2p-0.2.8}/scripts/release/test_package.py +0 -0
  233. {libp2p-0.2.6 → libp2p-0.2.8}/setup.cfg +0 -0
  234. {libp2p-0.2.6 → libp2p-0.2.8}/tests/__init__.py +0 -0
  235. {libp2p-0.2.6 → libp2p-0.2.8}/tests/conftest.py +0 -0
  236. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/crypto/test_ed25519.py +0 -0
  237. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/crypto/test_rsa.py +0 -0
  238. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/crypto/test_secp256k1.py +0 -0
  239. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/host/test_basic_host.py +0 -0
  240. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/host/test_live_peers.py +0 -0
  241. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/host/test_ping.py +0 -0
  242. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/identity/identify/test_identify.py +0 -0
  243. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/network/conftest.py +0 -0
  244. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/network/test_swarm_conn.py +0 -0
  245. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/pubsub/test_gossipsub_backward_compatibility.py +0 -0
  246. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/pubsub/test_subscription.py +0 -0
  247. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/security/noise/test_msg_read_writer.py +0 -0
  248. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/security/noise/test_noise.py +0 -0
  249. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/stream_muxer/test_mplex_stream.py +0 -0
  250. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/test_import_and_version.py +0 -0
  251. {libp2p-0.2.6 → libp2p-0.2.8}/tests/core/test_libp2p/test_libp2p.py +0 -0
  252. {libp2p-0.2.6 → libp2p-0.2.8}/tests/interop/go_libp2p/test_go_basic.py +0 -0
  253. {libp2p-0.2.6 → libp2p-0.2.8}/tests/interop/js_libp2p/test_js_basic.py +0 -0
  254. {libp2p-0.2.6 → libp2p-0.2.8}/tests/interop/rust_libp2p/test_rust_basic.py +0 -0
  255. {libp2p-0.2.6 → libp2p-0.2.8}/tests/interop/zig_libp2p/test_zig_basic.py +0 -0
  256. {libp2p-0.2.6/tests/utils/interop → libp2p-0.2.8/tests/utils}/__init__.py +0 -0
  257. {libp2p-0.2.6/tests/utils/pubsub → libp2p-0.2.8/tests/utils/interop}/__init__.py +0 -0
  258. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/interop/constants.py +0 -0
  259. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/interop/envs.py +0 -0
  260. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/pubsub/floodsub_integration_test_settings.py +0 -0
  261. {libp2p-0.2.6 → libp2p-0.2.8}/tests/utils/pubsub/utils.py +0 -0
@@ -1,29 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libp2p
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: libp2p: The Python implementation of the libp2p networking stack
5
- Home-page: https://github.com/libp2p/py-libp2p
6
- Author: The Ethereum Foundation
7
- Author-email: snakecharmers@ethereum.org
5
+ Author-email: The Ethereum Foundation <snakecharmers@ethereum.org>
8
6
  License: MIT AND Apache-2.0
9
- Keywords: libp2p p2p
10
- Platform: unix
11
- Platform: linux
12
- Platform: osx
13
- Platform: win32
7
+ Project-URL: Homepage, https://github.com/libp2p/py-libp2p
8
+ Keywords: libp2p,p2p
14
9
  Classifier: Development Status :: 4 - Beta
15
10
  Classifier: Intended Audience :: Developers
16
11
  Classifier: Natural Language :: English
17
12
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.9
19
13
  Classifier: Programming Language :: Python :: 3.10
20
14
  Classifier: Programming Language :: Python :: 3.11
21
15
  Classifier: Programming Language :: Python :: 3.12
22
16
  Classifier: Programming Language :: Python :: 3.13
23
- Requires-Python: >=3.9, <4
17
+ Requires-Python: <4.0,>=3.10
24
18
  Description-Content-Type: text/markdown
25
- License-File: LICENSE-MIT
26
19
  License-File: LICENSE-APACHE
20
+ License-File: LICENSE-MIT
27
21
  Requires-Dist: base58>=1.0.3
28
22
  Requires-Dist: coincurve>=10.0.0
29
23
  Requires-Dist: exceptiongroup>=1.2.0; python_version < "3.11"
@@ -32,23 +26,24 @@ Requires-Dist: lru-dict>=1.1.6
32
26
  Requires-Dist: multiaddr>=0.0.9
33
27
  Requires-Dist: mypy-protobuf>=3.0.0
34
28
  Requires-Dist: noiseprotocol>=0.3.0
35
- Requires-Dist: protobuf>=6.30.1
29
+ Requires-Dist: protobuf<4.0.0,>=3.20.1
36
30
  Requires-Dist: pycryptodome>=3.9.2
37
31
  Requires-Dist: pymultihash>=0.8.2
38
32
  Requires-Dist: pynacl>=1.3.0
39
33
  Requires-Dist: rpcudp>=3.0.0
40
34
  Requires-Dist: trio-typing>=0.0.4
41
35
  Requires-Dist: trio>=0.26.0
42
- Requires-Dist: fastecdsa==1.7.5
36
+ Requires-Dist: fastecdsa==2.3.2; sys_platform != "win32"
43
37
  Provides-Extra: dev
44
38
  Requires-Dist: build>=0.9.0; extra == "dev"
45
39
  Requires-Dist: bump_my_version>=0.19.0; extra == "dev"
46
40
  Requires-Dist: ipython; extra == "dev"
47
- Requires-Dist: mypy==1.10.0; extra == "dev"
41
+ Requires-Dist: mypy>=1.15.0; extra == "dev"
48
42
  Requires-Dist: pre-commit>=3.4.0; extra == "dev"
49
43
  Requires-Dist: tox>=4.0.0; extra == "dev"
50
44
  Requires-Dist: twine; extra == "dev"
51
45
  Requires-Dist: wheel; extra == "dev"
46
+ Requires-Dist: setuptools>=42; extra == "dev"
52
47
  Requires-Dist: sphinx>=6.0.0; extra == "dev"
53
48
  Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "dev"
54
49
  Requires-Dist: towncrier<25,>=24; extra == "dev"
@@ -57,30 +52,20 @@ Requires-Dist: pytest>=7.0.0; extra == "dev"
57
52
  Requires-Dist: pytest-xdist>=2.4.0; extra == "dev"
58
53
  Requires-Dist: pytest-trio>=0.5.2; extra == "dev"
59
54
  Requires-Dist: factory-boy<3.0.0,>=2.12.0; extra == "dev"
55
+ Requires-Dist: ruff>=0.11.10; extra == "dev"
56
+ Requires-Dist: pyrefly<0.18.0,>=0.17.1; extra == "dev"
60
57
  Provides-Extra: docs
61
58
  Requires-Dist: sphinx>=6.0.0; extra == "docs"
62
59
  Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "docs"
63
60
  Requires-Dist: towncrier<25,>=24; extra == "docs"
61
+ Requires-Dist: tomli; python_version < "3.11" and extra == "docs"
64
62
  Provides-Extra: test
65
63
  Requires-Dist: p2pclient==0.2.0; extra == "test"
66
64
  Requires-Dist: pytest>=7.0.0; extra == "test"
67
65
  Requires-Dist: pytest-xdist>=2.4.0; extra == "test"
68
66
  Requires-Dist: pytest-trio>=0.5.2; extra == "test"
69
67
  Requires-Dist: factory-boy<3.0.0,>=2.12.0; extra == "test"
70
- Dynamic: author
71
- Dynamic: author-email
72
- Dynamic: classifier
73
- Dynamic: description
74
- Dynamic: description-content-type
75
- Dynamic: home-page
76
- Dynamic: keywords
77
- Dynamic: license
78
68
  Dynamic: license-file
79
- Dynamic: platform
80
- Dynamic: provides-extra
81
- Dynamic: requires-dist
82
- Dynamic: requires-python
83
- Dynamic: summary
84
69
 
85
70
  # py-libp2p
86
71
 
@@ -0,0 +1,349 @@
1
+ # py-libp2p documentation build configuration file, created by
2
+ # sphinx-quickstart on Thu Oct 16 20:43:24 2014.
3
+ #
4
+ # This file is execfile()d with the current directory set to its
5
+ # containing dir.
6
+ #
7
+ # Note that not all possible configuration values are present in this
8
+ # autogenerated file.
9
+ #
10
+ # All configuration values have a default; values that are commented out
11
+ # serve to show the default.
12
+
13
+ # If extensions (or modules to document with autodoc) are in another directory,
14
+ # add these directories to sys.path here. If the directory is relative to the
15
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
16
+ # sys.path.insert(0, os.path.abspath('.'))
17
+
18
+ import doctest
19
+ import os
20
+ import sys
21
+ from unittest.mock import MagicMock
22
+
23
+ try:
24
+ import tomllib
25
+ except ModuleNotFoundError:
26
+ # For Python < 3.11
27
+ import tomli as tomllib # type: ignore (In case of >3.11 Pyrefly doesnt find tomli , which is right but a false flag)
28
+
29
+ # Path to pyproject.toml (assuming conf.py is in a 'docs' subdirectory)
30
+ pyproject_path = os.path.join(os.path.dirname(__file__), "..", "pyproject.toml")
31
+
32
+ with open(pyproject_path, "rb") as f:
33
+ pyproject_data = tomllib.load(f)
34
+
35
+ setup_version = pyproject_data["project"]["version"]
36
+
37
+ # -- General configuration ------------------------------------------------
38
+
39
+ # If your documentation needs a minimal Sphinx version, state it here.
40
+ # needs_sphinx = '1.0'
41
+
42
+ # Add any Sphinx extension module names here, as strings. They can be
43
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
44
+ # ones.
45
+ extensions = [
46
+ "sphinx.ext.autodoc",
47
+ "sphinx.ext.doctest",
48
+ "sphinx.ext.intersphinx",
49
+ "sphinx_rtd_theme",
50
+ ]
51
+
52
+ # Add any paths that contain templates here, relative to this directory.
53
+ templates_path = ["_templates"]
54
+
55
+ # The suffix of source filenames.
56
+ source_suffix = ".rst"
57
+
58
+ # The encoding of source files.
59
+ # source_encoding = 'utf-8-sig'
60
+
61
+ # The master toctree document.
62
+ master_doc = "index"
63
+
64
+ # General information about the project.
65
+ project = "py-libp2p"
66
+ copyright = "2019, The libp2p team"
67
+ author = "The libp2p team"
68
+
69
+ __version__ = setup_version
70
+ # The version info for the project you're documenting, acts as replacement for
71
+ # |version| and |release|, also used in various other places throughout the
72
+ # built documents.
73
+ #
74
+ # The short X.Y version.
75
+ version = ".".join(__version__.split(".")[:2])
76
+ # The full version, including alpha/beta/rc tags.
77
+ release = __version__
78
+
79
+ # The language for content autogenerated by Sphinx. Refer to documentation
80
+ # for a list of supported languages.
81
+ # language = None
82
+
83
+ # There are two options for replacing |today|: either, you set today to some
84
+ # non-false value, then it is used:
85
+ # today = ''
86
+ # Else, today_fmt is used as the format for a strftime call.
87
+ # today_fmt = '%B %d, %Y'
88
+
89
+ # List of patterns, relative to source directory, that match files and
90
+ # directories to ignore when looking for source files.
91
+ exclude_patterns = [
92
+ "_build",
93
+ "modules.rst",
94
+ "libp2p.crypto.pb.rst",
95
+ ]
96
+
97
+ # The reST default role (used for this markup: `text`) to use for all
98
+ # documents.
99
+ # default_role = None
100
+
101
+ # If true, '()' will be appended to :func: etc. cross-reference text.
102
+ # add_function_parentheses = True
103
+
104
+ # If true, the current module name will be prepended to all description
105
+ # unit titles (such as .. function::).
106
+ # add_module_names = True
107
+
108
+ # If true, sectionauthor and moduleauthor directives will be shown in the
109
+ # output. They are ignored by default.
110
+ # show_authors = False
111
+
112
+ # The name of the Pygments (syntax highlighting) style to use.
113
+ pygments_style = "sphinx"
114
+
115
+ # A list of ignored prefixes for module index sorting.
116
+ # modindex_common_prefix = []
117
+
118
+ # If true, keep warnings as "system message" paragraphs in the built documents.
119
+ # keep_warnings = False
120
+
121
+
122
+ # -- Options for HTML output ----------------------------------------------
123
+
124
+ # The theme to use for HTML and HTML Help pages. See the documentation for
125
+ # a list of builtin themes.
126
+ html_theme = "sphinx_rtd_theme"
127
+
128
+ # Theme options are theme-specific and customize the look and feel of a theme
129
+ # further. For a list of options available for each theme, see the
130
+ # documentation.
131
+ html_theme_options = {
132
+ "logo_only": True,
133
+ "version_selector": False,
134
+ "language_selector": False,
135
+ }
136
+
137
+ # Add any paths that contain custom themes here, relative to this directory.
138
+
139
+ # The name for this set of Sphinx documents. If None, it defaults to
140
+ # "<project> v<release> documentation".
141
+ # html_title = None
142
+
143
+ # A shorter title for the navigation bar. Default is the same as html_title.
144
+ # html_short_title = None
145
+
146
+ # The name of an image file (relative to this directory) to place at the top
147
+ # of the sidebar.
148
+ html_logo = "_static/py-libp2p-logo.png"
149
+
150
+ # The name of an image file (within the static path) to use as favicon of the
151
+ # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
152
+ # pixels large.
153
+ # html_favicon = None
154
+
155
+ # Add any paths that contain custom static files (such as style sheets) here,
156
+ # relative to this directory. They are copied after the builtin static files,
157
+ # so a file named "default.css" will overwrite the builtin "default.css".
158
+ html_static_path = ["_static"]
159
+
160
+ # Add any extra paths that contain custom files (such as robots.txt or
161
+ # .htaccess) here, relative to this directory. These files are copied
162
+ # directly to the root of the documentation.
163
+ # html_extra_path = []
164
+
165
+ # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
166
+ # using the given strftime format.
167
+ # html_last_updated_fmt = '%b %d, %Y'
168
+
169
+ # If true, SmartyPants will be used to convert quotes and dashes to
170
+ # typographically correct entities.
171
+ # html_use_smartypants = True
172
+
173
+ # Custom sidebar templates, maps document names to template names.
174
+ # html_sidebars = {}
175
+
176
+ # Additional templates that should be rendered to pages, maps page names to
177
+ # template names.
178
+ # html_additional_pages = {}
179
+
180
+ # If false, no module index is generated.
181
+ # html_domain_indices = True
182
+
183
+ # If false, no index is generated.
184
+ # html_use_index = True
185
+
186
+ # If true, the index is split into individual pages for each letter.
187
+ # html_split_index = False
188
+
189
+ # If true, links to the reST sources are added to the pages.
190
+ # html_show_sourcelink = True
191
+
192
+ # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
193
+ # html_show_sphinx = True
194
+
195
+ # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
196
+ # html_show_copyright = True
197
+
198
+ # If true, an OpenSearch description file will be output, and all pages will
199
+ # contain a <link> tag referring to it. The value of this option must be the
200
+ # base URL from which the finished HTML is served.
201
+ # html_use_opensearch = ''
202
+
203
+ # This is the file name suffix for HTML files (e.g. ".xhtml").
204
+ # html_file_suffix = None
205
+
206
+ # Output file base name for HTML help builder.
207
+ htmlhelp_basename = "libp2pdocs"
208
+
209
+
210
+ # -- Options for LaTeX output ---------------------------------------------
211
+
212
+ latex_engine = "xelatex"
213
+
214
+ latex_elements = {
215
+ # The paper size ('letterpaper' or 'a4paper').
216
+ #'papersize': 'letterpaper',
217
+ # The font size ('10pt', '11pt' or '12pt').
218
+ #'pointsize': '10pt',
219
+ # Additional stuff for the LaTeX preamble.
220
+ #'preamble': '',
221
+ }
222
+
223
+ # Grouping the document tree into LaTeX files. List of tuples
224
+ # (source start file, target name, title,
225
+ # author, documentclass [howto, manual, or own class]).
226
+ latex_documents = [
227
+ (
228
+ "index",
229
+ "libp2p.tex",
230
+ "py-libp2p Documentation",
231
+ "The Ethereum Foundation",
232
+ "manual",
233
+ ),
234
+ ]
235
+
236
+ # The name of an image file (relative to this directory) to place at the top of
237
+ # the title page.
238
+ # latex_logo = None
239
+
240
+ # For "manual" documents, if this is true, then toplevel headings are parts,
241
+ # not chapters.
242
+ # latex_use_parts = False
243
+
244
+ # If true, show page references after internal links.
245
+ # latex_show_pagerefs = False
246
+
247
+ # If true, show URL addresses after external links.
248
+ # latex_show_urls = False
249
+
250
+ # Documents to append as an appendix to all manuals.
251
+ # latex_appendices = []
252
+
253
+ # If false, no module index is generated.
254
+ # latex_domain_indices = True
255
+
256
+
257
+ # -- Options for manual page output ---------------------------------------
258
+
259
+ # One entry per manual page. List of tuples
260
+ # (source start file, name, description, authors, manual section).
261
+ man_pages = [
262
+ (
263
+ "index",
264
+ "libp2p",
265
+ "py-libp2p Documentation",
266
+ ["The Ethereum Foundation"],
267
+ 1,
268
+ )
269
+ ]
270
+
271
+ # If true, show URL addresses after external links.
272
+ # man_show_urls = False
273
+
274
+
275
+ # -- Options for Texinfo output -------------------------------------------
276
+
277
+ # Grouping the document tree into Texinfo files. List of tuples
278
+ # (source start file, target name, title, author,
279
+ # dir menu entry, description, category)
280
+ texinfo_documents = [
281
+ (
282
+ "index",
283
+ "py-libp2p",
284
+ "py-libp2p Documentation",
285
+ "The Ethereum Foundation",
286
+ "py-libp2p",
287
+ "The Python implementation of the libp2p networking stack",
288
+ "Miscellaneous",
289
+ ),
290
+ ]
291
+
292
+ # Prevent autodoc from trying to import module from tests.factories
293
+ autodoc_mock_imports = ["tests.factories"]
294
+
295
+ # Documents to append as an appendix to all manuals.
296
+ # texinfo_appendices = []
297
+
298
+ # If false, no module index is generated.
299
+ # texinfo_domain_indices = True
300
+
301
+ # How to display URL addresses: 'footnote', 'no', or 'inline'.
302
+ # texinfo_show_urls = 'footnote'
303
+
304
+ # If true, do not generate a @detailmenu in the "Top" node's menu.
305
+ # texinfo_no_detailmenu = False
306
+
307
+ # -- Intersphinx configuration ------------------------------------------------
308
+
309
+ intersphinx_mapping = {
310
+ "python": ("https://docs.python.org/3.10", None),
311
+ }
312
+
313
+ # -- Doctest configuration ----------------------------------------
314
+
315
+
316
+ doctest_default_flags = (
317
+ 0
318
+ | doctest.DONT_ACCEPT_TRUE_FOR_1
319
+ | doctest.ELLIPSIS
320
+ | doctest.IGNORE_EXCEPTION_DETAIL
321
+ | doctest.NORMALIZE_WHITESPACE
322
+ )
323
+
324
+ # -- Mocked dependencies ----------------------------------------
325
+
326
+ # Mock out dependencies that are unbuildable on readthedocs, as recommended here:
327
+ # https://docs.readthedocs.io/en/rel/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
328
+
329
+
330
+ # Add new modules to mock here (it should be the same list
331
+ # as those excluded in pyproject.toml)
332
+ MOCK_MODULES = [
333
+ "fastecdsa",
334
+ "fastecdsa.encoding",
335
+ "fastecdsa.encoding.sec1",
336
+ ]
337
+ sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)
338
+ # -- Extension configuration -------------------------------------------------
339
+
340
+ # -- Options for todo extension ----------------------------------------------
341
+
342
+ # If true, `todo` and `todoList` produce output, else they produce nothing.
343
+ todo_include_todos = True
344
+
345
+ # -- Options for autodoc extension ------------------------------------------
346
+
347
+ # Allow duplicate object descriptions
348
+ nitpicky = False
349
+ nitpick_ignore = [("py:class", "type")]
@@ -40,7 +40,6 @@ async def write_data(stream: INetStream) -> None:
40
40
 
41
41
 
42
42
  async def run(port: int, destination: str) -> None:
43
- localhost_ip = "127.0.0.1"
44
43
  listen_addr = multiaddr.Multiaddr(f"/ip4/0.0.0.0/tcp/{port}")
45
44
  host = new_host()
46
45
  async with host.run(listen_addrs=[listen_addr]), trio.open_nursery() as nursery:
@@ -54,8 +53,8 @@ async def run(port: int, destination: str) -> None:
54
53
 
55
54
  print(
56
55
  "Run this from the same folder in another console:\n\n"
57
- f"chat-demo -p {int(port) + 1} "
58
- f"-d /ip4/{localhost_ip}/tcp/{port}/p2p/{host.get_id().pretty()}\n"
56
+ f"chat-demo "
57
+ f"-d {host.get_addrs()[0]}\n"
59
58
  )
60
59
  print("Waiting for incoming connection...")
61
60
 
@@ -87,9 +86,7 @@ def main() -> None:
87
86
  "/ip4/127.0.0.1/tcp/8000/p2p/QmQn4SwGkDZKkUEpBRBvTmheQycxAHJUNmVEnjA2v1qe8Q"
88
87
  )
89
88
  parser = argparse.ArgumentParser(description=description)
90
- parser.add_argument(
91
- "-p", "--port", default=8000, type=int, help="source port number"
92
- )
89
+ parser.add_argument("-p", "--port", default=0, type=int, help="source port number")
93
90
  parser.add_argument(
94
91
  "-d",
95
92
  "--destination",
@@ -98,9 +95,6 @@ def main() -> None:
98
95
  )
99
96
  args = parser.parse_args()
100
97
 
101
- if not args.port:
102
- raise RuntimeError("was not able to determine a local port")
103
-
104
98
  try:
105
99
  trio.run(run, *(args.port, args.destination))
106
100
  except KeyboardInterrupt:
@@ -0,0 +1,51 @@
1
+ import secrets
2
+
3
+ import multiaddr
4
+ import trio
5
+
6
+ from libp2p import (
7
+ new_host,
8
+ )
9
+ from libp2p.crypto.secp256k1 import (
10
+ create_new_key_pair,
11
+ )
12
+ from libp2p.security.insecure.transport import (
13
+ PLAINTEXT_PROTOCOL_ID,
14
+ InsecureTransport,
15
+ )
16
+
17
+
18
+ async def main():
19
+ # Create a key pair for the host
20
+ secret = secrets.token_bytes(32)
21
+ key_pair = create_new_key_pair(secret)
22
+
23
+ # Create an insecure transport (not recommended for production)
24
+ insecure_transport = InsecureTransport(
25
+ # local_key_pair: The key pair used for libp2p identity
26
+ local_key_pair=key_pair,
27
+ )
28
+
29
+ # Create a security options dictionary mapping protocol ID to transport
30
+ security_options = {PLAINTEXT_PROTOCOL_ID: insecure_transport}
31
+
32
+ # Create a host with the key pair and insecure transport
33
+ host = new_host(key_pair=key_pair, sec_opt=security_options)
34
+
35
+ # Configure the listening address
36
+ port = 8000
37
+ listen_addr = multiaddr.Multiaddr(f"/ip4/0.0.0.0/tcp/{port}")
38
+
39
+ # Start the host
40
+ async with host.run(listen_addrs=[listen_addr]):
41
+ print(
42
+ "libp2p has started with insecure transport "
43
+ "(not recommended for production)"
44
+ )
45
+ print("libp2p is listening on:", host.get_addrs())
46
+ # Keep the host running
47
+ await trio.sleep_forever()
48
+
49
+
50
+ # Run the async function
51
+ trio.run(main)
@@ -0,0 +1,55 @@
1
+ import secrets
2
+
3
+ import multiaddr
4
+ import trio
5
+
6
+ from libp2p import (
7
+ new_host,
8
+ )
9
+ from libp2p.crypto.secp256k1 import (
10
+ create_new_key_pair,
11
+ )
12
+ from libp2p.security.noise.transport import (
13
+ PROTOCOL_ID as NOISE_PROTOCOL_ID,
14
+ Transport as NoiseTransport,
15
+ )
16
+
17
+
18
+ async def main():
19
+ # Create a key pair for the host
20
+ secret = secrets.token_bytes(32)
21
+ key_pair = create_new_key_pair(secret)
22
+
23
+ # Create a Noise security transport
24
+ noise_transport = NoiseTransport(
25
+ # local_key_pair: The key pair used for libp2p identity and authentication
26
+ libp2p_keypair=key_pair,
27
+ # noise_privkey: The private key used for Noise protocol encryption
28
+ noise_privkey=key_pair.private_key,
29
+ # early_data: Optional data to send during the handshake
30
+ # (None means no early data)
31
+ early_data=None,
32
+ # with_noise_pipes: Whether to use Noise pipes for additional security features
33
+ with_noise_pipes=False,
34
+ )
35
+
36
+ # Create a security options dictionary mapping protocol ID to transport
37
+ security_options = {NOISE_PROTOCOL_ID: noise_transport}
38
+
39
+ # Create a host with the key pair and Noise security
40
+ host = new_host(key_pair=key_pair, sec_opt=security_options)
41
+
42
+ # Configure the listening address
43
+ port = 8000
44
+ listen_addr = multiaddr.Multiaddr(f"/ip4/0.0.0.0/tcp/{port}")
45
+
46
+ # Start the host
47
+ async with host.run(listen_addrs=[listen_addr]):
48
+ print("libp2p has started with Noise encryption")
49
+ print("libp2p is listening on:", host.get_addrs())
50
+ # Keep the host running
51
+ await trio.sleep_forever()
52
+
53
+
54
+ # Run the async function
55
+ trio.run(main)
@@ -0,0 +1,48 @@
1
+ import secrets
2
+
3
+ import multiaddr
4
+ import trio
5
+
6
+ from libp2p import (
7
+ new_host,
8
+ )
9
+ from libp2p.crypto.secp256k1 import (
10
+ create_new_key_pair,
11
+ )
12
+ from libp2p.security.secio.transport import (
13
+ ID as SECIO_PROTOCOL_ID,
14
+ Transport as SecioTransport,
15
+ )
16
+
17
+
18
+ async def main():
19
+ # Create a key pair for the host
20
+ secret = secrets.token_bytes(32)
21
+ key_pair = create_new_key_pair(secret)
22
+
23
+ # Create a SECIO security transport
24
+ secio_transport = SecioTransport(
25
+ # local_key_pair: The key pair used for libp2p identity and authentication
26
+ local_key_pair=key_pair,
27
+ )
28
+
29
+ # Create a security options dictionary mapping protocol ID to transport
30
+ security_options = {SECIO_PROTOCOL_ID: secio_transport}
31
+
32
+ # Create a host with the key pair and SECIO security
33
+ host = new_host(key_pair=key_pair, sec_opt=security_options)
34
+
35
+ # Configure the listening address
36
+ port = 8000
37
+ listen_addr = multiaddr.Multiaddr(f"/ip4/0.0.0.0/tcp/{port}")
38
+
39
+ # Start the host
40
+ async with host.run(listen_addrs=[listen_addr]):
41
+ print("libp2p has started with SECIO encryption")
42
+ print("libp2p is listening on:", host.get_addrs())
43
+ # Keep the host running
44
+ await trio.sleep_forever()
45
+
46
+
47
+ # Run the async function
48
+ trio.run(main)
@@ -0,0 +1,55 @@
1
+ import secrets
2
+
3
+ import multiaddr
4
+ import trio
5
+
6
+ from libp2p import (
7
+ new_host,
8
+ )
9
+ from libp2p.crypto.secp256k1 import (
10
+ create_new_key_pair,
11
+ )
12
+ from libp2p.security.noise.transport import (
13
+ PROTOCOL_ID as NOISE_PROTOCOL_ID,
14
+ Transport as NoiseTransport,
15
+ )
16
+
17
+
18
+ async def main():
19
+ # Create a key pair for the host
20
+ secret = secrets.token_bytes(32)
21
+ key_pair = create_new_key_pair(secret)
22
+
23
+ # Create a Noise security transport
24
+ noise_transport = NoiseTransport(
25
+ # local_key_pair: The key pair used for libp2p identity and authentication
26
+ libp2p_keypair=key_pair,
27
+ # noise_privkey: The private key used for Noise protocol encryption
28
+ noise_privkey=key_pair.private_key,
29
+ # early_data: Optional data to send during the handshake
30
+ # (None means no early data)
31
+ early_data=None,
32
+ # with_noise_pipes: Whether to use Noise pipes for additional security features
33
+ with_noise_pipes=False,
34
+ )
35
+
36
+ # Create a security options dictionary mapping protocol ID to transport
37
+ security_options = {NOISE_PROTOCOL_ID: noise_transport}
38
+
39
+ # Create a host with the key pair, Noise security, and mplex multiplexer
40
+ host = new_host(key_pair=key_pair, sec_opt=security_options)
41
+
42
+ # Configure the listening address
43
+ port = 8000
44
+ listen_addr = multiaddr.Multiaddr(f"/ip4/0.0.0.0/tcp/{port}")
45
+
46
+ # Start the host
47
+ async with host.run(listen_addrs=[listen_addr]):
48
+ print("libp2p has started with Noise encryption and mplex multiplexing")
49
+ print("libp2p is listening on:", host.get_addrs())
50
+ # Keep the host running
51
+ await trio.sleep_forever()
52
+
53
+
54
+ # Run the async function
55
+ trio.run(main)