b838a0e3b6
added none type to return value of negotiate and changed caller handles to handle none. Added newsfragment.
2025-08-12 21:50:10 +05:30
39375fb338
Merge branch 'main' into todo/handletimeout
2025-07-21 08:17:08 -07:00
37e4fee9f8
feat: Add identify-push raw format support and yamux logging improvements
...
- Add comprehensive integration tests for identify-push protocol
- Support both raw protobuf and varint message formats
- Improve yamux logging integration with LIBP2P_DEBUG
- Fix RawConnError handling to reduce log noise
- Add Ctrl+C handling to identify examples
- Enhance identify-push listener/dialer demo
Fixes : #784
2025-07-20 20:19:18 +02:00
c9162beb2b
add grave that were removed by mistake
2025-07-17 20:55:49 +05:30
9cd3805542
make readwrite more safe
2025-07-13 18:37:44 +05:30
cda163fc48
change ReadWriteLock class
2025-07-09 18:18:37 +05:30
26ed99dafd
change tests path
2025-07-09 18:09:07 +05:30
242998ae9d
add test for read-write-lock
2025-07-08 20:06:30 +05:30
e65e38a3f1
fix: linting error related to read
2025-07-08 19:11:56 +05:30
8fb664bfdf
Fix: linting errors
2025-07-08 18:34:30 +05:30
3dcd99a2d1
todo: handle timeout
2025-07-08 17:48:57 +05:30
75abc8b863
run ruff format
2025-07-08 07:35:45 +05:30
91dca97d83
TODO: add read/write lock
2025-07-07 21:55:32 +05:30
5a95212697
Merge branch 'main' into main
2025-07-02 10:22:01 -07:00
83d11db852
fix: added negotiate timeout to MuxerMultistream
2025-07-01 18:33:26 +05:30
0038ef99d4
Merge branch 'main' into main
2025-06-30 07:43:32 -07:00
ef16f3c993
fix: accept new streams for both DATA and WINDOW_UPDATE frames with the SYN flag ( #702 )
...
* fix: accept new streams for both and frames with the flag
* doc: newsfragment
---------
Co-authored-by: Manu Sheel Gupta <manusheel.edu@gmail.com >
2025-06-29 10:50:17 +02:00
724375e1fa
updated doc-string and reverted mplex-changes
2025-06-24 18:05:15 +05:30
d7cdae8a0f
intgrated n==-1 case in read()
2025-06-21 17:51:27 +05:30
209deffc8a
resolved recv_window updates,added support for read_EOF
2025-06-21 13:40:12 +05:30
e397ce25a6
Updated Yamux impl.,added tests for yamux and mplex
2025-06-10 20:12:19 +05:30
bdadec7519
ft. modernise py-libp2p ( #618 )
...
* fix pyproject.toml , add ruff
* rm lock
* make progress
* add poetry lock ignore
* fix type issues
* fix tcp type errors
* fix text example - type error - wrong args
* add setuptools to dev
* test ci
* fix docs build
* fix type issues for new_swarm & new_host
* fix types in gossipsub
* fix type issues in noise
* wip: factories
* revert factories
* fix more type issues
* more type fixes
* fix: add null checks for noise protocol initialization and key handling
* corrected argument-errors in peerId and Multiaddr in peer tests
* fix: Noice - remove redundant type casts in BaseNoiseMsgReadWriter
* fix: update test_notify.py to use SwarmFactory.create_batch_and_listen, fix type hints, and comment out ClosedStream assertions
* Fix type checks for pubsub module
Signed-off-by: sukhman <sukhmansinghsaluja@gmail.com >
* Fix type checks for pubsub module-tests
Signed-off-by: sukhman <sukhmansinghsaluja@gmail.com >
* noise: add checks for uninitialized protocol and key states in PatternXX
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com >
* pubsub: add None checks for optional fields in FloodSub and Pubsub
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com >
* Fix type hints and improve testing
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com >
* remove redundant checks
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com >
* fix build issues
* add optional to trio service
* fix types
* fix type errors
* Fix type errors
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com >
* fixed more-type checks in crypto and peer_data files
* wip: factories
* replaced union with optional
* fix: type-error in interp-utils and peerinfo
* replace pyright with pyrefly
* add pyrefly.toml
* wip: fix multiselect issues
* try typecheck
* base check
* mcache test fixes , typecheck ci update
* fix ci
* will this work
* minor fix
* use poetry
* fix wokflow
* use cache,fix err
* fix pyrefly.toml
* fix pyrefly.toml
* fix cache in ci
* deploy commit
* add main baseline
* update to v5
* improve typecheck ci (#14 )
* fix typo
* remove holepunching code (#16 )
* fix gossipsub typeerrors (#17 )
* fix: ensure initiator user includes remote peer id in handshake (#15 )
* fix ci (#19 )
* typefix: custom_types | core/peerinfo/test_peer_info | io/abc | pubsub/floodsub | protocol_muxer/multiselect (#18 )
* fix: Typefixes in PeerInfo (#21 )
* fix minor type issue (#22 )
* fix type errors in pubsub (#24 )
* fix: Minor typefixes in tests (#23 )
* Fix failing tests for type-fixed test/pubsub (#8 )
* move pyrefly & ruff to pyproject.toml & rm .project-template (#28 )
* move the async_context file to tests/core
* move crypto test to crypto folder
* fix: some typefixes (#25 )
* fix type errors
* fix type issues
* fix: update gRPC API usage in autonat_pb2_grpc.py (#31 )
* md: typecheck ci
* rm comments
* clean up : from review suggestions
* use | None over Optional as per new python standards
* drop supporto for py3.9
* newsfragments
---------
Signed-off-by: sukhman <sukhmansinghsaluja@gmail.com >
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com >
Co-authored-by: acul71 <luca.pisani@birdo.net >
Co-authored-by: kaneki003 <sakshamchauhan707@gmail.com >
Co-authored-by: sukhman <sukhmansinghsaluja@gmail.com >
Co-authored-by: varun-r-mallya <varunrmallya@gmail.com >
Co-authored-by: varunrmallya <100590632+varun-r-mallya@users.noreply.github.com >
Co-authored-by: lla-dane <abhinavagarwalla6@gmail.com >
Co-authored-by: Collins <ArtemisfowlX@protonmail.com >
Co-authored-by: Abhinav Agarwalla <120122716+lla-dane@users.noreply.github.com >
Co-authored-by: guha-rahul <52607971+guha-rahul@users.noreply.github.com >
Co-authored-by: Sukhman Singh <63765293+sukhman-sukh@users.noreply.github.com >
Co-authored-by: acul71 <34693171+acul71@users.noreply.github.com >
Co-authored-by: pacrob <5199899+pacrob@users.noreply.github.com >
2025-06-09 11:39:59 -06:00
67ab6e27d8
feat: implement AsyncContextManager for IMuxedStream to support async… ( #629 )
...
* feat: implement AsyncContextManager for IMuxedStream to support async with
* doc: add newsfragment
2025-05-30 08:44:33 -06:00
4b1860766d
Feat: Adding Yamux as default multiplexer, keeping Mplex as fallback ( #538 )
...
* feat: Replace mplex with yamux as default multiplexer in py-libp2p
* Retain Mplex alongside Yamux in new_swarm with messaging that Yamux is preferred
* moved !BBHII to a constant YAMUX_HEADER_FORMAT at the top of yamux.py with a comment explaining its structure
* renamed the news fragment to 534.feature.rst and updated the description
* renamed the news fragment to 534.feature.rst and updated the description
* added a docstring to clarify that Yamux does not support deadlines natively
* Remove the __main__ block entirely from test_yamux.py
* Replaced the print statements in test_yamux.py with logging.debug
* Added a comment linking to the spec for clarity
* Raise NotImplementedError in YamuxStream.set_deadline per review
* Add muxed_conn to YamuxStream and test deadline NotImplementedError
* Fix Yamux implementation to meet libp2p spec
* Fix None handling in YamuxStream.read and Yamux.read_stream
* Fix test_connected_peers.py to correctly handle peer connections
* fix: Ensure StreamReset is raised on read after local reset in yamux
* fix: Map MuxedStreamError to StreamClosed in NetStream.write for Yamux
* fix: Raise MuxedStreamReset in Yamux.read_stream for closed streams
* fix: Correct Yamux stream read behavior for NetStream tests
Fixed est_net_stream_read_after_remote_closed by updating NetStream.read to raise StreamEOF when the stream is remotely closed and no data is available, aligning with test expectations and Fixed est_net_stream_read_until_eof by modifying YamuxStream.read to block until the stream is closed (
ecv_closed=True) for
=-1 reads, ensuring data is only returned after remote closure.
* fix: Correct Yamux stream read behavior for NetStream tests
Fixed est_net_stream_read_after_remote_closed by updating NetStream.read to raise StreamEOF when the stream is remotely closed and no data is available, aligning with test expectations and Fixed est_net_stream_read_until_eof by modifying YamuxStream.read to block until the stream is closed (
ecv_closed=True) for
=-1 reads, ensuring data is only returned after remote closure.
* fix: raise StreamEOF when reading from closed stream with empty buffer
* fix: prioritize returning buffered data even after stream reset
* fix: prioritize returning buffered data even after stream reset
* fix: Ensure test_net_stream_read_after_remote_closed_and_reset passes in full suite
* fix: Add __init__.py to yamux module to fix documentation build
* fix: Add __init__.py to yamux module to fix documentation build
* fix: Add libp2p.stream_muxer.yamux to libp2p.stream_muxer.rst toctree
* fix: Correct title underline length in libp2p.stream_muxer.yamux.rst
* fix: Add a = so that is matches the libp2p.stream\_muxer.yamux length
* fix(tests): Resolve race condition in network notification test
* fix: fixing failing tests and examples with yamux and noise
* refactor: remove debug logging and improve x25519 tests
* fix: Add functionality for users to choose between Yamux and Mplex
* fix: increased trio sleep to 0.1 sec for slow environment
* feat: Add test for switching between Yamux and mplex
* refactor: move host fixtures to interop tests
* chore: Update __init__.py removing unused import
removed unused
```python
import os
import logging
```
* lint: fix import order
* fix: Resolve conftest.py conflict by removing trio test support
* fix: Resolve test skipping by keeping trio test support
* Fix: add a newline at end of the file
---------
Co-authored-by: acul71 <luca.pisani@birdo.net >
Co-authored-by: acul71 <34693171+acul71@users.noreply.github.com >
2025-05-22 14:01:51 -06:00
fabf2cefc4
feat: implement get_remote_address via delegation pattern
2025-03-24 08:02:21 -06:00
d7eab27564
refactored and moved all interfaces to abc.py ( #504 )
...
* refactored : host_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored : network_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored : notifee_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored : net_connection_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored: raw_connection_interface, secure_conn_interface and stream_muxer abc.py
* refactored: addrbook_interface
* refactored :peerdata_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored :peermetadata_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored :multiselect_client_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored :multiselect_communicator_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored :multiselect_muxer_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored :interfaces
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored :security_transport_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* refactored :listener_interface
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* moved all interfaces and typing files
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
* fixed documentation and moved pubsub abc.py
Co-authored-by: Khwahish Patel <khwahish.p1@ahduni.edu.in >
* added exclude-members in custom_types docs
* added : newsfragment for moving all interfaces to libp2p.abc
---------
Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com >
Co-authored-by: Mystical <125946525+mystical-prog@users.noreply.github.com >
2025-02-21 16:01:45 -07:00
e7a9ee78a8
rename typing.py to custom_types.py for clarity
2025-02-02 07:18:52 -07:00
8787613e91
run lint with pyupgrade at py39-plus
2025-01-25 15:48:39 -07:00
8dda7b933e
turn mypy checks back on, fix some errors
2024-04-27 10:12:39 -06:00
94483714a3
run lint and fix errors, except mypy
2024-02-19 16:05:58 -07:00
fb53edbc04
Change async def write
...
To return `None` instead of `int. `Writer.write` *does* write all data
in all use case.
2020-02-08 10:24:37 +08:00
5b03a7ad9f
Mplex: only close the send of new stream channel
2020-02-05 21:41:28 +08:00
b7c2ec2187
Mplex: change the reference url
...
To the commit hash, to make it more correct.
2020-02-05 21:31:04 +08:00
1fff6ad6b4
Mplex: change message channel size to 8
...
To avoid infinity sized channel, and to conform to the go
implementation.
2020-02-05 20:31:18 +08:00
64c9c48dac
Mplex: change new stream channel size
...
To `0`, i.e. no unbuffered, to avoid growing buffer size.
2020-02-05 19:48:02 +08:00
996b5cf15d
Mplex: catch exceptions from channel.send
2020-02-05 17:05:30 +08:00
c0ab609559
Mplex: catch RawConnError when writing
...
Also, do nothing in `MplexStream.reset` if `MuxedConnUnavailable` is
raised when sending the message.
2020-02-04 21:57:59 +08:00
e3a1dd62e4
Use new type hinting for trio channel
2020-01-26 23:56:19 +08:00
5b4b65faa8
Change default value of read()
...
From `n = -1` to `n = None`, to comply with trio API
2020-01-26 23:03:38 +08:00
eef241e70e
Make Mplex and SwarmConn not Service
...
After second thoughts, they seem not a good candidate of `Service`.
The shutdown logic becomes simpler by making them not `Service`.
2020-01-07 21:50:03 +08:00
ce5663705f
Merge branch 'master' into feature/porting-to-trio
2019-12-24 02:19:43 +08:00
fb0519129d
Refine Mplex.close and SwarmConn.close
...
Ensure `close` cleans up things and cancel the service finally.
2019-12-17 15:50:55 +08:00
1929f307fb
Fix all modules except for security
2019-12-06 17:06:37 +08:00
e9ab0646e3
Fix Pubsub
2019-12-03 17:27:49 +08:00
eb494e8682
Fix ping protocol
2019-12-01 19:17:32 +08:00
79fcdf3a02
Update tests in test_tcp.py
...
Besides, run `make format`
2019-12-01 16:26:16 +08:00
1e600ea7e0
Fix Mplex and Swarm
2019-11-29 19:09:56 +08:00
ec43c25b45
Rewrite factories, made some of the test running
2019-11-26 19:24:30 +08:00
417b5e7d61
remove unused asyncio
2019-11-26 15:27:06 +08:00
a397ccdc04
makes test_mplex_stream.py::test_mplex_stream_read_write work
2019-11-26 15:27:06 +08:00