libp2p 0.2.8__tar.gz → 0.3.0__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.8/libp2p.egg-info → libp2p-0.3.0}/PKG-INFO +40 -34
- {libp2p-0.2.8 → libp2p-0.3.0}/README.md +26 -26
- libp2p-0.3.0/examples/advanced/network_discover.py +90 -0
- libp2p-0.3.0/examples/bootstrap/bootstrap.py +158 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/chat/chat.py +33 -6
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/doc-examples/example_encryption_insecure.py +15 -7
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/doc-examples/example_encryption_noise.py +9 -4
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/doc-examples/example_encryption_secio.py +9 -4
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/doc-examples/example_multiplexer.py +9 -4
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/doc-examples/example_net_stream.py +12 -4
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/doc-examples/example_peer_discovery.py +11 -5
- libp2p-0.3.0/examples/doc-examples/example_quic_transport.py +49 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/doc-examples/example_running.py +9 -4
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/doc-examples/example_transport.py +9 -4
- libp2p-0.3.0/examples/doc-examples/multiple_connections_example.py +210 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/echo/echo.py +51 -17
- libp2p-0.3.0/examples/echo/echo_quic.py +207 -0
- libp2p-0.3.0/examples/identify/identify.py +326 -0
- libp2p-0.3.0/examples/identify_push/identify_push_demo.py +312 -0
- libp2p-0.3.0/examples/identify_push/identify_push_listener_dialer.py +455 -0
- libp2p-0.3.0/examples/kademlia/kademlia.py +321 -0
- libp2p-0.3.0/examples/mDNS/mDNS.py +90 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/ping/ping.py +34 -7
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/pubsub/pubsub.py +26 -21
- libp2p-0.3.0/examples/random_walk/random_walk.py +228 -0
- libp2p-0.3.0/examples/test_tcp_data_transfer.py +446 -0
- libp2p-0.3.0/examples/transport_integration_demo.py +210 -0
- libp2p-0.3.0/examples/websocket/test_tcp_echo.py +220 -0
- libp2p-0.3.0/examples/websocket/test_websocket_transport.py +145 -0
- libp2p-0.3.0/examples/websocket/websocket_demo.py +448 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/__init__.py +113 -18
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/abc.py +943 -113
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/pb/crypto_pb2.py +2 -2
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/pb/crypto_pb2.pyi +2 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/custom_types.py +9 -6
- libp2p-0.3.0/libp2p/discovery/bootstrap/__init__.py +5 -0
- libp2p-0.3.0/libp2p/discovery/bootstrap/bootstrap.py +312 -0
- libp2p-0.3.0/libp2p/discovery/bootstrap/utils.py +51 -0
- libp2p-0.3.0/libp2p/discovery/events/peerDiscovery.py +26 -0
- libp2p-0.3.0/libp2p/discovery/mdns/broadcaster.py +91 -0
- libp2p-0.3.0/libp2p/discovery/mdns/listener.py +83 -0
- libp2p-0.3.0/libp2p/discovery/mdns/mdns.py +73 -0
- libp2p-0.3.0/libp2p/discovery/mdns/utils.py +11 -0
- libp2p-0.3.0/libp2p/discovery/random_walk/__init__.py +17 -0
- libp2p-0.3.0/libp2p/discovery/random_walk/config.py +16 -0
- libp2p-0.3.0/libp2p/discovery/random_walk/exceptions.py +19 -0
- libp2p-0.3.0/libp2p/discovery/random_walk/random_walk.py +218 -0
- libp2p-0.3.0/libp2p/discovery/random_walk/rt_refresh_manager.py +208 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/basic_host.py +61 -8
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/defaults.py +4 -1
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/routed_host.py +8 -2
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/identity/identify/identify.py +64 -3
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/identity/identify/pb/identify_pb2.py +2 -2
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/identity/identify/pb/identify_pb2.pyi +5 -2
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/identity/identify_push/identify_push.py +111 -33
- libp2p-0.3.0/libp2p/kad_dht/__init__.py +30 -0
- libp2p-0.3.0/libp2p/kad_dht/common.py +14 -0
- libp2p-0.3.0/libp2p/kad_dht/kad_dht.py +825 -0
- libp2p-0.3.0/libp2p/kad_dht/pb/kademlia_pb2.py +34 -0
- libp2p-0.3.0/libp2p/kad_dht/pb/kademlia_pb2.pyi +70 -0
- libp2p-0.3.0/libp2p/kad_dht/peer_routing.py +460 -0
- libp2p-0.3.0/libp2p/kad_dht/provider_store.py +612 -0
- libp2p-0.3.0/libp2p/kad_dht/routing_table.py +745 -0
- libp2p-0.3.0/libp2p/kad_dht/utils.py +197 -0
- libp2p-0.3.0/libp2p/kad_dht/value_store.py +416 -0
- libp2p-0.3.0/libp2p/network/config.py +70 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/network/connection/swarm_connection.py +36 -1
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/network/stream/net_stream.py +8 -2
- libp2p-0.3.0/libp2p/network/swarm.py +787 -0
- libp2p-0.3.0/libp2p/peer/envelope.py +276 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/peer/id.py +8 -9
- libp2p-0.3.0/libp2p/peer/pb/crypto_pb2.py +31 -0
- libp2p-0.3.0/libp2p/peer/pb/crypto_pb2.pyi +33 -0
- libp2p-0.3.0/libp2p/peer/pb/envelope_pb2.py +28 -0
- libp2p-0.3.0/libp2p/peer/pb/envelope_pb2.pyi +18 -0
- libp2p-0.3.0/libp2p/peer/pb/peer_record_pb2.py +29 -0
- libp2p-0.3.0/libp2p/peer/pb/peer_record_pb2.pyi +21 -0
- libp2p-0.3.0/libp2p/peer/peer_record.py +251 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/peer/peerdata.py +80 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/peer/peerinfo.py +22 -1
- libp2p-0.3.0/libp2p/peer/peerstore.py +578 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/protocol_muxer/multiselect.py +53 -30
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/protocol_muxer/multiselect_client.py +54 -28
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/protocol_muxer/multiselect_communicator.py +8 -2
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/pubsub/floodsub.py +7 -13
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/pubsub/gossipsub.py +292 -120
- libp2p-0.3.0/libp2p/pubsub/pb/rpc_pb2.py +52 -0
- libp2p-0.3.0/libp2p/pubsub/pb/rpc_pb2.pyi +132 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/pubsub/pubsub.py +103 -16
- libp2p-0.3.0/libp2p/pubsub/utils.py +80 -0
- libp2p-0.3.0/libp2p/relay/__init__.py +37 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/__init__.py +46 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/config.py +182 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/dcutr.py +596 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/discovery.py +549 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/nat.py +300 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/pb/__init__.py +21 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/pb/circuit_pb2.py +39 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/pb/circuit_pb2.pyi +184 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/pb/dcutr_pb2.py +27 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/pb/dcutr_pb2.pyi +53 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/protocol.py +854 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/protocol_buffer.py +55 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/resources.py +276 -0
- libp2p-0.3.0/libp2p/relay/circuit_v2/transport.py +429 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/insecure/transport.py +32 -3
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/noise/io.py +14 -3
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/noise/messages.py +29 -1
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/noise/patterns.py +35 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/noise/transport.py +0 -5
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/security_multistream.py +8 -1
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/mplex/mplex_stream.py +63 -52
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/muxer_multistream.py +21 -8
- libp2p-0.3.0/libp2p/stream_muxer/rw_lock.py +70 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/yamux/yamux.py +222 -146
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/constants.py +5 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/utils.py +4 -2
- libp2p-0.3.0/libp2p/transport/__init__.py +57 -0
- libp2p-0.3.0/libp2p/transport/quic/config.py +345 -0
- libp2p-0.3.0/libp2p/transport/quic/connection.py +1489 -0
- libp2p-0.3.0/libp2p/transport/quic/exceptions.py +391 -0
- libp2p-0.3.0/libp2p/transport/quic/listener.py +1041 -0
- libp2p-0.3.0/libp2p/transport/quic/security.py +1165 -0
- libp2p-0.3.0/libp2p/transport/quic/stream.py +656 -0
- libp2p-0.3.0/libp2p/transport/quic/transport.py +491 -0
- libp2p-0.3.0/libp2p/transport/quic/utils.py +466 -0
- libp2p-0.3.0/libp2p/transport/transport_registry.py +267 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/transport/upgrader.py +13 -8
- libp2p-0.3.0/libp2p/transport/websocket/connection.py +198 -0
- libp2p-0.3.0/libp2p/transport/websocket/listener.py +225 -0
- libp2p-0.3.0/libp2p/transport/websocket/multiaddr_utils.py +202 -0
- libp2p-0.3.0/libp2p/transport/websocket/transport.py +229 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/utils/__init__.py +17 -0
- libp2p-0.3.0/libp2p/utils/address_validation.py +160 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/utils/logging.py +24 -12
- libp2p-0.3.0/libp2p/utils/paths.py +267 -0
- libp2p-0.3.0/libp2p/utils/varint.py +232 -0
- {libp2p-0.2.8 → libp2p-0.3.0/libp2p.egg-info}/PKG-INFO +40 -34
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p.egg-info/SOURCES.txt +156 -1
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p.egg-info/entry_points.txt +2 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p.egg-info/requires.txt +11 -5
- {libp2p-0.2.8 → libp2p-0.3.0}/pyproject.toml +21 -11
- libp2p-0.3.0/scripts/audit_paths.py +255 -0
- libp2p-0.3.0/tests/__init__.py +0 -0
- libp2p-0.3.0/tests/core/host/test_basic_host.py +61 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/host/test_live_peers.py +2 -2
- libp2p-0.3.0/tests/core/identity/identify/test_identify.py +99 -0
- libp2p-0.3.0/tests/core/identity/identify/test_identify_integration.py +241 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/identity/identify_push/test_identify_push.py +286 -0
- libp2p-0.3.0/tests/core/identity/identify_push/test_identify_push_integration.py +552 -0
- libp2p-0.3.0/tests/core/kad_dht/test_kad_dht.py +504 -0
- libp2p-0.3.0/tests/core/kad_dht/test_unit_peer_routing.py +461 -0
- libp2p-0.3.0/tests/core/kad_dht/test_unit_provider_store.py +805 -0
- libp2p-0.3.0/tests/core/kad_dht/test_unit_routing_table.py +397 -0
- libp2p-0.3.0/tests/core/kad_dht/test_unit_value_store.py +504 -0
- libp2p-0.3.0/tests/core/network/test_enhanced_swarm.py +325 -0
- libp2p-0.3.0/tests/core/network/test_notifee_performance.py +82 -0
- libp2p-0.3.0/tests/core/network/test_notify.py +297 -0
- libp2p-0.3.0/tests/core/network/test_notify_listen_lifecycle.py +76 -0
- libp2p-0.3.0/tests/core/network/test_swarm.py +372 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/peer/test_addrbook.py +53 -0
- libp2p-0.3.0/tests/core/peer/test_envelope.py +129 -0
- libp2p-0.3.0/tests/core/peer/test_peer_record.py +112 -0
- libp2p-0.3.0/tests/core/peer/test_peerdata.py +241 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/peer/test_peerinfo.py +4 -5
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/peer/test_peerstore.py +58 -0
- libp2p-0.3.0/tests/core/protocol_muxer/test_negotiate_timeout.py +149 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/protocol_muxer/test_protocol_muxer.py +59 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/pubsub/test_gossipsub.py +428 -3
- libp2p-0.3.0/tests/core/pubsub/test_gossipsub_px_and_backoff.py +275 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/pubsub/test_pubsub.py +148 -5
- libp2p-0.3.0/tests/core/pubsub/test_pubsub_notifee_integration.py +90 -0
- libp2p-0.3.0/tests/core/relay/test_circuit_v2_discovery.py +443 -0
- libp2p-0.3.0/tests/core/relay/test_circuit_v2_protocol.py +665 -0
- libp2p-0.3.0/tests/core/relay/test_circuit_v2_transport.py +346 -0
- libp2p-0.3.0/tests/core/relay/test_dcutr_integration.py +563 -0
- libp2p-0.3.0/tests/core/relay/test_dcutr_protocol.py +208 -0
- libp2p-0.3.0/tests/core/relay/test_nat.py +297 -0
- libp2p-0.3.0/tests/core/security/test_insecure_peerstore_integration.py +314 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/security/test_security_multistream.py +27 -3
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/stream_muxer/test_mplex_stream.py +37 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/stream_muxer/test_multiplexer_selection.py +6 -3
- libp2p-0.3.0/tests/core/stream_muxer/test_muxer_multistream.py +108 -0
- libp2p-0.3.0/tests/core/stream_muxer/test_read_write_lock.py +590 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/stream_muxer/test_yamux.py +1 -1
- libp2p-0.3.0/tests/core/stream_muxer/test_yamux_interleaving.py +199 -0
- libp2p-0.3.0/tests/core/stream_muxer/test_yamux_interleaving_EOF.py +195 -0
- libp2p-0.3.0/tests/core/transport/quic/test_concurrency.py +0 -0
- libp2p-0.3.0/tests/core/transport/quic/test_connection.py +553 -0
- libp2p-0.3.0/tests/core/transport/quic/test_connection_id.py +624 -0
- libp2p-0.3.0/tests/core/transport/quic/test_integration.py +418 -0
- libp2p-0.3.0/tests/core/transport/quic/test_listener.py +150 -0
- libp2p-0.3.0/tests/core/transport/quic/test_transport.py +123 -0
- libp2p-0.3.0/tests/core/transport/quic/test_utils.py +321 -0
- libp2p-0.3.0/tests/core/transport/test_transport_registry.py +324 -0
- libp2p-0.3.0/tests/core/transport/test_upgrader.py +27 -0
- libp2p-0.3.0/tests/core/transport/test_websocket.py +1631 -0
- libp2p-0.3.0/tests/core/transport/test_websocket_p2p.py +532 -0
- libp2p-0.3.0/tests/core/utils/test_varint.py +215 -0
- libp2p-0.3.0/tests/discovery/__init__.py +1 -0
- libp2p-0.3.0/tests/discovery/bootstrap/__init__.py +1 -0
- libp2p-0.3.0/tests/discovery/bootstrap/test_integration.py +52 -0
- libp2p-0.3.0/tests/discovery/bootstrap/test_utils.py +39 -0
- libp2p-0.3.0/tests/discovery/mdns/__init__.py +0 -0
- libp2p-0.3.0/tests/discovery/mdns/test_broadcaster.py +91 -0
- libp2p-0.3.0/tests/discovery/mdns/test_listener.py +114 -0
- libp2p-0.3.0/tests/discovery/mdns/test_mdns.py +121 -0
- libp2p-0.3.0/tests/discovery/mdns/test_utils.py +39 -0
- libp2p-0.3.0/tests/discovery/random_walk/test_random_walk.py +99 -0
- libp2p-0.3.0/tests/discovery/random_walk/test_rt_refresh_manager.py +451 -0
- libp2p-0.3.0/tests/examples/test_echo_thin_waist.py +109 -0
- libp2p-0.3.0/tests/examples/test_examples_bind_address.py +117 -0
- libp2p-0.3.0/tests/examples/test_quic_echo_example.py +6 -0
- libp2p-0.3.0/tests/interop/__init__.py +0 -0
- libp2p-0.3.0/tests/interop/js_libp2p/README.md +81 -0
- libp2p-0.3.0/tests/interop/js_libp2p/js_node/README.md +53 -0
- libp2p-0.3.0/tests/interop/js_libp2p/js_node/package.json +39 -0
- libp2p-0.3.0/tests/interop/js_libp2p/js_node/src/package.json +21 -0
- libp2p-0.3.0/tests/interop/js_libp2p/js_node/src/ping.js +204 -0
- libp2p-0.3.0/tests/interop/js_libp2p/js_node/src/ping_client.js +241 -0
- libp2p-0.3.0/tests/interop/js_libp2p/js_node/src/ping_server.js +167 -0
- libp2p-0.3.0/tests/interop/js_libp2p/js_node/src/ws_ping_node.mjs +122 -0
- libp2p-0.3.0/tests/interop/js_libp2p/scripts/run_test.ps1 +194 -0
- libp2p-0.3.0/tests/interop/js_libp2p/scripts/run_test.sh +215 -0
- libp2p-0.3.0/tests/interop/nim_libp2p/.gitignore +8 -0
- libp2p-0.3.0/tests/interop/nim_libp2p/conftest.py +119 -0
- libp2p-0.3.0/tests/interop/nim_libp2p/nim_echo_server.nim +108 -0
- libp2p-0.3.0/tests/interop/nim_libp2p/scripts/setup_nim_echo.sh +74 -0
- libp2p-0.3.0/tests/interop/nim_libp2p/test_echo_interop.py +195 -0
- libp2p-0.3.0/tests/interop/test_js_ws_ping.py +127 -0
- libp2p-0.3.0/tests/utils/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/factories.py +20 -4
- libp2p-0.3.0/tests/utils/interop/__init__.py +0 -0
- libp2p-0.3.0/tests/utils/pubsub/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/pubsub/floodsub_integration_test_settings.py +3 -9
- libp2p-0.3.0/tests/utils/pubsub/utils.py +87 -0
- libp2p-0.3.0/tests/utils/test_address_validation.py +56 -0
- libp2p-0.3.0/tests/utils/test_default_bind_address.py +206 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/test_logging.py +36 -12
- libp2p-0.3.0/tests/utils/test_paths.py +290 -0
- libp2p-0.3.0/tests/utils/utils.py +31 -0
- libp2p-0.2.8/examples/identify/identify.py +0 -127
- libp2p-0.2.8/examples/identify_push/identify_push_demo.py +0 -163
- libp2p-0.2.8/examples/identify_push/identify_push_listener_dialer.py +0 -276
- libp2p-0.2.8/libp2p/network/swarm.py +0 -420
- libp2p-0.2.8/libp2p/peer/peerstore.py +0 -244
- libp2p-0.2.8/libp2p/pubsub/pb/rpc_pb2.py +0 -49
- libp2p-0.2.8/libp2p/pubsub/pb/rpc_pb2.pyi +0 -297
- libp2p-0.2.8/libp2p/utils/varint.py +0 -87
- libp2p-0.2.8/tests/core/host/test_basic_host.py +0 -24
- libp2p-0.2.8/tests/core/identity/identify/test_identify.py +0 -79
- libp2p-0.2.8/tests/core/network/test_notify.py +0 -130
- libp2p-0.2.8/tests/core/network/test_swarm.py +0 -186
- libp2p-0.2.8/tests/core/peer/test_peerdata.py +0 -109
- libp2p-0.2.8/tests/interop/js_libp2p/test_js_basic.py +0 -5
- libp2p-0.2.8/tests/utils/pubsub/utils.py +0 -42
- {libp2p-0.2.8 → libp2p-0.3.0}/LICENSE-APACHE +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/LICENSE-MIT +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/MANIFEST.in +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/docs/conf.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/chat/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/echo/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/identify/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/identify_push/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/examples/ping/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/authenticated_encryption.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/ecc.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/ed25519.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/exceptions.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/key_exchange.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/keys.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/pb/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/rsa.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/secp256k1.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/serialization.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/crypto/x25519.py +0 -0
- {libp2p-0.2.8/libp2p/host → libp2p-0.3.0/libp2p/discovery}/__init__.py +0 -0
- {libp2p-0.2.8/libp2p/host/autonat/pb → libp2p-0.3.0/libp2p/discovery/events}/__init__.py +0 -0
- {libp2p-0.2.8/libp2p/identity/identify/pb → libp2p-0.3.0/libp2p/discovery/mdns}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/exceptions.py +0 -0
- {libp2p-0.2.8/libp2p/io → libp2p-0.3.0/libp2p/host}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/autonat/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/autonat/autonat.py +0 -0
- {libp2p-0.2.8/libp2p/network → libp2p-0.3.0/libp2p/host/autonat/pb}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/autonat/pb/autonat_pb2.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/autonat/pb/autonat_pb2.pyi +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/autonat/pb/autonat_pb2_grpc.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/autonat/pb/autonat_pb2_grpc.pyi +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/autonat/pb/generate_proto.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/exceptions.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/host/ping.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/identity/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/identity/identify/__init__.py +0 -0
- {libp2p-0.2.8/libp2p/network/connection → libp2p-0.3.0/libp2p/identity/identify/pb}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/identity/identify_push/__init__.py +0 -0
- {libp2p-0.2.8/libp2p/network/stream → libp2p-0.3.0/libp2p/io}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/io/abc.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/io/exceptions.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/io/msgio.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/io/trio.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/io/utils.py +0 -0
- {libp2p-0.2.8/libp2p/peer → libp2p-0.3.0/libp2p/kad_dht/pb}/__init__.py +0 -0
- {libp2p-0.2.8/libp2p/protocol_muxer → libp2p-0.3.0/libp2p/network}/__init__.py +0 -0
- {libp2p-0.2.8/libp2p/pubsub → libp2p-0.3.0/libp2p/network/connection}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/network/connection/exceptions.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/network/connection/raw_connection.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/network/exceptions.py +0 -0
- {libp2p-0.2.8/libp2p/pubsub/pb → libp2p-0.3.0/libp2p/network/stream}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/network/stream/exceptions.py +0 -0
- {libp2p-0.2.8/libp2p/security → libp2p-0.3.0/libp2p/peer}/__init__.py +0 -0
- {libp2p-0.2.8/libp2p/security/insecure → libp2p-0.3.0/libp2p/protocol_muxer}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/protocol_muxer/exceptions.py +0 -0
- {libp2p-0.2.8/libp2p/security/insecure/pb → libp2p-0.3.0/libp2p/pubsub}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/pubsub/exceptions.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/pubsub/mcache.py +0 -0
- {libp2p-0.2.8/libp2p/security/noise → libp2p-0.3.0/libp2p/pubsub/pb}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/pubsub/pubsub_notifee.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/pubsub/subscription.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/pubsub/validators.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/py.typed +0 -0
- {libp2p-0.2.8/libp2p/security/noise/pb → libp2p-0.3.0/libp2p/security}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/base_session.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/base_transport.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/exceptions.py +0 -0
- {libp2p-0.2.8/libp2p/security/secio → libp2p-0.3.0/libp2p/security/insecure}/__init__.py +0 -0
- {libp2p-0.2.8/libp2p/security/secio → libp2p-0.3.0/libp2p/security/insecure}/pb/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/insecure/pb/plaintext_pb2.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/insecure/pb/plaintext_pb2.pyi +0 -0
- {libp2p-0.2.8/libp2p/stream_muxer → libp2p-0.3.0/libp2p/security/noise}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/noise/exceptions.py +0 -0
- {libp2p-0.2.8/libp2p/stream_muxer/mplex → libp2p-0.3.0/libp2p/security/noise/pb}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/noise/pb/noise_pb2.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/noise/pb/noise_pb2.pyi +0 -0
- {libp2p-0.2.8/libp2p/tools → libp2p-0.3.0/libp2p/security/secio}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/secio/exceptions.py +0 -0
- {libp2p-0.2.8/libp2p/tools/timed_cache → libp2p-0.3.0/libp2p/security/secio/pb}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/secio/pb/spipe_pb2.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/secio/pb/spipe_pb2.pyi +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/secio/transport.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/security/secure_session.py +0 -0
- {libp2p-0.2.8/libp2p/transport → libp2p-0.3.0/libp2p/stream_muxer}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/exceptions.py +0 -0
- {libp2p-0.2.8/libp2p/transport/tcp → libp2p-0.3.0/libp2p/stream_muxer/mplex}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/mplex/constants.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/mplex/datastructures.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/mplex/exceptions.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/mplex/mplex.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/stream_muxer/yamux/__init__.py +0 -0
- {libp2p-0.2.8/tests → libp2p-0.3.0/libp2p/tools}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/async_service/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/async_service/_utils.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/async_service/abc.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/async_service/base.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/async_service/exceptions.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/async_service/stats.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/async_service/trio_service.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/async_service/typing.py +0 -0
- {libp2p-0.2.8/tests/utils → libp2p-0.3.0/libp2p/tools/timed_cache}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/timed_cache/base_timed_cache.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/timed_cache/first_seen_cache.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/tools/timed_cache/last_seen_cache.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/transport/exceptions.py +0 -0
- {libp2p-0.2.8/tests/utils/interop → libp2p-0.3.0/libp2p/transport/quic}/__init__.py +0 -0
- {libp2p-0.2.8/tests/utils/pubsub → libp2p-0.3.0/libp2p/transport/tcp}/__init__.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/transport/tcp/tcp.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p/utils/version.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p.egg-info/dependency_links.txt +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/libp2p.egg-info/top_level.txt +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/newsfragments/validate_files.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/scripts/release/test_package.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/setup.cfg +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/conftest.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/crypto/test_ed25519.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/crypto/test_rsa.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/crypto/test_secp256k1.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/crypto/test_x25519.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/examples/test_examples.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/host/test_autonat.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/host/test_connected_peers.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/host/test_ping.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/host/test_routed_host.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/network/conftest.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/network/test_net_stream.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/network/test_swarm_conn.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/peer/test_interop.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/peer/test_peerid.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/peer/test_peermetadata.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/pubsub/test_dummyaccount_demo.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/pubsub/test_floodsub.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/pubsub/test_gossipsub_backward_compatibility.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/pubsub/test_gossipsub_direct_peers.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/pubsub/test_mcache.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/pubsub/test_subscription.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/security/noise/test_msg_read_writer.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/security/noise/test_noise.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/security/test_secio.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/stream_muxer/conftest.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/stream_muxer/test_async_context_manager.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/stream_muxer/test_mplex_conn.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/test_import_and_version.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/test_libp2p/test_libp2p.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/tools/async_service/test_trio_based_service.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/tools/async_service/test_trio_external_api.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/tools/async_service/test_trio_manager_stats.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/tools/timed_cache/test_timed_cache.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/core/transport/test_tcp.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/exceptions/test_exceptions.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/interop/go_libp2p/test_go_basic.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/interop/rust_libp2p/test_rust_basic.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/interop/zig_libp2p/test_zig_basic.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/interop/constants.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/interop/daemon.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/interop/envs.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/interop/process.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/interop/utils.py +0 -0
- {libp2p-0.2.8 → libp2p-0.3.0}/tests/utils/pubsub/dummy_account_node.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libp2p
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: libp2p: The Python implementation of the libp2p networking stack
|
|
5
|
-
|
|
5
|
+
Maintainer-email: pacrob <pacrob-py-libp2p@proton.me>, Manu Sheel Gupta <manu@seeta.in>, Dave Grantham <dwg@linuxprogrammer.org>
|
|
6
6
|
License: MIT AND Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/libp2p/py-libp2p
|
|
8
8
|
Keywords: libp2p,p2p
|
|
@@ -18,22 +18,25 @@ Requires-Python: <4.0,>=3.10
|
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE-APACHE
|
|
20
20
|
License-File: LICENSE-MIT
|
|
21
|
+
Requires-Dist: aioquic>=1.2.0
|
|
21
22
|
Requires-Dist: base58>=1.0.3
|
|
22
|
-
Requires-Dist: coincurve
|
|
23
|
+
Requires-Dist: coincurve==21.0.0
|
|
23
24
|
Requires-Dist: exceptiongroup>=1.2.0; python_version < "3.11"
|
|
25
|
+
Requires-Dist: fastecdsa==2.3.2; sys_platform != "win32"
|
|
24
26
|
Requires-Dist: grpcio>=1.41.0
|
|
25
27
|
Requires-Dist: lru-dict>=1.1.6
|
|
26
|
-
Requires-Dist: multiaddr>=0.0.
|
|
28
|
+
Requires-Dist: multiaddr>=0.0.11
|
|
27
29
|
Requires-Dist: mypy-protobuf>=3.0.0
|
|
28
30
|
Requires-Dist: noiseprotocol>=0.3.0
|
|
29
|
-
Requires-Dist: protobuf<
|
|
31
|
+
Requires-Dist: protobuf<5.0.0,>=4.25.0
|
|
30
32
|
Requires-Dist: pycryptodome>=3.9.2
|
|
31
33
|
Requires-Dist: pymultihash>=0.8.2
|
|
32
34
|
Requires-Dist: pynacl>=1.3.0
|
|
33
35
|
Requires-Dist: rpcudp>=3.0.0
|
|
34
36
|
Requires-Dist: trio-typing>=0.0.4
|
|
35
37
|
Requires-Dist: trio>=0.26.0
|
|
36
|
-
Requires-Dist:
|
|
38
|
+
Requires-Dist: trio-websocket>=0.11.0
|
|
39
|
+
Requires-Dist: zeroconf<0.148.0,>=0.147.0
|
|
37
40
|
Provides-Extra: dev
|
|
38
41
|
Requires-Dist: build>=0.9.0; extra == "dev"
|
|
39
42
|
Requires-Dist: bump_my_version>=0.19.0; extra == "dev"
|
|
@@ -51,6 +54,8 @@ Requires-Dist: p2pclient==0.2.0; extra == "dev"
|
|
|
51
54
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
52
55
|
Requires-Dist: pytest-xdist>=2.4.0; extra == "dev"
|
|
53
56
|
Requires-Dist: pytest-trio>=0.5.2; extra == "dev"
|
|
57
|
+
Requires-Dist: pytest-timeout>=2.4.0; extra == "dev"
|
|
58
|
+
Requires-Dist: pytest-rerunfailures>=12.0; extra == "dev"
|
|
54
59
|
Requires-Dist: factory-boy<3.0.0,>=2.12.0; extra == "dev"
|
|
55
60
|
Requires-Dist: ruff>=0.11.10; extra == "dev"
|
|
56
61
|
Requires-Dist: pyrefly<0.18.0,>=0.17.1; extra == "dev"
|
|
@@ -60,11 +65,12 @@ Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "docs"
|
|
|
60
65
|
Requires-Dist: towncrier<25,>=24; extra == "docs"
|
|
61
66
|
Requires-Dist: tomli; python_version < "3.11" and extra == "docs"
|
|
62
67
|
Provides-Extra: test
|
|
68
|
+
Requires-Dist: factory-boy<3.0.0,>=2.12.0; extra == "test"
|
|
63
69
|
Requires-Dist: p2pclient==0.2.0; extra == "test"
|
|
64
70
|
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
65
|
-
Requires-Dist: pytest-
|
|
71
|
+
Requires-Dist: pytest-timeout>=2.4.0; extra == "test"
|
|
66
72
|
Requires-Dist: pytest-trio>=0.5.2; extra == "test"
|
|
67
|
-
Requires-Dist:
|
|
73
|
+
Requires-Dist: pytest-xdist>=2.4.0; extra == "test"
|
|
68
74
|
Dynamic: license-file
|
|
69
75
|
|
|
70
76
|
# py-libp2p
|
|
@@ -81,13 +87,13 @@ Dynamic: license-file
|
|
|
81
87
|
[](https://github.com/libp2p/py-libp2p/actions/workflows/tox.yml)
|
|
82
88
|
[](http://py-libp2p.readthedocs.io/en/latest/?badge=latest)
|
|
83
89
|
|
|
84
|
-
>
|
|
90
|
+
> py-libp2p has moved beyond its experimental roots and is steadily progressing toward production readiness. The core features are stable, and we’re focused on refining performance, expanding protocol support, and ensuring smooth interop with other libp2p implementations. We welcome contributions and real-world usage feedback to help us reach full production maturity.
|
|
85
91
|
|
|
86
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).
|
|
87
93
|
|
|
88
94
|
## Maintainers
|
|
89
95
|
|
|
90
|
-
Currently maintained by [@pacrob](https://github.com/pacrob), [@seetadev](https://github.com/seetadev) and [@dhuseby](https://github.com/dhuseby)
|
|
96
|
+
Currently maintained by [@pacrob](https://github.com/pacrob), [@seetadev](https://github.com/seetadev) and [@dhuseby](https://github.com/dhuseby). Please reach out to us for collaboration or active feedback. If you have questions, feel free to open a new [discussion](https://github.com/libp2p/py-libp2p/discussions). We are also available on the libp2p Discord — join us at #py-libp2p [sub-channel](https://discord.gg/d92MEugb).
|
|
91
97
|
|
|
92
98
|
## Feature Breakdown
|
|
93
99
|
|
|
@@ -103,19 +109,19 @@ ______________________________________________________________________
|
|
|
103
109
|
| -------------------------------------- | :--------: | :---------------------------------------------------------------------------------: |
|
|
104
110
|
| **`libp2p-tcp`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/transport/tcp/tcp.py) |
|
|
105
111
|
| **`libp2p-quic`** | 🌱 | |
|
|
106
|
-
| **`libp2p-websocket`** |
|
|
107
|
-
| **`libp2p-webrtc-browser-to-server`** |
|
|
108
|
-
| **`libp2p-webrtc-private-to-private`** |
|
|
112
|
+
| **`libp2p-websocket`** | 🌱 | |
|
|
113
|
+
| **`libp2p-webrtc-browser-to-server`** | 🌱 | |
|
|
114
|
+
| **`libp2p-webrtc-private-to-private`** | 🌱 | |
|
|
109
115
|
|
|
110
116
|
______________________________________________________________________
|
|
111
117
|
|
|
112
118
|
### NAT Traversal
|
|
113
119
|
|
|
114
|
-
| **NAT Traversal** | **Status** |
|
|
115
|
-
| ----------------------------- | :--------: |
|
|
116
|
-
| **`libp2p-circuit-relay-v2`** |
|
|
117
|
-
| **`libp2p-autonat`** |
|
|
118
|
-
| **`libp2p-hole-punching`** |
|
|
120
|
+
| **NAT Traversal** | **Status** | **Source** |
|
|
121
|
+
| ----------------------------- | :--------: | :-----------------------------------------------------------------------------: |
|
|
122
|
+
| **`libp2p-circuit-relay-v2`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/relay/circuit_v2) |
|
|
123
|
+
| **`libp2p-autonat`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/host/autonat) |
|
|
124
|
+
| **`libp2p-hole-punching`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/relay/circuit_v2) |
|
|
119
125
|
|
|
120
126
|
______________________________________________________________________
|
|
121
127
|
|
|
@@ -123,27 +129,27 @@ ______________________________________________________________________
|
|
|
123
129
|
|
|
124
130
|
| **Secure Communication** | **Status** | **Source** |
|
|
125
131
|
| ------------------------ | :--------: | :---------------------------------------------------------------------------: |
|
|
126
|
-
| **`libp2p-noise`** |
|
|
127
|
-
| **`libp2p-tls`** |
|
|
132
|
+
| **`libp2p-noise`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/security/noise) |
|
|
133
|
+
| **`libp2p-tls`** | 🌱 | |
|
|
128
134
|
|
|
129
135
|
______________________________________________________________________
|
|
130
136
|
|
|
131
137
|
### Discovery
|
|
132
138
|
|
|
133
|
-
| **Discovery** | **Status** |
|
|
134
|
-
| -------------------- | :--------: |
|
|
135
|
-
| **`bootstrap`** |
|
|
136
|
-
| **`random-walk`** |
|
|
137
|
-
| **`mdns-discovery`** |
|
|
138
|
-
| **`rendezvous`** |
|
|
139
|
+
| **Discovery** | **Status** | **Source** |
|
|
140
|
+
| -------------------- | :--------: | :----------------------------------------------------------------------------------: |
|
|
141
|
+
| **`bootstrap`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/discovery/bootstrap) |
|
|
142
|
+
| **`random-walk`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/discovery/random_walk) |
|
|
143
|
+
| **`mdns-discovery`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/discovery/mdns) |
|
|
144
|
+
| **`rendezvous`** | 🌱 | |
|
|
139
145
|
|
|
140
146
|
______________________________________________________________________
|
|
141
147
|
|
|
142
148
|
### Peer Routing
|
|
143
149
|
|
|
144
|
-
| **Peer Routing** | **Status** |
|
|
145
|
-
| -------------------- | :--------: |
|
|
146
|
-
| **`libp2p-kad-dht`** |
|
|
150
|
+
| **Peer Routing** | **Status** | **Source** |
|
|
151
|
+
| -------------------- | :--------: | :--------------------------------------------------------------------: |
|
|
152
|
+
| **`libp2p-kad-dht`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/kad_dht) |
|
|
147
153
|
|
|
148
154
|
______________________________________________________________________
|
|
149
155
|
|
|
@@ -158,10 +164,10 @@ ______________________________________________________________________
|
|
|
158
164
|
|
|
159
165
|
### Stream Muxers
|
|
160
166
|
|
|
161
|
-
| **Stream Muxers** | **Status** |
|
|
162
|
-
| ------------------ | :--------: |
|
|
163
|
-
| **`libp2p-yamux`** |
|
|
164
|
-
| **`libp2p-mplex`** |
|
|
167
|
+
| **Stream Muxers** | **Status** | **Source** |
|
|
168
|
+
| ------------------ | :--------: | :-------------------------------------------------------------------------------: |
|
|
169
|
+
| **`libp2p-yamux`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/stream_muxer/yamux) |
|
|
170
|
+
| **`libp2p-mplex`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/stream_muxer/mplex) |
|
|
165
171
|
|
|
166
172
|
______________________________________________________________________
|
|
167
173
|
|
|
@@ -169,7 +175,7 @@ ______________________________________________________________________
|
|
|
169
175
|
|
|
170
176
|
| **Storage** | **Status** |
|
|
171
177
|
| ------------------- | :--------: |
|
|
172
|
-
| **`libp2p-record`** |
|
|
178
|
+
| **`libp2p-record`** | 🌱 |
|
|
173
179
|
|
|
174
180
|
______________________________________________________________________
|
|
175
181
|
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
[](https://github.com/libp2p/py-libp2p/actions/workflows/tox.yml)
|
|
13
13
|
[](http://py-libp2p.readthedocs.io/en/latest/?badge=latest)
|
|
14
14
|
|
|
15
|
-
>
|
|
15
|
+
> py-libp2p has moved beyond its experimental roots and is steadily progressing toward production readiness. The core features are stable, and we’re focused on refining performance, expanding protocol support, and ensuring smooth interop with other libp2p implementations. We welcome contributions and real-world usage feedback to help us reach full production maturity.
|
|
16
16
|
|
|
17
17
|
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).
|
|
18
18
|
|
|
19
19
|
## Maintainers
|
|
20
20
|
|
|
21
|
-
Currently maintained by [@pacrob](https://github.com/pacrob), [@seetadev](https://github.com/seetadev) and [@dhuseby](https://github.com/dhuseby)
|
|
21
|
+
Currently maintained by [@pacrob](https://github.com/pacrob), [@seetadev](https://github.com/seetadev) and [@dhuseby](https://github.com/dhuseby). Please reach out to us for collaboration or active feedback. If you have questions, feel free to open a new [discussion](https://github.com/libp2p/py-libp2p/discussions). We are also available on the libp2p Discord — join us at #py-libp2p [sub-channel](https://discord.gg/d92MEugb).
|
|
22
22
|
|
|
23
23
|
## Feature Breakdown
|
|
24
24
|
|
|
@@ -34,19 +34,19 @@ ______________________________________________________________________
|
|
|
34
34
|
| -------------------------------------- | :--------: | :---------------------------------------------------------------------------------: |
|
|
35
35
|
| **`libp2p-tcp`** | ✅ | [source](https://github.com/libp2p/py-libp2p/blob/main/libp2p/transport/tcp/tcp.py) |
|
|
36
36
|
| **`libp2p-quic`** | 🌱 | |
|
|
37
|
-
| **`libp2p-websocket`** |
|
|
38
|
-
| **`libp2p-webrtc-browser-to-server`** |
|
|
39
|
-
| **`libp2p-webrtc-private-to-private`** |
|
|
37
|
+
| **`libp2p-websocket`** | 🌱 | |
|
|
38
|
+
| **`libp2p-webrtc-browser-to-server`** | 🌱 | |
|
|
39
|
+
| **`libp2p-webrtc-private-to-private`** | 🌱 | |
|
|
40
40
|
|
|
41
41
|
______________________________________________________________________
|
|
42
42
|
|
|
43
43
|
### NAT Traversal
|
|
44
44
|
|
|
45
|
-
| **NAT Traversal** | **Status** |
|
|
46
|
-
| ----------------------------- | :--------: |
|
|
47
|
-
| **`libp2p-circuit-relay-v2`** |
|
|
48
|
-
| **`libp2p-autonat`** |
|
|
49
|
-
| **`libp2p-hole-punching`** |
|
|
45
|
+
| **NAT Traversal** | **Status** | **Source** |
|
|
46
|
+
| ----------------------------- | :--------: | :-----------------------------------------------------------------------------: |
|
|
47
|
+
| **`libp2p-circuit-relay-v2`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/relay/circuit_v2) |
|
|
48
|
+
| **`libp2p-autonat`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/host/autonat) |
|
|
49
|
+
| **`libp2p-hole-punching`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/relay/circuit_v2) |
|
|
50
50
|
|
|
51
51
|
______________________________________________________________________
|
|
52
52
|
|
|
@@ -54,27 +54,27 @@ ______________________________________________________________________
|
|
|
54
54
|
|
|
55
55
|
| **Secure Communication** | **Status** | **Source** |
|
|
56
56
|
| ------------------------ | :--------: | :---------------------------------------------------------------------------: |
|
|
57
|
-
| **`libp2p-noise`** |
|
|
58
|
-
| **`libp2p-tls`** |
|
|
57
|
+
| **`libp2p-noise`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/security/noise) |
|
|
58
|
+
| **`libp2p-tls`** | 🌱 | |
|
|
59
59
|
|
|
60
60
|
______________________________________________________________________
|
|
61
61
|
|
|
62
62
|
### Discovery
|
|
63
63
|
|
|
64
|
-
| **Discovery** | **Status** |
|
|
65
|
-
| -------------------- | :--------: |
|
|
66
|
-
| **`bootstrap`** |
|
|
67
|
-
| **`random-walk`** |
|
|
68
|
-
| **`mdns-discovery`** |
|
|
69
|
-
| **`rendezvous`** |
|
|
64
|
+
| **Discovery** | **Status** | **Source** |
|
|
65
|
+
| -------------------- | :--------: | :----------------------------------------------------------------------------------: |
|
|
66
|
+
| **`bootstrap`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/discovery/bootstrap) |
|
|
67
|
+
| **`random-walk`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/discovery/random_walk) |
|
|
68
|
+
| **`mdns-discovery`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/discovery/mdns) |
|
|
69
|
+
| **`rendezvous`** | 🌱 | |
|
|
70
70
|
|
|
71
71
|
______________________________________________________________________
|
|
72
72
|
|
|
73
73
|
### Peer Routing
|
|
74
74
|
|
|
75
|
-
| **Peer Routing** | **Status** |
|
|
76
|
-
| -------------------- | :--------: |
|
|
77
|
-
| **`libp2p-kad-dht`** |
|
|
75
|
+
| **Peer Routing** | **Status** | **Source** |
|
|
76
|
+
| -------------------- | :--------: | :--------------------------------------------------------------------: |
|
|
77
|
+
| **`libp2p-kad-dht`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/kad_dht) |
|
|
78
78
|
|
|
79
79
|
______________________________________________________________________
|
|
80
80
|
|
|
@@ -89,10 +89,10 @@ ______________________________________________________________________
|
|
|
89
89
|
|
|
90
90
|
### Stream Muxers
|
|
91
91
|
|
|
92
|
-
| **Stream Muxers** | **Status** |
|
|
93
|
-
| ------------------ | :--------: |
|
|
94
|
-
| **`libp2p-yamux`** |
|
|
95
|
-
| **`libp2p-mplex`** |
|
|
92
|
+
| **Stream Muxers** | **Status** | **Source** |
|
|
93
|
+
| ------------------ | :--------: | :-------------------------------------------------------------------------------: |
|
|
94
|
+
| **`libp2p-yamux`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/stream_muxer/yamux) |
|
|
95
|
+
| **`libp2p-mplex`** | ✅ | [source](https://github.com/libp2p/py-libp2p/tree/main/libp2p/stream_muxer/mplex) |
|
|
96
96
|
|
|
97
97
|
______________________________________________________________________
|
|
98
98
|
|
|
@@ -100,7 +100,7 @@ ______________________________________________________________________
|
|
|
100
100
|
|
|
101
101
|
| **Storage** | **Status** |
|
|
102
102
|
| ------------------- | :--------: |
|
|
103
|
-
| **`libp2p-record`** |
|
|
103
|
+
| **`libp2p-record`** | 🌱 |
|
|
104
104
|
|
|
105
105
|
______________________________________________________________________
|
|
106
106
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Advanced demonstration of Thin Waist address handling.
|
|
3
|
+
|
|
4
|
+
Run:
|
|
5
|
+
python -m examples.advanced.network_discovery
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from multiaddr import Multiaddr
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
from libp2p.utils.address_validation import (
|
|
14
|
+
expand_wildcard_address,
|
|
15
|
+
get_available_interfaces,
|
|
16
|
+
get_optimal_binding_address,
|
|
17
|
+
get_wildcard_address,
|
|
18
|
+
)
|
|
19
|
+
except ImportError:
|
|
20
|
+
# Fallbacks if utilities are missing - use minimal network discovery
|
|
21
|
+
import socket
|
|
22
|
+
|
|
23
|
+
def get_available_interfaces(port: int, protocol: str = "tcp"):
|
|
24
|
+
# Try to get local network interfaces, fallback to loopback
|
|
25
|
+
addrs = []
|
|
26
|
+
try:
|
|
27
|
+
# Get hostname IP (better than hardcoded localhost)
|
|
28
|
+
hostname = socket.gethostname()
|
|
29
|
+
local_ip = socket.gethostbyname(hostname)
|
|
30
|
+
if local_ip != "127.0.0.1":
|
|
31
|
+
addrs.append(Multiaddr(f"/ip4/{local_ip}/{protocol}/{port}"))
|
|
32
|
+
except Exception:
|
|
33
|
+
pass
|
|
34
|
+
# Always include loopback as fallback
|
|
35
|
+
addrs.append(Multiaddr(f"/ip4/127.0.0.1/{protocol}/{port}"))
|
|
36
|
+
return addrs
|
|
37
|
+
|
|
38
|
+
def expand_wildcard_address(addr: Multiaddr, port: int | None = None):
|
|
39
|
+
if port is None:
|
|
40
|
+
return [addr]
|
|
41
|
+
addr_str = str(addr).rsplit("/", 1)[0]
|
|
42
|
+
return [Multiaddr(addr_str + f"/{port}")]
|
|
43
|
+
|
|
44
|
+
def get_optimal_binding_address(port: int, protocol: str = "tcp"):
|
|
45
|
+
# Try to get a non-loopback address first
|
|
46
|
+
interfaces = get_available_interfaces(port, protocol)
|
|
47
|
+
for addr in interfaces:
|
|
48
|
+
if "127.0.0.1" not in str(addr):
|
|
49
|
+
return addr
|
|
50
|
+
# Fallback to loopback if no other interfaces found
|
|
51
|
+
return Multiaddr(f"/ip4/127.0.0.1/{protocol}/{port}")
|
|
52
|
+
|
|
53
|
+
def get_wildcard_address(port: int, protocol: str = "tcp"):
|
|
54
|
+
return Multiaddr(f"/ip4/0.0.0.0/{protocol}/{port}")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def main() -> None:
|
|
58
|
+
port = 8080
|
|
59
|
+
interfaces = get_available_interfaces(port)
|
|
60
|
+
print(f"Discovered interfaces for port {port}:")
|
|
61
|
+
for a in interfaces:
|
|
62
|
+
print(f" - {a}")
|
|
63
|
+
|
|
64
|
+
# Demonstrate wildcard address as a feature
|
|
65
|
+
wildcard_v4 = get_wildcard_address(port)
|
|
66
|
+
print(f"\nWildcard address (feature): {wildcard_v4}")
|
|
67
|
+
|
|
68
|
+
expanded_v4 = expand_wildcard_address(wildcard_v4)
|
|
69
|
+
print("\nExpanded IPv4 wildcard:")
|
|
70
|
+
for a in expanded_v4:
|
|
71
|
+
print(f" - {a}")
|
|
72
|
+
|
|
73
|
+
wildcard_v6 = Multiaddr(f"/ip6/::/tcp/{port}")
|
|
74
|
+
expanded_v6 = expand_wildcard_address(wildcard_v6)
|
|
75
|
+
print("\nExpanded IPv6 wildcard:")
|
|
76
|
+
for a in expanded_v6:
|
|
77
|
+
print(f" - {a}")
|
|
78
|
+
|
|
79
|
+
print("\nOptimal binding address heuristic result:")
|
|
80
|
+
print(f" -> {get_optimal_binding_address(port)}")
|
|
81
|
+
|
|
82
|
+
override_port = 9000
|
|
83
|
+
overridden = expand_wildcard_address(wildcard_v4, port=override_port)
|
|
84
|
+
print(f"\nPort override expansion to {override_port}:")
|
|
85
|
+
for a in overridden:
|
|
86
|
+
print(f" - {a}")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
main()
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import logging
|
|
3
|
+
import secrets
|
|
4
|
+
|
|
5
|
+
import trio
|
|
6
|
+
|
|
7
|
+
from libp2p import new_host
|
|
8
|
+
from libp2p.abc import PeerInfo
|
|
9
|
+
from libp2p.crypto.secp256k1 import create_new_key_pair
|
|
10
|
+
from libp2p.discovery.events.peerDiscovery import peerDiscovery
|
|
11
|
+
|
|
12
|
+
# Configure logging
|
|
13
|
+
logger = logging.getLogger("libp2p.discovery.bootstrap")
|
|
14
|
+
logger.setLevel(logging.INFO)
|
|
15
|
+
handler = logging.StreamHandler()
|
|
16
|
+
handler.setFormatter(
|
|
17
|
+
logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
|
18
|
+
)
|
|
19
|
+
logger.addHandler(handler)
|
|
20
|
+
|
|
21
|
+
# Configure root logger to only show warnings and above to reduce noise
|
|
22
|
+
# This prevents verbose DEBUG messages from multiaddr, DNS, etc.
|
|
23
|
+
logging.getLogger().setLevel(logging.WARNING)
|
|
24
|
+
|
|
25
|
+
# Specifically silence noisy libraries
|
|
26
|
+
logging.getLogger("multiaddr").setLevel(logging.WARNING)
|
|
27
|
+
logging.getLogger("root").setLevel(logging.WARNING)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def on_peer_discovery(peer_info: PeerInfo) -> None:
|
|
31
|
+
"""Handler for peer discovery events."""
|
|
32
|
+
logger.info(f"🔍 Discovered peer: {peer_info.peer_id}")
|
|
33
|
+
logger.debug(f" Addresses: {[str(addr) for addr in peer_info.addrs]}")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Example bootstrap peers
|
|
37
|
+
BOOTSTRAP_PEERS = [
|
|
38
|
+
"/dnsaddr/github.com/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
|
|
39
|
+
"/dnsaddr/cloudflare.com/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
|
|
40
|
+
"/dnsaddr/google.com/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
|
|
41
|
+
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
|
|
42
|
+
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
|
|
43
|
+
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
|
|
44
|
+
"/ip6/2604:a880:1:20::203:d001/tcp/4001/p2p/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
|
|
45
|
+
"/ip4/128.199.219.111/tcp/4001/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
|
|
46
|
+
"/ip4/104.236.76.40/tcp/4001/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
|
|
47
|
+
"/ip4/178.62.158.247/tcp/4001/p2p/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
|
|
48
|
+
"/ip6/2604:a880:1:20::203:d001/tcp/4001/p2p/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
|
|
49
|
+
"/ip6/2400:6180:0:d0::151:6001/tcp/4001/p2p/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
|
|
50
|
+
"/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/p2p/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
async def run(port: int, bootstrap_addrs: list[str]) -> None:
|
|
55
|
+
"""Run the bootstrap discovery example."""
|
|
56
|
+
from libp2p.utils.address_validation import (
|
|
57
|
+
find_free_port,
|
|
58
|
+
get_available_interfaces,
|
|
59
|
+
get_optimal_binding_address,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
if port <= 0:
|
|
63
|
+
port = find_free_port()
|
|
64
|
+
|
|
65
|
+
# Generate key pair
|
|
66
|
+
secret = secrets.token_bytes(32)
|
|
67
|
+
key_pair = create_new_key_pair(secret)
|
|
68
|
+
|
|
69
|
+
# Create listen addresses for all available interfaces
|
|
70
|
+
listen_addrs = get_available_interfaces(port)
|
|
71
|
+
|
|
72
|
+
# Register peer discovery handler
|
|
73
|
+
peerDiscovery.register_peer_discovered_handler(on_peer_discovery)
|
|
74
|
+
|
|
75
|
+
logger.info("🚀 Starting Bootstrap Discovery Example")
|
|
76
|
+
logger.info(f"🌐 Bootstrap peers: {len(bootstrap_addrs)}")
|
|
77
|
+
|
|
78
|
+
print("\n" + "=" * 60)
|
|
79
|
+
print("Bootstrap Discovery Example")
|
|
80
|
+
print("=" * 60)
|
|
81
|
+
print("This example demonstrates connecting to bootstrap peers.")
|
|
82
|
+
print("Watch the logs for peer discovery events!")
|
|
83
|
+
print("Press Ctrl+C to exit.")
|
|
84
|
+
print("=" * 60)
|
|
85
|
+
|
|
86
|
+
# Create and run host with bootstrap discovery
|
|
87
|
+
host = new_host(key_pair=key_pair, bootstrap=bootstrap_addrs)
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
async with host.run(listen_addrs=listen_addrs):
|
|
91
|
+
# Get all available addresses with peer ID
|
|
92
|
+
all_addrs = host.get_addrs()
|
|
93
|
+
|
|
94
|
+
logger.info("Listener ready, listening on:")
|
|
95
|
+
print("Listener ready, listening on:")
|
|
96
|
+
for addr in all_addrs:
|
|
97
|
+
logger.info(f"{addr}")
|
|
98
|
+
print(f"{addr}")
|
|
99
|
+
|
|
100
|
+
# Display optimal address for reference
|
|
101
|
+
optimal_addr = get_optimal_binding_address(port)
|
|
102
|
+
optimal_addr_with_peer = f"{optimal_addr}/p2p/{host.get_id().to_string()}"
|
|
103
|
+
logger.info(f"Optimal address: {optimal_addr_with_peer}")
|
|
104
|
+
print(f"Optimal address: {optimal_addr_with_peer}")
|
|
105
|
+
|
|
106
|
+
# Keep running and log peer discovery events
|
|
107
|
+
await trio.sleep_forever()
|
|
108
|
+
except KeyboardInterrupt:
|
|
109
|
+
logger.info("👋 Shutting down...")
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def main() -> None:
|
|
113
|
+
"""Main entry point."""
|
|
114
|
+
description = """
|
|
115
|
+
Bootstrap Discovery Example for py-libp2p
|
|
116
|
+
|
|
117
|
+
This example demonstrates how to use bootstrap peers for peer discovery.
|
|
118
|
+
Bootstrap peers are predefined peers that help new nodes join the network.
|
|
119
|
+
|
|
120
|
+
Usage:
|
|
121
|
+
python bootstrap.py -p 8000
|
|
122
|
+
python bootstrap.py -p 8001 --custom-bootstrap \\
|
|
123
|
+
"/ip4/[HOST_IP]/tcp/8000/p2p/QmYourPeerID"
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
parser = argparse.ArgumentParser(
|
|
127
|
+
description=description, formatter_class=argparse.RawDescriptionHelpFormatter
|
|
128
|
+
)
|
|
129
|
+
parser.add_argument(
|
|
130
|
+
"-p", "--port", default=0, type=int, help="Port to listen on (default: random)"
|
|
131
|
+
)
|
|
132
|
+
parser.add_argument(
|
|
133
|
+
"--custom-bootstrap",
|
|
134
|
+
nargs="*",
|
|
135
|
+
help="Custom bootstrap addresses (space-separated)",
|
|
136
|
+
)
|
|
137
|
+
parser.add_argument(
|
|
138
|
+
"-v", "--verbose", action="store_true", help="Enable verbose output"
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
args = parser.parse_args()
|
|
142
|
+
|
|
143
|
+
if args.verbose:
|
|
144
|
+
logger.setLevel(logging.DEBUG)
|
|
145
|
+
|
|
146
|
+
# Use custom bootstrap addresses if provided, otherwise use defaults
|
|
147
|
+
bootstrap_addrs = (
|
|
148
|
+
args.custom_bootstrap if args.custom_bootstrap else BOOTSTRAP_PEERS
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
trio.run(run, args.port, bootstrap_addrs)
|
|
153
|
+
except KeyboardInterrupt:
|
|
154
|
+
logger.info("Exiting...")
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
if __name__ == "__main__":
|
|
158
|
+
main()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import argparse
|
|
2
|
+
import logging
|
|
2
3
|
import sys
|
|
3
4
|
|
|
4
5
|
import multiaddr
|
|
@@ -17,6 +18,11 @@ from libp2p.peer.peerinfo import (
|
|
|
17
18
|
info_from_p2p_addr,
|
|
18
19
|
)
|
|
19
20
|
|
|
21
|
+
# Configure minimal logging
|
|
22
|
+
logging.basicConfig(level=logging.WARNING)
|
|
23
|
+
logging.getLogger("multiaddr").setLevel(logging.WARNING)
|
|
24
|
+
logging.getLogger("libp2p").setLevel(logging.WARNING)
|
|
25
|
+
|
|
20
26
|
PROTOCOL_ID = TProtocol("/chat/1.0.0")
|
|
21
27
|
MAX_READ_LEN = 2**32 - 1
|
|
22
28
|
|
|
@@ -40,9 +46,21 @@ async def write_data(stream: INetStream) -> None:
|
|
|
40
46
|
|
|
41
47
|
|
|
42
48
|
async def run(port: int, destination: str) -> None:
|
|
43
|
-
|
|
49
|
+
from libp2p.utils.address_validation import (
|
|
50
|
+
find_free_port,
|
|
51
|
+
get_available_interfaces,
|
|
52
|
+
get_optimal_binding_address,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
if port <= 0:
|
|
56
|
+
port = find_free_port()
|
|
57
|
+
|
|
58
|
+
listen_addrs = get_available_interfaces(port)
|
|
44
59
|
host = new_host()
|
|
45
|
-
async with host.run(listen_addrs=
|
|
60
|
+
async with host.run(listen_addrs=listen_addrs), trio.open_nursery() as nursery:
|
|
61
|
+
# Start the peer-store cleanup task
|
|
62
|
+
nursery.start_soon(host.get_peerstore().start_cleanup_task, 60)
|
|
63
|
+
|
|
46
64
|
if not destination: # its the server
|
|
47
65
|
|
|
48
66
|
async def stream_handler(stream: INetStream) -> None:
|
|
@@ -51,10 +69,19 @@ async def run(port: int, destination: str) -> None:
|
|
|
51
69
|
|
|
52
70
|
host.set_stream_handler(PROTOCOL_ID, stream_handler)
|
|
53
71
|
|
|
72
|
+
# Get all available addresses with peer ID
|
|
73
|
+
all_addrs = host.get_addrs()
|
|
74
|
+
|
|
75
|
+
print("Listener ready, listening on:\n")
|
|
76
|
+
for addr in all_addrs:
|
|
77
|
+
print(f"{addr}")
|
|
78
|
+
|
|
79
|
+
# Use optimal address for the client command
|
|
80
|
+
optimal_addr = get_optimal_binding_address(port)
|
|
81
|
+
optimal_addr_with_peer = f"{optimal_addr}/p2p/{host.get_id().to_string()}"
|
|
54
82
|
print(
|
|
55
|
-
"
|
|
56
|
-
f"chat-demo "
|
|
57
|
-
f"-d {host.get_addrs()[0]}\n"
|
|
83
|
+
f"\nRun this from the same folder in another console:\n\n"
|
|
84
|
+
f"chat-demo -d {optimal_addr_with_peer}\n"
|
|
58
85
|
)
|
|
59
86
|
print("Waiting for incoming connection...")
|
|
60
87
|
|
|
@@ -83,7 +110,7 @@ def main() -> None:
|
|
|
83
110
|
where <DESTINATION> is the multiaddress of the previous listener host.
|
|
84
111
|
"""
|
|
85
112
|
example_maddr = (
|
|
86
|
-
"/ip4/
|
|
113
|
+
"/ip4/[HOST_IP]/tcp/8000/p2p/QmQn4SwGkDZKkUEpBRBvTmheQycxAHJUNmVEnjA2v1qe8Q"
|
|
87
114
|
)
|
|
88
115
|
parser = argparse.ArgumentParser(description=description)
|
|
89
116
|
parser.add_argument("-p", "--port", default=0, type=int, help="source port number")
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import secrets
|
|
2
2
|
|
|
3
|
-
import multiaddr
|
|
4
3
|
import trio
|
|
5
4
|
|
|
6
5
|
from libp2p import (
|
|
@@ -9,9 +8,10 @@ from libp2p import (
|
|
|
9
8
|
from libp2p.crypto.secp256k1 import (
|
|
10
9
|
create_new_key_pair,
|
|
11
10
|
)
|
|
12
|
-
from libp2p.security.insecure.transport import
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
from libp2p.security.insecure.transport import PLAINTEXT_PROTOCOL_ID, InsecureTransport
|
|
12
|
+
from libp2p.utils.address_validation import (
|
|
13
|
+
get_available_interfaces,
|
|
14
|
+
get_optimal_binding_address,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
|
|
@@ -24,6 +24,12 @@ async def main():
|
|
|
24
24
|
insecure_transport = InsecureTransport(
|
|
25
25
|
# local_key_pair: The key pair used for libp2p identity
|
|
26
26
|
local_key_pair=key_pair,
|
|
27
|
+
# secure_bytes_provider: Optional function to generate secure random bytes
|
|
28
|
+
# (defaults to secrets.token_bytes)
|
|
29
|
+
secure_bytes_provider=None, # Use default implementation
|
|
30
|
+
# peerstore: Optional peerstore to store peer IDs and public keys
|
|
31
|
+
# (defaults to None)
|
|
32
|
+
peerstore=None,
|
|
27
33
|
)
|
|
28
34
|
|
|
29
35
|
# Create a security options dictionary mapping protocol ID to transport
|
|
@@ -32,17 +38,19 @@ async def main():
|
|
|
32
38
|
# Create a host with the key pair and insecure transport
|
|
33
39
|
host = new_host(key_pair=key_pair, sec_opt=security_options)
|
|
34
40
|
|
|
35
|
-
# Configure the listening address
|
|
41
|
+
# Configure the listening address using the new paradigm
|
|
36
42
|
port = 8000
|
|
37
|
-
|
|
43
|
+
listen_addrs = get_available_interfaces(port)
|
|
44
|
+
optimal_addr = get_optimal_binding_address(port)
|
|
38
45
|
|
|
39
46
|
# Start the host
|
|
40
|
-
async with host.run(listen_addrs=
|
|
47
|
+
async with host.run(listen_addrs=listen_addrs):
|
|
41
48
|
print(
|
|
42
49
|
"libp2p has started with insecure transport "
|
|
43
50
|
"(not recommended for production)"
|
|
44
51
|
)
|
|
45
52
|
print("libp2p is listening on:", host.get_addrs())
|
|
53
|
+
print(f"Optimal address: {optimal_addr}")
|
|
46
54
|
# Keep the host running
|
|
47
55
|
await trio.sleep_forever()
|
|
48
56
|
|