Commit Graph

137 Commits

Author SHA1 Message Date
mhchia
a9f4f285ee
Noise: clean up dup code 2020-02-28 15:50:01 +08:00
mhchia
13e8f496a7
Noise: add noise option in the factories and tests 2020-02-28 15:50:01 +08:00
mhchia
1d2a976597
Remove TODOs 2020-02-28 15:50:00 +08:00
mhchia
48a7c1a969
Security: ensure remote pubkeys are stored 2020-02-28 15:50:00 +08:00
mhchia
f0df2d189f
Plaintext: use existing msgio reader 2020-02-28 15:49:59 +08:00
mhchia
3c2e835725
Security: SecureSession
Make security sessions(secio, noise) share the same implementation
`BaseSession` to avoid duplicate implementation of buffered read.
2020-02-28 15:49:59 +08:00
mhchia
2df47a943c
Refactor 2020-02-28 15:49:59 +08:00
mhchia
ea645f0bd6
Copied read/write from secio 2020-02-28 15:49:58 +08:00
mhchia
f8739268e2
Noise: encrypt and decrypt in NoiseConnection
TODO: Add a buffer to read only `n` bytes in `read(n)`
2020-02-28 15:49:58 +08:00
mhchia
6ea96e9313
Add comments in pattern xx 2020-02-28 15:49:57 +08:00
mhchia
d0290d2b5a
Noise: complete handshake process
TODO
- Figure out why `state.rs` is erased at some moment(even handshake
is not done).
- Refactor
- Add tests
2020-02-28 15:49:56 +08:00
mhchia
8a4ebd4cbb
Support read/write of noise msg and payload 2020-02-28 15:49:56 +08:00
mhchia
95959725db
Noise pattern: Fix flake8 2020-02-15 12:18:19 +08:00
mhchia
d7fabab3e1
Noise: add compiled pb2.py 2020-02-09 13:23:12 +08:00
mhchia
0324a69841
Noise: add PatternXX 2020-02-09 00:33:26 +08:00
mhchia
f27db83a14
Noise: add TODO comments 2020-02-08 10:48:29 +08:00
mhchia
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
Kevin Mai-Husan Chia
1152f9b703
Update libp2p/security/noise/transport.py
Co-Authored-By: Alex Stokes <r.alex.stokes@gmail.com>
2020-02-08 10:14:35 +08:00
mhchia
897e66b7e1
Add the skeletons of noise transport and conn 2020-02-07 17:47:50 +08:00
mhchia
f1dbd52d67
Merge branch 'master' into feature/trio 2020-02-06 10:39:54 +08:00
mhchia
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
Jonathan de Jong
b1248ff315 enforced f-strings everywhere, %s on logging
extended _multiaddr_from_socket to support UDP and IPv6 automatically
changed TCPListener to use _ip4_or_6_from_multiaddr to get host, and not ip4 only

enforced `from error` everywhere with raises
added call braces to exceptions
2019-12-19 17:31:18 +01:00
NIC Lin
cac7e3909a
Merge pull request #357 from NIC619/minor_fix_replace_del
Replace (check and) del pattern with pop method
2019-11-26 19:39:41 +08:00
Chih Cheng Liang
bcd7890124
Move test utilities to tools (#356)
* move test factories to libp2p/tools

* remove unused inits

* move pubsub test utils to tools

* cleanup test_interop

* fix typing libp2p/tools/utils

* add typing to pubsub utils

* fix factories typing

* fix typing for floodsub_integration_test_settings

* fix rest of the typing

* fix isort
2019-11-21 11:47:54 +08:00
NIC619
19907e18ec
Replace (check and) del pattern with pop method 2019-11-20 23:06:37 +08:00
Alex Stokes
2a7b43d853
bugfix: return empty bytes immediately if read length is 0 2019-11-07 20:57:55 -08:00
Piper Merriam
ded3792924
Merge pull request #331 from dmuhs/fix/docs-format
Add automatic docstring formatting
2019-10-28 09:39:52 -06:00
Alex Stokes
f2bfc68f6d
Re-generate protobufs 2019-10-25 18:51:57 +09:00
Dominik Muhs
bafdd8512d Enforce pre-summary newline in docstrings 2019-10-24 20:10:45 +02:00
Dominik Muhs
09ab6c51ec Fix formatting in secio transport 2019-10-24 19:52:03 +02:00
Dominik Muhs
021c92ea25 Rename secio initiator flags 2019-10-24 19:22:24 +02:00
Dominik Muhs
7ad96d167c Rename InsecureSession initiator flag 2019-10-24 19:18:29 +02:00
Dominik Muhs
18783b82a2 Rename SecurityMultistream initiator flag 2019-10-24 19:17:00 +02:00
Dominik Muhs
ee0b4daf1c Rename BaseSession initiator flag 2019-10-24 19:16:08 +02:00
Dominik Muhs
eef505f2d9 Add automatic docstring formatter and apply 2019-10-24 08:41:10 +02:00
NIC619
9889cb8ab1
Fix wrong import 2019-10-18 15:44:07 +08:00
NIC619
5063f0e2a6
Fix lint 2019-10-17 15:34:11 +08:00
NIC619
49bd460e37
Catch SedesException in deserialize_public_key 2019-10-17 15:19:39 +08:00
NIC619
da08d37c38
Add SedesException SecioException 2019-10-17 15:03:18 +08:00
NIC619
29bf623d2c
Raise DecryptionFailedException
when failed to decrypt read msg
2019-10-17 14:30:30 +08:00
Alex Stokes
6e53849604
Delete utils in favor of serialization module 2019-09-24 09:51:31 -07:00
mhchia
37bee9fb16
PR feedback
- Use `TMuxerOptions` and `TSecurityOptions` in libp2p/__init__.py
- Remove the default value for `muxer_transports_by_protocol` in
`MuxerMultistream` and `secure_transports_by_protocol`
`SecureMultistream`
2019-09-24 12:51:59 +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
NIC619
7fc958e7be
Add exception raised to docstring 2019-09-19 22:19:36 +08:00
mhchia
a9ad37bc6f
Add mplex tests and fix error in SwarmConn.close 2019-09-19 16:31:41 +08:00
NIC619
0080466d86
Handle RawConnError in InsecureSession.run_handshake 2019-09-16 19:16:41 +08:00
NIC619
09bfa0ab09
Handle IOException in create_secure_session 2019-09-16 19:15:40 +08:00
NIC619
c7593bff97
Add InconsistentNonce in secio 2019-09-16 19:11:46 +08:00
NIC619
359bcf45ff
SecioException inherit from HandshakeFailure 2019-09-16 19:11:06 +08:00
NIC619
d6dda91482
Move HandshakeFailure to libp2p.security 2019-09-16 19:09:09 +08:00