libp2p 0.2.3__tar.gz → 0.2.5__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.
- {libp2p-0.2.3/libp2p.egg-info → libp2p-0.2.5}/PKG-INFO +12 -16
- {libp2p-0.2.3 → libp2p-0.2.5}/README.md +7 -9
- libp2p-0.2.5/libp2p/crypto/ecc.py +134 -0
- libp2p-0.2.5/libp2p/crypto/key_exchange.py +59 -0
- {libp2p-0.2.3 → libp2p-0.2.5/libp2p.egg-info}/PKG-INFO +12 -16
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p.egg-info/entry_points.txt +1 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p.egg-info/requires.txt +1 -6
- {libp2p-0.2.3 → libp2p-0.2.5}/pyproject.toml +1 -1
- {libp2p-0.2.3 → libp2p-0.2.5}/setup.py +22 -31
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/examples/test_examples.py +66 -3
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/tools/timed_cache/test_timed_cache.py +8 -7
- libp2p-0.2.3/libp2p/crypto/ecc.py +0 -82
- libp2p-0.2.3/libp2p/crypto/key_exchange.py +0 -40
- {libp2p-0.2.3 → libp2p-0.2.5}/LICENSE-APACHE +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/LICENSE-MIT +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/MANIFEST.in +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/chat/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/chat/chat.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/echo/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/echo/echo.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/identify/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/identify/identify.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/ping/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/examples/ping/ping.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/abc.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/authenticated_encryption.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/ed25519.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/keys.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/pb/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/pb/crypto_pb2.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/pb/crypto_pb2.pyi +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/rsa.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/secp256k1.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/crypto/serialization.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/custom_types.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/host/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/host/basic_host.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/host/defaults.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/host/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/host/ping.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/host/routed_host.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/identity/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/identity/identify/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/identity/identify/identify.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/identity/identify/pb/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/identity/identify/pb/identify_pb2.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/identity/identify/pb/identify_pb2.pyi +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/io/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/io/abc.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/io/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/io/msgio.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/io/trio.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/io/utils.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/connection/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/connection/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/connection/raw_connection.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/connection/swarm_connection.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/stream/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/stream/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/stream/net_stream.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/network/swarm.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/peer/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/peer/id.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/peer/peerdata.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/peer/peerinfo.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/peer/peerstore.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/protocol_muxer/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/protocol_muxer/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/protocol_muxer/multiselect.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/protocol_muxer/multiselect_client.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/protocol_muxer/multiselect_communicator.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/floodsub.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/gossipsub.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/mcache.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/pb/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/pb/rpc_pb2.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/pb/rpc_pb2.pyi +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/pubsub.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/pubsub_notifee.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/subscription.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/pubsub/validators.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/py.typed +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/base_session.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/base_transport.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/insecure/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/insecure/pb/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/insecure/pb/plaintext_pb2.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/insecure/pb/plaintext_pb2.pyi +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/insecure/transport.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/io.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/messages.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/patterns.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/pb/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/pb/noise_pb2.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/pb/noise_pb2.pyi +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/noise/transport.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/secio/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/secio/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/secio/pb/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/secio/pb/spipe_pb2.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/secio/pb/spipe_pb2.pyi +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/secio/transport.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/secure_session.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/security/security_multistream.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/mplex/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/mplex/constants.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/mplex/datastructures.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/mplex/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/mplex/mplex.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/mplex/mplex_stream.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/stream_muxer/muxer_multistream.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/async_service/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/async_service/_utils.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/async_service/abc.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/async_service/base.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/async_service/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/async_service/stats.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/async_service/trio_service.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/async_service/typing.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/constants.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/timed_cache/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/timed_cache/base_timed_cache.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/timed_cache/first_seen_cache.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/timed_cache/last_seen_cache.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/tools/utils.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/transport/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/transport/exceptions.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/transport/tcp/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/transport/tcp/tcp.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/transport/upgrader.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p/utils.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p.egg-info/SOURCES.txt +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p.egg-info/dependency_links.txt +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p.egg-info/not-zip-safe +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/libp2p.egg-info/top_level.txt +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/scripts/release/test_package.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/setup.cfg +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/conftest.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/crypto/test_ed25519.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/crypto/test_rsa.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/crypto/test_secp256k1.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/host/test_basic_host.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/host/test_connected_peers.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/host/test_live_peers.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/host/test_ping.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/host/test_routed_host.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/identity/identify/test_identify.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/network/conftest.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/network/test_net_stream.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/network/test_notify.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/network/test_swarm.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/network/test_swarm_conn.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/peer/test_addrbook.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/peer/test_interop.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/peer/test_peerdata.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/peer/test_peerid.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/peer/test_peerinfo.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/peer/test_peermetadata.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/peer/test_peerstore.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/protocol_muxer/test_protocol_muxer.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/pubsub/test_dummyaccount_demo.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/pubsub/test_floodsub.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/pubsub/test_gossipsub.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/pubsub/test_gossipsub_backward_compatibility.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/pubsub/test_mcache.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/pubsub/test_pubsub.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/pubsub/test_subscription.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/security/noise/test_msg_read_writer.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/security/noise/test_noise.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/security/test_secio.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/security/test_security_multistream.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/stream_muxer/conftest.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/stream_muxer/test_mplex_conn.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/stream_muxer/test_mplex_stream.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/test_import_and_version.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/test_libp2p/test_libp2p.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/tools/async_service/test_trio_based_service.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/tools/async_service/test_trio_external_api.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/tools/async_service/test_trio_manager_stats.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/core/transport/test_tcp.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/conftest.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/go_pkgs/examples/README.md +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/go_pkgs/examples/echo/main.go +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/go_pkgs/examples/go.mod +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/go_pkgs/examples/go.sum +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/go_pkgs/examples/utils/host.go +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/go_pkgs/install_interop_go_pkgs.sh +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/test_bindings.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/test_echo.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/test_net_stream.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/interop/test_pubsub.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/factories.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/interop/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/interop/constants.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/interop/daemon.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/interop/envs.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/interop/process.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/interop/utils.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/pubsub/__init__.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/pubsub/dummy_account_node.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/pubsub/floodsub_integration_test_settings.py +0 -0
- {libp2p-0.2.3 → libp2p-0.2.5}/tests/utils/pubsub/utils.py +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libp2p
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
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
|
|
7
7
|
Author-email: snakecharmers@ethereum.org
|
|
8
|
-
License: MIT
|
|
8
|
+
License: MIT AND Apache-2.0
|
|
9
9
|
Keywords: libp2p p2p
|
|
10
10
|
Platform: unix
|
|
11
11
|
Platform: linux
|
|
12
12
|
Platform: osx
|
|
13
|
+
Platform: win32
|
|
13
14
|
Classifier: Development Status :: 4 - Beta
|
|
14
15
|
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
16
|
Classifier: Natural Language :: English
|
|
18
17
|
Classifier: Programming Language :: Python :: 3
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -23,8 +22,8 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
24
23
|
Requires-Python: >=3.9, <4
|
|
25
24
|
Description-Content-Type: text/markdown
|
|
26
|
-
License-File: LICENSE-APACHE
|
|
27
25
|
License-File: LICENSE-MIT
|
|
26
|
+
License-File: LICENSE-APACHE
|
|
28
27
|
Requires-Dist: base58>=1.0.3
|
|
29
28
|
Requires-Dist: coincurve>=10.0.0
|
|
30
29
|
Requires-Dist: exceptiongroup>=1.2.0; python_version < "3.11"
|
|
@@ -39,8 +38,7 @@ Requires-Dist: pynacl>=1.3.0
|
|
|
39
38
|
Requires-Dist: rpcudp>=3.0.0
|
|
40
39
|
Requires-Dist: trio-typing>=0.0.4
|
|
41
40
|
Requires-Dist: trio>=0.26.0
|
|
42
|
-
Requires-Dist: fastecdsa
|
|
43
|
-
Requires-Dist: fastecdsa==1.7.5; sys_platform != "win32"
|
|
41
|
+
Requires-Dist: fastecdsa==1.7.5
|
|
44
42
|
Provides-Extra: dev
|
|
45
43
|
Requires-Dist: build>=0.9.0; extra == "dev"
|
|
46
44
|
Requires-Dist: bump_my_version>=0.19.0; extra == "dev"
|
|
@@ -91,14 +89,11 @@ Dynamic: summary
|
|
|
91
89
|
|
|
92
90
|
<h3 align="center">The Python implementation of the libp2p networking stack.</h3>
|
|
93
91
|
|
|
94
|
-
[](https://circleci.com/gh/libp2p/py-libp2p)
|
|
92
|
+
[](https://discord.gg/hQJnbd85N6)
|
|
96
93
|
[](https://badge.fury.io/py/libp2p)
|
|
97
94
|
[](https://pypi.python.org/pypi/libp2p)
|
|
95
|
+
[](https://github.com/libp2p/py-libp2p/actions/workflows/tox.yml)
|
|
98
96
|
[](http://py-libp2p.readthedocs.io/en/latest/?badge=latest)
|
|
99
|
-
[](https://webchat.freenode.net/?channels=%23libp2p)
|
|
100
|
-
[](https://riot.permaweb.io/#/room/#libp2p:permaweb.io)
|
|
101
|
-
[](https://discord.gg/66KBrm2)
|
|
102
97
|
|
|
103
98
|
> ⚠️ **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
99
|
|
|
@@ -194,10 +189,11 @@ ______________________________________________________________________
|
|
|
194
189
|
|
|
195
190
|
### General Purpose Utilities & Datatypes
|
|
196
191
|
|
|
197
|
-
| **Utility/Datatype**
|
|
198
|
-
|
|
|
199
|
-
| **`libp2p-ping`**
|
|
200
|
-
| **`libp2p-peer`**
|
|
192
|
+
| **Utility/Datatype** | **Status** | **Source** |
|
|
193
|
+
| --------------------- | :--------: | :------------------------------------------------------------------------------------------: |
|
|
194
|
+
| **`libp2p-ping`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/host/ping.py) |
|
|
195
|
+
| **`libp2p-peer`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/peer) |
|
|
196
|
+
| **`libp2p-identify`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/identity/identify/identify.py) |
|
|
201
197
|
|
|
202
198
|
______________________________________________________________________
|
|
203
199
|
|
|
@@ -6,14 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
<h3 align="center">The Python implementation of the libp2p networking stack.</h3>
|
|
8
8
|
|
|
9
|
-
[](https://circleci.com/gh/libp2p/py-libp2p)
|
|
9
|
+
[](https://discord.gg/hQJnbd85N6)
|
|
11
10
|
[](https://badge.fury.io/py/libp2p)
|
|
12
11
|
[](https://pypi.python.org/pypi/libp2p)
|
|
12
|
+
[](https://github.com/libp2p/py-libp2p/actions/workflows/tox.yml)
|
|
13
13
|
[](http://py-libp2p.readthedocs.io/en/latest/?badge=latest)
|
|
14
|
-
[](https://webchat.freenode.net/?channels=%23libp2p)
|
|
15
|
-
[](https://riot.permaweb.io/#/room/#libp2p:permaweb.io)
|
|
16
|
-
[](https://discord.gg/66KBrm2)
|
|
17
14
|
|
|
18
15
|
> ⚠️ **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
16
|
|
|
@@ -109,10 +106,11 @@ ______________________________________________________________________
|
|
|
109
106
|
|
|
110
107
|
### General Purpose Utilities & Datatypes
|
|
111
108
|
|
|
112
|
-
| **Utility/Datatype**
|
|
113
|
-
|
|
|
114
|
-
| **`libp2p-ping`**
|
|
115
|
-
| **`libp2p-peer`**
|
|
109
|
+
| **Utility/Datatype** | **Status** | **Source** |
|
|
110
|
+
| --------------------- | :--------: | :------------------------------------------------------------------------------------------: |
|
|
111
|
+
| **`libp2p-ping`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/host/ping.py) |
|
|
112
|
+
| **`libp2p-peer`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/peer) |
|
|
113
|
+
| **`libp2p-identify`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/identity/identify/identify.py) |
|
|
116
114
|
|
|
117
115
|
______________________________________________________________________
|
|
118
116
|
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from libp2p.crypto.keys import (
|
|
4
|
+
KeyPair,
|
|
5
|
+
KeyType,
|
|
6
|
+
PrivateKey,
|
|
7
|
+
PublicKey,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
if sys.platform != "win32":
|
|
11
|
+
from fastecdsa import (
|
|
12
|
+
keys,
|
|
13
|
+
point,
|
|
14
|
+
)
|
|
15
|
+
from fastecdsa import curve as curve_types
|
|
16
|
+
from fastecdsa.encoding.sec1 import (
|
|
17
|
+
SEC1Encoder,
|
|
18
|
+
)
|
|
19
|
+
else:
|
|
20
|
+
from coincurve import PrivateKey as CPrivateKey
|
|
21
|
+
from coincurve import PublicKey as CPublicKey
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def infer_local_type(curve: str) -> object:
|
|
25
|
+
"""
|
|
26
|
+
Convert a str representation of some elliptic curve to a
|
|
27
|
+
representation understood by the backend of this module.
|
|
28
|
+
"""
|
|
29
|
+
if curve != "P-256":
|
|
30
|
+
raise NotImplementedError("Only P-256 curve is supported")
|
|
31
|
+
|
|
32
|
+
if sys.platform != "win32":
|
|
33
|
+
return curve_types.P256
|
|
34
|
+
return "P-256" # coincurve only supports P-256
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if sys.platform != "win32":
|
|
38
|
+
|
|
39
|
+
class ECCPublicKey(PublicKey):
|
|
40
|
+
def __init__(self, impl: point.Point, curve: curve_types.Curve) -> None:
|
|
41
|
+
self.impl = impl
|
|
42
|
+
self.curve = curve
|
|
43
|
+
|
|
44
|
+
def to_bytes(self) -> bytes:
|
|
45
|
+
return SEC1Encoder.encode_public_key(self.impl, compressed=False)
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_bytes(cls, data: bytes, curve: str) -> "ECCPublicKey":
|
|
49
|
+
curve_type = infer_local_type(curve)
|
|
50
|
+
public_key_impl = SEC1Encoder.decode_public_key(data, curve_type)
|
|
51
|
+
return cls(public_key_impl, curve_type)
|
|
52
|
+
|
|
53
|
+
def get_type(self) -> KeyType:
|
|
54
|
+
return KeyType.ECC_P256
|
|
55
|
+
|
|
56
|
+
def verify(self, data: bytes, signature: bytes) -> bool:
|
|
57
|
+
raise NotImplementedError()
|
|
58
|
+
|
|
59
|
+
class ECCPrivateKey(PrivateKey):
|
|
60
|
+
def __init__(self, impl: int, curve: curve_types.Curve) -> None:
|
|
61
|
+
self.impl = impl
|
|
62
|
+
self.curve = curve
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def new(cls, curve: str) -> "ECCPrivateKey":
|
|
66
|
+
curve_type = infer_local_type(curve)
|
|
67
|
+
private_key_impl = keys.gen_private_key(curve_type)
|
|
68
|
+
return cls(private_key_impl, curve_type)
|
|
69
|
+
|
|
70
|
+
def to_bytes(self) -> bytes:
|
|
71
|
+
return keys.export_key(self.impl, self.curve)
|
|
72
|
+
|
|
73
|
+
def get_type(self) -> KeyType:
|
|
74
|
+
return KeyType.ECC_P256
|
|
75
|
+
|
|
76
|
+
def sign(self, data: bytes) -> bytes:
|
|
77
|
+
raise NotImplementedError()
|
|
78
|
+
|
|
79
|
+
def get_public_key(self) -> PublicKey:
|
|
80
|
+
public_key_impl = keys.get_public_key(self.impl, self.curve)
|
|
81
|
+
return ECCPublicKey(public_key_impl, self.curve)
|
|
82
|
+
|
|
83
|
+
else:
|
|
84
|
+
|
|
85
|
+
class ECCPublicKey(PublicKey):
|
|
86
|
+
def __init__(self, impl: CPublicKey, curve: str) -> None:
|
|
87
|
+
self.impl = impl
|
|
88
|
+
self.curve = curve
|
|
89
|
+
|
|
90
|
+
def to_bytes(self) -> bytes:
|
|
91
|
+
return self.impl.format(compressed=False)
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_bytes(cls, data: bytes, curve: str) -> "ECCPublicKey":
|
|
95
|
+
curve_type = infer_local_type(curve)
|
|
96
|
+
return cls(CPublicKey(data), curve_type) # type: ignore[arg-type]
|
|
97
|
+
|
|
98
|
+
def get_type(self) -> KeyType:
|
|
99
|
+
return KeyType.ECC_P256
|
|
100
|
+
|
|
101
|
+
def verify(self, data: bytes, signature: bytes) -> bool:
|
|
102
|
+
raise NotImplementedError()
|
|
103
|
+
|
|
104
|
+
class ECCPrivateKey(PrivateKey):
|
|
105
|
+
def __init__(self, impl: CPrivateKey, curve: str) -> None:
|
|
106
|
+
self.impl = impl
|
|
107
|
+
self.curve = curve
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def new(cls, curve: str) -> "ECCPrivateKey":
|
|
111
|
+
curve_type = infer_local_type(curve)
|
|
112
|
+
return cls(CPrivateKey(), curve_type) # type: ignore[arg-type]
|
|
113
|
+
|
|
114
|
+
def to_bytes(self) -> bytes:
|
|
115
|
+
return self.impl.secret
|
|
116
|
+
|
|
117
|
+
def get_type(self) -> KeyType:
|
|
118
|
+
return KeyType.ECC_P256
|
|
119
|
+
|
|
120
|
+
def sign(self, data: bytes) -> bytes:
|
|
121
|
+
raise NotImplementedError()
|
|
122
|
+
|
|
123
|
+
def get_public_key(self) -> PublicKey:
|
|
124
|
+
return ECCPublicKey(self.impl.public_key, self.curve)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def create_new_key_pair(curve: str) -> KeyPair:
|
|
128
|
+
"""
|
|
129
|
+
Return a new ECC keypair with the requested curve type, e.g.
|
|
130
|
+
"P-256".
|
|
131
|
+
"""
|
|
132
|
+
private_key = ECCPrivateKey.new(curve)
|
|
133
|
+
public_key = private_key.get_public_key()
|
|
134
|
+
return KeyPair(private_key, public_key)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from typing import (
|
|
3
|
+
Callable,
|
|
4
|
+
cast,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
if sys.platform != "win32":
|
|
8
|
+
from fastecdsa.encoding import (
|
|
9
|
+
util,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
int_bytelen = util.int_bytelen
|
|
13
|
+
else:
|
|
14
|
+
from math import (
|
|
15
|
+
ceil,
|
|
16
|
+
log2,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
def int_bytelen(n: int) -> int:
|
|
20
|
+
if n == 0:
|
|
21
|
+
return 1
|
|
22
|
+
return ceil(log2(abs(n) + 1) / 8)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
from libp2p.crypto.ecc import (
|
|
26
|
+
ECCPrivateKey,
|
|
27
|
+
ECCPublicKey,
|
|
28
|
+
create_new_key_pair,
|
|
29
|
+
)
|
|
30
|
+
from libp2p.crypto.keys import (
|
|
31
|
+
PublicKey,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
SharedKeyGenerator = Callable[[bytes], bytes]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def create_ephemeral_key_pair(curve_type: str) -> tuple[PublicKey, SharedKeyGenerator]:
|
|
38
|
+
"""Facilitates ECDH key exchange."""
|
|
39
|
+
if curve_type != "P-256":
|
|
40
|
+
raise NotImplementedError()
|
|
41
|
+
|
|
42
|
+
key_pair = create_new_key_pair(curve_type)
|
|
43
|
+
|
|
44
|
+
def _key_exchange(serialized_remote_public_key: bytes) -> bytes:
|
|
45
|
+
private_key = cast(ECCPrivateKey, key_pair.private_key)
|
|
46
|
+
|
|
47
|
+
remote_point = ECCPublicKey.from_bytes(serialized_remote_public_key, curve_type)
|
|
48
|
+
|
|
49
|
+
if sys.platform != "win32":
|
|
50
|
+
secret_point = remote_point.impl * private_key.impl
|
|
51
|
+
secret_x_coordinate = secret_point.x
|
|
52
|
+
byte_size = int_bytelen(secret_x_coordinate)
|
|
53
|
+
return secret_x_coordinate.to_bytes(byte_size, byteorder="big")
|
|
54
|
+
else:
|
|
55
|
+
# Windows implementation using coincurve
|
|
56
|
+
shared_key = private_key.impl.ecdh(remote_point.impl.public_key)
|
|
57
|
+
return shared_key
|
|
58
|
+
|
|
59
|
+
return key_pair.public_key, _key_exchange
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libp2p
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
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
|
|
7
7
|
Author-email: snakecharmers@ethereum.org
|
|
8
|
-
License: MIT
|
|
8
|
+
License: MIT AND Apache-2.0
|
|
9
9
|
Keywords: libp2p p2p
|
|
10
10
|
Platform: unix
|
|
11
11
|
Platform: linux
|
|
12
12
|
Platform: osx
|
|
13
|
+
Platform: win32
|
|
13
14
|
Classifier: Development Status :: 4 - Beta
|
|
14
15
|
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
16
|
Classifier: Natural Language :: English
|
|
18
17
|
Classifier: Programming Language :: Python :: 3
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -23,8 +22,8 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
24
23
|
Requires-Python: >=3.9, <4
|
|
25
24
|
Description-Content-Type: text/markdown
|
|
26
|
-
License-File: LICENSE-APACHE
|
|
27
25
|
License-File: LICENSE-MIT
|
|
26
|
+
License-File: LICENSE-APACHE
|
|
28
27
|
Requires-Dist: base58>=1.0.3
|
|
29
28
|
Requires-Dist: coincurve>=10.0.0
|
|
30
29
|
Requires-Dist: exceptiongroup>=1.2.0; python_version < "3.11"
|
|
@@ -39,8 +38,7 @@ Requires-Dist: pynacl>=1.3.0
|
|
|
39
38
|
Requires-Dist: rpcudp>=3.0.0
|
|
40
39
|
Requires-Dist: trio-typing>=0.0.4
|
|
41
40
|
Requires-Dist: trio>=0.26.0
|
|
42
|
-
Requires-Dist: fastecdsa
|
|
43
|
-
Requires-Dist: fastecdsa==1.7.5; sys_platform != "win32"
|
|
41
|
+
Requires-Dist: fastecdsa==1.7.5
|
|
44
42
|
Provides-Extra: dev
|
|
45
43
|
Requires-Dist: build>=0.9.0; extra == "dev"
|
|
46
44
|
Requires-Dist: bump_my_version>=0.19.0; extra == "dev"
|
|
@@ -91,14 +89,11 @@ Dynamic: summary
|
|
|
91
89
|
|
|
92
90
|
<h3 align="center">The Python implementation of the libp2p networking stack.</h3>
|
|
93
91
|
|
|
94
|
-
[](https://circleci.com/gh/libp2p/py-libp2p)
|
|
92
|
+
[](https://discord.gg/hQJnbd85N6)
|
|
96
93
|
[](https://badge.fury.io/py/libp2p)
|
|
97
94
|
[](https://pypi.python.org/pypi/libp2p)
|
|
95
|
+
[](https://github.com/libp2p/py-libp2p/actions/workflows/tox.yml)
|
|
98
96
|
[](http://py-libp2p.readthedocs.io/en/latest/?badge=latest)
|
|
99
|
-
[](https://webchat.freenode.net/?channels=%23libp2p)
|
|
100
|
-
[](https://riot.permaweb.io/#/room/#libp2p:permaweb.io)
|
|
101
|
-
[](https://discord.gg/66KBrm2)
|
|
102
97
|
|
|
103
98
|
> ⚠️ **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
99
|
|
|
@@ -194,10 +189,11 @@ ______________________________________________________________________
|
|
|
194
189
|
|
|
195
190
|
### General Purpose Utilities & Datatypes
|
|
196
191
|
|
|
197
|
-
| **Utility/Datatype**
|
|
198
|
-
|
|
|
199
|
-
| **`libp2p-ping`**
|
|
200
|
-
| **`libp2p-peer`**
|
|
192
|
+
| **Utility/Datatype** | **Status** | **Source** |
|
|
193
|
+
| --------------------- | :--------: | :------------------------------------------------------------------------------------------: |
|
|
194
|
+
| **`libp2p-ping`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/host/ping.py) |
|
|
195
|
+
| **`libp2p-peer`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/peer) |
|
|
196
|
+
| **`libp2p-identify`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/identity/identify/identify.py) |
|
|
201
197
|
|
|
202
198
|
______________________________________________________________________
|
|
203
199
|
|
|
@@ -11,16 +11,11 @@ pynacl>=1.3.0
|
|
|
11
11
|
rpcudp>=3.0.0
|
|
12
12
|
trio-typing>=0.0.4
|
|
13
13
|
trio>=0.26.0
|
|
14
|
+
fastecdsa==1.7.5
|
|
14
15
|
|
|
15
16
|
[:python_version < "3.11"]
|
|
16
17
|
exceptiongroup>=1.2.0
|
|
17
18
|
|
|
18
|
-
[:sys_platform != "win32"]
|
|
19
|
-
fastecdsa==1.7.5
|
|
20
|
-
|
|
21
|
-
[:sys_platform == "win32"]
|
|
22
|
-
fastecdsa-any==1.7.5
|
|
23
|
-
|
|
24
19
|
[dev]
|
|
25
20
|
build>=0.9.0
|
|
26
21
|
bump_my_version>=0.19.0
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
-
import
|
|
2
|
+
import sys
|
|
3
3
|
|
|
4
4
|
from setuptools import (
|
|
5
5
|
find_packages,
|
|
6
6
|
setup,
|
|
7
7
|
)
|
|
8
8
|
|
|
9
|
+
description = "libp2p: The Python implementation of the libp2p networking stack"
|
|
10
|
+
|
|
11
|
+
# Platform-specific dependencies
|
|
12
|
+
if sys.platform == "win32":
|
|
13
|
+
crypto_requires = [] # We'll use coincurve instead of fastecdsa on Windows
|
|
14
|
+
else:
|
|
15
|
+
crypto_requires = ["fastecdsa==1.7.5"]
|
|
16
|
+
|
|
9
17
|
extras_require = {
|
|
10
18
|
"dev": [
|
|
11
19
|
"build>=0.9.0",
|
|
@@ -35,23 +43,11 @@ extras_require["dev"] = (
|
|
|
35
43
|
extras_require["dev"] + extras_require["docs"] + extras_require["test"]
|
|
36
44
|
)
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
# See the following issues for more information;
|
|
44
|
-
# https://github.com/libp2p/py-libp2p/issues/363
|
|
45
|
-
# https://github.com/AntonKueltz/fastecdsa/issues/11
|
|
46
|
-
"fastecdsa-any==1.7.5;sys_platform=='win32'",
|
|
47
|
-
# Wheels are provided for these platforms, or compiling one is minimally frustrating in a
|
|
48
|
-
# default python installation.
|
|
49
|
-
"fastecdsa==1.7.5;sys_platform!='win32'",
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
with open("./README.md") as readme:
|
|
53
|
-
long_description = readme.read()
|
|
54
|
-
|
|
46
|
+
try:
|
|
47
|
+
with open("./README.md", encoding="utf-8") as readme:
|
|
48
|
+
long_description = readme.read()
|
|
49
|
+
except FileNotFoundError:
|
|
50
|
+
long_description = description
|
|
55
51
|
|
|
56
52
|
install_requires = [
|
|
57
53
|
"base58>=1.0.3",
|
|
@@ -70,19 +66,14 @@ install_requires = [
|
|
|
70
66
|
"trio>=0.26.0",
|
|
71
67
|
]
|
|
72
68
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# RTD system so we have to exclude these dependencies when we are in an RTD environment.
|
|
76
|
-
readthedocs_is_building = os.environ.get("READTHEDOCS", False)
|
|
77
|
-
if not readthedocs_is_building:
|
|
78
|
-
install_requires.extend(fastecdsa)
|
|
79
|
-
|
|
69
|
+
# Add platform-specific dependencies
|
|
70
|
+
install_requires.extend(crypto_requires)
|
|
80
71
|
|
|
81
72
|
setup(
|
|
82
73
|
name="libp2p",
|
|
83
74
|
# *IMPORTANT*: Don't manually change the version here. See Contributing docs for the release process.
|
|
84
|
-
version="0.2.
|
|
85
|
-
description=
|
|
75
|
+
version="0.2.5",
|
|
76
|
+
description=description,
|
|
86
77
|
long_description=long_description,
|
|
87
78
|
long_description_content_type="text/markdown",
|
|
88
79
|
author="The Ethereum Foundation",
|
|
@@ -93,7 +84,8 @@ setup(
|
|
|
93
84
|
python_requires=">=3.9, <4",
|
|
94
85
|
extras_require=extras_require,
|
|
95
86
|
py_modules=["libp2p"],
|
|
96
|
-
license="MIT
|
|
87
|
+
license="MIT AND Apache-2.0",
|
|
88
|
+
license_files=("LICENSE-MIT", "LICENSE-APACHE"),
|
|
97
89
|
zip_safe=False,
|
|
98
90
|
keywords="libp2p p2p",
|
|
99
91
|
packages=find_packages(exclude=["scripts", "scripts.*", "tests", "tests.*"]),
|
|
@@ -101,8 +93,6 @@ setup(
|
|
|
101
93
|
classifiers=[
|
|
102
94
|
"Development Status :: 4 - Beta",
|
|
103
95
|
"Intended Audience :: Developers",
|
|
104
|
-
"License :: OSI Approved :: MIT License",
|
|
105
|
-
"License :: OSI Approved :: Apache Software License",
|
|
106
96
|
"Natural Language :: English",
|
|
107
97
|
"Programming Language :: Python :: 3",
|
|
108
98
|
"Programming Language :: Python :: 3.9",
|
|
@@ -111,13 +101,14 @@ setup(
|
|
|
111
101
|
"Programming Language :: Python :: 3.12",
|
|
112
102
|
"Programming Language :: Python :: 3.13",
|
|
113
103
|
],
|
|
114
|
-
platforms=["unix", "linux", "osx"],
|
|
104
|
+
platforms=["unix", "linux", "osx", "win32"],
|
|
115
105
|
entry_points={
|
|
116
106
|
"console_scripts": [
|
|
117
107
|
"chat-demo=examples.chat.chat:main",
|
|
118
108
|
"echo-demo=examples.echo.echo:main",
|
|
119
109
|
"ping-demo=examples.ping.ping:main",
|
|
120
110
|
"identify-demo=examples.identify.identify:main",
|
|
111
|
+
"pubsub-demo=examples.pubsub.pubsub:main",
|
|
121
112
|
],
|
|
122
113
|
},
|
|
123
114
|
)
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
import trio
|
|
3
3
|
|
|
4
|
+
from libp2p.custom_types import (
|
|
5
|
+
TProtocol,
|
|
6
|
+
)
|
|
4
7
|
from libp2p.host.exceptions import (
|
|
5
8
|
StreamFailure,
|
|
6
9
|
)
|
|
7
10
|
from libp2p.peer.peerinfo import (
|
|
8
11
|
info_from_p2p_addr,
|
|
9
12
|
)
|
|
13
|
+
from libp2p.pubsub.gossipsub import (
|
|
14
|
+
GossipSub,
|
|
15
|
+
)
|
|
16
|
+
from libp2p.pubsub.pubsub import (
|
|
17
|
+
Pubsub,
|
|
18
|
+
)
|
|
19
|
+
from libp2p.tools.async_service.trio_service import (
|
|
20
|
+
background_trio_service,
|
|
21
|
+
)
|
|
10
22
|
from libp2p.tools.utils import (
|
|
11
23
|
MAX_READ_LEN,
|
|
12
24
|
)
|
|
@@ -17,6 +29,8 @@ from tests.utils.factories import (
|
|
|
17
29
|
CHAT_PROTOCOL_ID = "/chat/1.0.0"
|
|
18
30
|
ECHO_PROTOCOL_ID = "/echo/1.0.0"
|
|
19
31
|
PING_PROTOCOL_ID = "/ipfs/ping/1.0.0"
|
|
32
|
+
GOSSIPSUB_PROTOCOL_ID = TProtocol("/meshsub/1.0.0")
|
|
33
|
+
PUBSUB_TEST_TOPIC = "test-pubsub-topic"
|
|
20
34
|
|
|
21
35
|
|
|
22
36
|
async def hello_world(host_a, host_b):
|
|
@@ -185,6 +199,53 @@ async def ping_demo(host_a, host_b):
|
|
|
185
199
|
assert response == ping_data
|
|
186
200
|
|
|
187
201
|
|
|
202
|
+
async def pubsub_demo(host_a, host_b):
|
|
203
|
+
gossipsub_a = GossipSub([GOSSIPSUB_PROTOCOL_ID], 3, 2, 4, 0.1, 1)
|
|
204
|
+
gossipsub_b = GossipSub([GOSSIPSUB_PROTOCOL_ID], 3, 2, 4, 0.1, 1)
|
|
205
|
+
pubsub_a = Pubsub(host_a, gossipsub_a)
|
|
206
|
+
pubsub_b = Pubsub(host_b, gossipsub_b)
|
|
207
|
+
message_a_to_b = "Hello from A to B"
|
|
208
|
+
b_received = trio.Event()
|
|
209
|
+
received_by_b = None
|
|
210
|
+
|
|
211
|
+
async def handle_subscription_b(subscription):
|
|
212
|
+
nonlocal received_by_b
|
|
213
|
+
message = await subscription.get()
|
|
214
|
+
received_by_b = message.data.decode("utf-8")
|
|
215
|
+
print(f"Host B received: {received_by_b}")
|
|
216
|
+
b_received.set()
|
|
217
|
+
|
|
218
|
+
async with background_trio_service(pubsub_a):
|
|
219
|
+
async with background_trio_service(pubsub_b):
|
|
220
|
+
async with background_trio_service(gossipsub_a):
|
|
221
|
+
async with background_trio_service(gossipsub_b):
|
|
222
|
+
await pubsub_a.wait_until_ready()
|
|
223
|
+
await pubsub_b.wait_until_ready()
|
|
224
|
+
|
|
225
|
+
listen_addrs_b = host_b.get_addrs()
|
|
226
|
+
peer_info_b = info_from_p2p_addr(listen_addrs_b[0])
|
|
227
|
+
try:
|
|
228
|
+
await pubsub_a.host.connect(peer_info_b)
|
|
229
|
+
print("Connection attempt completed")
|
|
230
|
+
except Exception as e:
|
|
231
|
+
print(f"Connection error: {e}")
|
|
232
|
+
raise
|
|
233
|
+
|
|
234
|
+
subscription_b = await pubsub_b.subscribe(PUBSUB_TEST_TOPIC)
|
|
235
|
+
async with trio.open_nursery() as nursery:
|
|
236
|
+
nursery.start_soon(handle_subscription_b, subscription_b)
|
|
237
|
+
await trio.sleep(0.1)
|
|
238
|
+
await pubsub_a.publish(
|
|
239
|
+
PUBSUB_TEST_TOPIC, message_a_to_b.encode()
|
|
240
|
+
)
|
|
241
|
+
with trio.move_on_after(3):
|
|
242
|
+
await b_received.wait()
|
|
243
|
+
nursery.cancel_scope.cancel()
|
|
244
|
+
|
|
245
|
+
assert received_by_b == message_a_to_b
|
|
246
|
+
assert b_received.is_set()
|
|
247
|
+
|
|
248
|
+
|
|
188
249
|
@pytest.mark.parametrize(
|
|
189
250
|
"test",
|
|
190
251
|
[
|
|
@@ -195,6 +256,7 @@ async def ping_demo(host_a, host_b):
|
|
|
195
256
|
chat_demo,
|
|
196
257
|
echo_demo,
|
|
197
258
|
ping_demo,
|
|
259
|
+
pubsub_demo,
|
|
198
260
|
],
|
|
199
261
|
)
|
|
200
262
|
@pytest.mark.trio
|
|
@@ -203,8 +265,9 @@ async def test_protocols(test, security_protocol):
|
|
|
203
265
|
async with HostFactory.create_batch_and_listen(
|
|
204
266
|
2, security_protocol=security_protocol
|
|
205
267
|
) as hosts:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
268
|
+
if test != pubsub_demo:
|
|
269
|
+
addr = hosts[0].get_addrs()[0]
|
|
270
|
+
info = info_from_p2p_addr(addr)
|
|
271
|
+
await hosts[1].connect(info)
|
|
209
272
|
|
|
210
273
|
await test(hosts[0], hosts[1])
|
|
@@ -31,16 +31,17 @@ async def test_simple_last_seen_cache():
|
|
|
31
31
|
"""Test that LastSeenCache correctly refreshes expiry when accessed."""
|
|
32
32
|
cache = LastSeenCache(ttl=2, sweep_interval=1)
|
|
33
33
|
|
|
34
|
-
assert cache.add(MSG_1) is True
|
|
35
|
-
assert cache.has(MSG_1) is True
|
|
34
|
+
assert cache.add(MSG_1) is True
|
|
35
|
+
assert cache.has(MSG_1) is True
|
|
36
36
|
|
|
37
|
-
await trio.sleep(
|
|
38
|
-
assert cache.has(MSG_1) is True # Accessing should extend TTL
|
|
37
|
+
await trio.sleep(2.5) # Wait past TTL
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
# Retry loop to ensure sweep happens
|
|
40
|
+
for _ in range(10): # Up to 1 second extra
|
|
41
|
+
if not cache.has(MSG_1):
|
|
42
|
+
break
|
|
43
|
+
await trio.sleep(0.1)
|
|
42
44
|
|
|
43
|
-
await trio.sleep(2.5) # Now let it expire
|
|
44
45
|
assert cache.has(MSG_1) is False # Should be expired
|
|
45
46
|
|
|
46
47
|
cache.stop()
|