Aratz M. Lasa
3f24b015ab
Implemented Host that includes a routing system. Explicitly separating different Host types as in Go implementation
2019-10-14 00:29:28 +02:00
mhchia
82dc5d9e31
Ignore typing for asyncio.wait
2019-10-02 15:45:54 +08:00
Moshe Malawach
986a852e7e
Remove forced debug level
2019-10-01 11:17:05 +02:00
mhchia
92deae41dc
Change SwarmConn.conn
to muxed_conn
2019-09-23 15:46:50 +08:00
mhchia
8d2415a404
Move calls to Notifee
inside Swarm
2019-09-23 15:01:58 +08:00
mhchia
6f8394e4bd
Merge branch 'master' into fix/change-notifee-and-add-tests-for-swarm-conn-and-mplex
2019-09-21 18:34:12 +08:00
mhchia
e44c2145cc
Merge branch 'master' into fix/detection-of-close
2019-09-21 18:05:54 +08:00
mhchia
a27a817d50
Fix tests
2019-09-20 16:17:13 +08:00
mhchia
89c127eff4
Merge branch 'master' into fix/refactor-mplex-swarm-host
2019-09-20 15:45:28 +08:00
NIC619
7fc958e7be
Add exception raised to docstring
2019-09-19 22:19:36 +08:00
NIC619
b9d1875027
Catch OpenConnectionError
in swarm.dial_peer
2019-09-19 21:24:01 +08:00
mhchia
62b0bc4580
Remove useless protocol_ids in logging
2019-09-19 16:31:42 +08:00
mhchia
a9ad37bc6f
Add mplex tests and fix error in SwarmConn.close
2019-09-19 16:31:41 +08:00
mhchia
d61327f5f9
Add tests for SwarmConn
2019-09-19 16:31:41 +08:00
mhchia
b8b5ac5e06
Add test for notifee disconnected
2019-09-19 16:31:41 +08:00
mhchia
5307c0506b
Change IMuxedConn
to INetConn
in Notifee
2019-09-19 16:31:41 +08:00
mhchia
0356380996
Add tests for swarm, and debug
...
Fix `swarm_pair_factory`
2019-09-19 16:31:40 +08:00
mhchia
e7304538da
Add test for Swarm.close_peer
2019-09-19 16:31:12 +08:00
mhchia
6923f257f6
Remove print
2019-09-19 16:07:53 +08:00
mhchia
2d8e02b7eb
Add detection for disconnections in mplex
2019-09-19 15:55:26 +08:00
mhchia
7cf0495f37
Remove print
2019-09-19 15:38:38 +08:00
mhchia
a7bc9fc358
Asynchronously handling the accepted stream.
2019-09-19 13:59:51 +08:00
mhchia
6cb033fd1f
Refactor multiselect
out of Swarm
to BasicHost
2019-09-19 13:59:50 +08:00
mhchia
0bd213bbb7
Refactor mplex and start to add close detection
2019-09-19 13:56:05 +08:00
NIC619
f253152858
Handle protocol negotiation failure in swarm new_stream
2019-09-17 16:17:41 +08:00
NIC619
4cd5b77f10
Raise RawConnError
in RawConnection
2019-09-16 18:37:00 +08:00
NIC619
cb632fa509
Add RawConnError
2019-09-16 18:35:48 +08:00
NIC619
68573e94d3
Have StreamError
inherit from IOException
2019-09-15 16:34:16 +08:00
NIC619
f368f5e93b
Apply PR feedback
2019-09-15 15:09:58 +08:00
NIC619
786a03544c
Add some loggings to swarm and cosmetic updates
2019-09-14 21:47:49 +08:00
mhchia
451f993058
Fix isort
2019-09-11 18:05:41 +08:00
mhchia
c1ffc0ab07
Fix transport.dial
in swarm
2019-09-11 17:13:21 +08:00
Alex Stokes
4bd32cc4bc
Add logs during connection handshake
2019-09-10 19:02:29 -04:00
mhchia
be2c0f122a
Fix close behavior
2019-09-10 18:01:14 +08:00
mhchia
10415cb956
Use ReadWriteCloser
for conns and streams
2019-09-05 23:24:17 +08:00
Alex Stokes
6d97702da7
Merge pull request #277 from ralexstokes/add-io-abstractions
...
Introduces IO abstractions and classes for `msgio` IO
2019-09-04 19:11:50 +02:00
Alex Stokes
8e8318aa5c
Introduces IO abstractions apart from asyncio
or those attached to IRawConnection
...
Also adds `msgio` utilities to mirror the Go implementation
2019-09-03 21:59:50 -07:00
mhchia
4f7bb30d82
Add INetStream
to type StreamReader
...
TODO: Make stream readers implement `Reader`
2019-09-03 22:59:44 +08:00
mhchia
7385a7a677
Add is_gossipsub
fixture in interop test
...
To use the same code to test against both routers: floodsub and
gossipsub.
2019-09-03 16:49:00 +08:00
mhchia
fd1f466002
Fix: failed to open stream using existing conn
...
Fix #233
2019-09-03 14:12:16 +08:00
mhchia
194b494057
Tested against subscriptions and publish
2019-09-02 23:21:57 +08:00
mhchia
aa0866698f
PR feedback: Add check in Swarm.close_peer
2019-08-31 22:37:59 +08:00
Kevin Mai-Husan Chia
1e59438f25
Update libp2p/network/swarm.py
...
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-08-31 22:32:32 +08:00
mhchia
b2c5371323
Add TODO for Swarm.connections
2019-08-29 22:00:07 +08:00
mhchia
c61a06706a
Refactor interop tests and factories
...
- Add `close` and `disconnect` in `Host`
- Add `close` and `close_peer` in `Network`
- Change `IListener.close` to async, to await for server's closing
- Add factories for security transports, and modify `HostFactory`
2019-08-29 21:38:06 +08:00
Alex Stokes
c5eda4065d
Expose reset
method on NetStream
2019-08-26 11:38:39 -07:00
mhchia
d59870ebbf
Fix MplexStream
error
...
When receiving a `NewStream`, the message of that packet is the
name of the stream, which should be handled, rather than letting it go
into the message queue.
2019-08-26 20:39:08 +08:00
Alex Stokes
5b32bfdd3f
Add call to wait_closed
method of asyncio.StreamWriter
2019-08-24 22:06:24 +02:00
Alex Stokes
9c5fb4fa5a
Encapsulate concept of a "stream id" to a "muxed" connection
2019-08-24 21:50:07 +02:00
Alex Stokes
e29c1507bf
remove unused fields
2019-08-24 21:50:06 +02:00
mhchia
16a4fd33c1
PR feedbacks
...
- Move exceptions to exceptions.py
- Raise `UpgradeFailure` in upgrader
- Refine the try/catch for upgraders in swarm
2019-08-22 22:53:49 +08:00
mhchia
ef476e555b
Use RawConnection.read
...
Instead of accessing its reader and writer directly.
TODO: considering add `ReaderWriterCloser` interface and let connection
and stream inherit from it.
2019-08-22 22:53:48 +08:00
mhchia
0b466ddc86
Add lock to RawConnection
...
To avoid `self.writer.drain()` is called in parallel.
Reference: https://bugs.python.org/issue29930
2019-08-22 22:53:47 +08:00
mhchia
5768daa9bf
PR feedbacks
...
- Nits
- Add `SecurityUpgradeFailure` and handle `UpgradeFailure` in Swarm.
2019-08-22 22:53:47 +08:00
mhchia
bb7d37fd4f
Fix msg encoding
...
- Change varint-prefix encode to fixedint-prefix(4 bytes) encode.
2019-08-22 22:53:46 +08:00
mhchia
22b1a5395d
A working plaintext 2.0 without validation
2019-08-22 22:53:46 +08:00
mhchia
7bc363f2fa
Remove initiator in Mplex
...
Besides, fix the wrong passed `multi_addr` to `mplex_stream`.
2019-08-22 22:53:45 +08:00
mhchia
4358a4bc89
Negotiate multiselect version for Muxer
...
`MuxerMultistream` is introduced to negotiate `Multiselect` version
before negotiating Multiplexer's version. This is required by
multistream 1.x
2019-08-21 11:43:24 +08:00
mhchia
86d4ce1da8
Add delim_encode
and delim_read
...
- Add `StreamCommunicator` and `RawConnectionCommunicator`, read/write
messages with delim codec, with `IMuxedStream` and `IRawConnection`
respectively.
- Use it in `Multiselect` and `MultiselectClient`.
2019-08-18 19:51:04 +08:00
mhchia
2485a00e24
Modify NetStream
to read n bytes
2019-08-16 11:03:16 +08:00
Alex Stokes
20dd7d777a
More efficiently remove trailing newline from message
2019-08-15 16:33:34 -07:00
Alex Stokes
3debd2c808
Run black
and isort
w/ the new config
2019-08-13 14:36:42 -07:00
Chih Cheng Liang
28f6de37ee
Fix the rest of the typing hints ( #232 )
...
* ignore kad
* fix swarm, and minor
* fix init and swarm
* ignore pb
* enable mypy
* fix basic host
* fix tcp
* fix mplex
* add typing for pb
* skip format pyi
* [mypy] no need to ignore pb now
* add typing to chat
2019-08-11 16:47:54 +08:00
Chih Cheng Liang
c536aa3e07
flake8
2019-08-08 16:09:02 +08:00
Chih Cheng Liang
5903012e0e
add typing to protocol_muxer
2019-08-08 16:09:02 +08:00
Chih Cheng Liang
e763f57930
run isort
2019-08-05 11:47:23 +08:00
Chih Cheng Liang
9e0a806218
move stream and connection interfaces to abc
2019-08-05 11:17:38 +08:00
Chih Cheng Liang
29091266fc
add still needed TYPE_CHECK
2019-08-05 10:46:49 +08:00
Chih Cheng Liang
239a5c88fb
add typing to mplex
2019-08-05 10:45:46 +08:00
Alex Stokes
7477b29508
run black w/ extended line length
2019-08-04 12:37:41 +08:00
Alex Stokes
c8005c8113
Run isort
in repo
2019-08-03 17:50:14 +08:00
Alex Stokes
7b7c8ad30d
run black over dangling files
2019-08-02 11:47:08 -07:00
mhchia
2e94fcf56c
Remove pylint:disable
2019-08-02 23:26:06 +08:00
NIC Lin
7a0fa7dd37
Merge pull request #196 from NIC619/fix_peer_id
...
Refactor `peer.ID` class and only takes in `bytes` type argument
2019-08-02 18:03:56 +08:00
NIC619
3a4b592a5a
Fix missing asterisk
2019-08-02 15:06:39 +08:00
NIC619
924e965537
Change argument name of Network.listen
and blakc format
2019-08-02 14:45:59 +08:00
NIC619
b928bdb356
Convert from base58/pubkey/privkey to class method
2019-08-02 14:42:10 +08:00
Chih Cheng Liang
a86f010c95
add typing to security
2019-08-01 19:12:11 +08:00
Alex Stokes
0ae9840928
Run black
over repo
2019-07-31 15:00:12 -07:00
NIC619
5e215901c0
Apply PR feedback
2019-07-30 23:41:28 +08:00
NIC619
c4105688d1
Fix after rebase
2019-07-30 17:31:08 +08:00
NIC619
e53727d301
Apply PR feedback: fix type hints
2019-07-30 16:28:25 +08:00
NIC619
2d4e23cfe2
Fix cyclic import and lint
2019-07-30 16:28:05 +08:00
NIC619
a4a0d79f6d
Improve import layout
2019-07-30 16:27:29 +08:00
NIC619
d716e90e17
Fix on type hints
2019-07-30 16:25:33 +08:00
NIC619
edd164c878
Add type hints to network folder
2019-07-30 16:25:17 +08:00
mhchia
8f9e5a28ff
Temp
2019-07-24 21:54:36 +08:00
ZX
49384ad3d7
Merge pull request #159 from libp2p/security-dev
...
Implement security
2019-05-07 09:56:19 -04:00
stuckinaboot
ff500e6d8e
Merge branch 'master' into security-dev
2019-05-01 17:26:23 -04:00
Stuckinaboot
4333c2d061
Fix linting issues'
2019-05-01 13:54:19 -04:00
Stuckinaboot
f59f27d4d0
Integrate security selectin into libp2p system
2019-04-30 03:09:05 -04:00
zixuanzh
8ab387ac05
refactor add_router in swarm
2019-04-28 15:00:43 -04:00
ZX
21a99287b1
Merge branch 'master' into router-refactor
2019-04-28 14:51:54 -04:00
zixuanzh
35f75c4dcd
move transport to swarm constructor
2019-04-24 22:36:09 -04:00
Alex Haynes
7962060cc0
refactored routedhost into router passed to swarm
2019-04-24 22:17:35 -04:00
stuckinaboot
57077cd3b4
[WIP] PubSub and FloodSub development ( #133 )
...
* Add notifee interface
* Add notify function to network interface
* Implement notify feature
* Add tests for notify
* Make notifee functions all async
* Fix linting issue
* Fix linting issue
* Scaffold pubsub router interface
* Scaffold pubsub directory
* Store peer_id in muxed connection
* Implement pubsub notifee
* Remove outdated files
* Implement pubsub first attempt
* Prepare pubsub for floodsub
* Add mplex conn to net stream and add conn in notify tests
* Implement floodsub
* Use NetStream in generic protocol handler
* Debugging async issues
* Modify test to perform proper assert. Test passes
* Remove callbacks. Reduce sleep time
* Add simple three node test
* Clean up code. Add message classes
* Add test for two topics
* Add conn to net stream and conn tests
* Refactor test setup to remove duplicate code
* Fix linting issues
* Fix linting issue
* Fix linting issue
* Fix outstanding unrelated lint issue in multiselect_client
* Add connect function
* Remove debug prints
* Remove debug prints from floodsub
* Use MessageTalk in place of direct message breakdown
* Remove extra prints
* Remove outdated function
* Add message to queues for all topics in message
* Debugging
* Add message self delivery
* Increase read timeout to 5 to get pubsub tests passing
* Refactor testing helper func. Add tests
* Add tests and increase timeout to get tests passing
* Add dummy account demo scaffolding
* Attempt to use threads. Test fails
* Implement basic dummy node tests using threads
* Add generic testing function
* Add simple seven node tree test
* Add more complex seven node tree tests
* Add five node ring tests
* Remove unnecessary get_message_type func
* Add documentation to classes
* Add message id to messages
* Add documentation to test helper func
* Add docs to dummy account node helper func
* Add more docs to dummy account node test helper func
* fixed linting errors in floodsub
* small notify bugfix
* move pubsub into libp2p
* fixed pubsub linting
* fixing pubsub test failures
* linting
2019-03-23 13:52:02 -04:00
Stuckinaboot
a5fa053815
Add return value to Notify
2019-03-15 11:22:20 -04:00
Stuckinaboot
01099e9f2c
Add opened_stream call for non-initiator
2019-03-15 11:22:20 -04:00
Stuckinaboot
22d6c97ef3
Add conn to net stream and conn tests
2019-03-15 11:22:20 -04:00
Stuckinaboot
670076035c
Fix linting issue
2019-03-15 11:22:20 -04:00