Commit Graph

106 Commits

Author SHA1 Message Date
Raúl Kripalani 99a65b744b improve comments and readability. 2020-04-23 18:11:09 +01:00
Raúl Kripalani 803b648b92 make Read conform to io.Reader behaviour + performance opt.
- Read() used to behave like io.ReadFull(); it now behaves like
   io.Reader mandates.
 - preallocate 2-byte (long) slices for message length calculation.
 - on read, copy directly to supplied buffer, if the message is
   smaller or equal to len(buffer).
 - use buffer pools (via go-buffer-pool) to contain allocs and GC.
2020-04-23 17:54:47 +01:00
Raúl Kripalani 4dad9a3101 bench: reset timer + report allocs. 2020-04-23 13:29:40 +01:00
Raúl Kripalani ef4c4223d1 propagate context deadlines to handshake.
Fixes https://github.com/libp2p/go-libp2p-noise/issues/75.
2020-04-23 10:47:29 +01:00
Raúl Kripalani 1ecc08a61b refine comments. 2020-04-23 10:47:29 +01:00
Raúl Kripalani c242789e58 wrap errors. 2020-04-23 10:47:29 +01:00
Raúl Kripalani fac8488ec4 remove ETHBerlin pdf. 2020-04-23 10:47:29 +01:00
Yusef Napora 7a756b9abf Merge pull request #56 from libp2p/refactor/flynn
Replace noise explorer code with flynn/noise library
2020-03-03 13:09:16 -05:00
Yusef Napora 370abe0244 rm dead code 2020-03-03 09:45:14 -05:00
Yusef Napora dd7ccf8247 make handshake state local to runHandshake 2020-03-03 09:34:31 -05:00
Yusef Napora 1edb96a9e1 make crypto methods private 2020-03-03 09:34:03 -05:00
Yusef Napora db01d6a881 cleanup 2020-03-03 09:34:03 -05:00
Yusef Napora 5974ecc852 factor out processing remote handshake payload 2020-03-02 16:33:58 -05:00
Yusef Napora 70efae2bed refactor internal session state 2020-03-02 16:20:51 -05:00
Yusef Napora 6e4c6b8ea0 move static keygen to session 2020-03-02 15:21:35 -05:00
Yusef Napora b152f9d628 replace noise explorer with flynn/noise 2020-03-02 15:21:35 -05:00
Yusef Napora 5d2c4148f6 add benchmark tests 2020-03-02 15:21:35 -05:00
Yusef Napora 4d642f648c fix EOF handling in Read 2020-03-02 15:21:35 -05:00
Yusef Napora 1bdb5d3916 test crypto error cases 2020-02-28 11:10:59 -05:00
Yusef Napora 9df4fe637c cleanup 2020-02-28 11:10:59 -05:00
Yusef Napora 2f38053ad5 remove noise pipes & associated code 2020-02-28 11:10:59 -05:00
Yusef Napora 7aa706618c add test for peer id mismatch 2020-02-03 10:49:15 -05:00
Yusef Napora 9f6c7d6cde fix peer ID check in IK handshake 2020-02-03 10:24:50 -05:00
Yusef Napora 4d60c61b7c rm debug logs 2020-02-03 10:18:02 -05:00
Yusef Napora 8b7f580cbf don't log all errors
Also, return errors when validating handshake payloads and remote
peer IDs. These were being logged but not returned, so the handshake
would complete successfully even if the payload signature was
invalid
2020-02-03 10:15:20 -05:00
Yusef Napora a1e6857b5c Merge pull request #39 from libp2p/fix/cleanup
use io.ReadFull instead of custom helper
2020-01-29 09:58:58 -05:00
Yusef Napora 268e9e2936 use io.ReadFull instead of custom helper 2020-01-29 09:55:49 -05:00
Yusef Napora 3971c24bec Merge pull request #38 from libp2p/fix/stream-reset
Make sure we actually read and write as much data as we expect
2020-01-29 09:25:31 -05:00
Yusef Napora 7df3fe54e9 make sure we fill buffer when reading from conn
adds fillBuffer and writeAll helpers to make sure that we're actually
filling our input buffers when reading from the insecure conn, and
that we're writing the entire output buffer, even if it takes multiple
calls to insecure.Read or insecure.Write
2020-01-29 09:08:15 -05:00
Yusef Napora 297dd7fae9 send much more data in integration test 2020-01-29 09:08:15 -05:00
Yusef Napora 8c0011194e fix protocol id in integration test 2020-01-29 09:08:15 -05:00
Yusef Napora a57e711592 Merge pull request #36 from libp2p/proto-field-rename
Rename protobuf fields in handshake payload
2020-01-29 08:51:40 -05:00
Yusef Napora a82be49036 rename protobuf fields 2020-01-20 10:37:23 -05:00
Yusef Napora d0ed06d10b add Makefile for generating protobuf code 2020-01-20 10:30:55 -05:00
Yusef Napora e616482ec8 use empty prologue 2020-01-11 09:26:45 -05:00
Yusef Napora 192f8eb236 derive session params from Transport 2019-12-12 16:23:49 -05:00
Yusef Napora eb5f403c33 make Transport and config fields private 2019-12-12 16:23:49 -05:00
Yusef Napora ff835a9cd9 camelCase field names 2019-12-12 16:23:49 -05:00
Yusef Napora f360c666bd move Keypair to its own file 2019-12-12 16:23:17 -05:00
Yusef Napora 8feb08c015 Merge pull request #28 from libp2p/fix/handle-keygen-errors
don't swallow errors from rand.Read
2019-12-12 16:18:57 -05:00
Yusef Napora 8a5063a99d rm redundant check for num bytes read 2019-12-12 15:51:51 -05:00
Yusef Napora c67695a72e don't swallow errors from rand.Read 2019-12-11 19:29:39 -05:00
Yusef Napora fc5d11363d Merge pull request #17 from libp2p/feat/transport-options
use Options to configure transport
2019-12-11 17:27:33 -05:00
Yusef Napora 8ab00e7201 rename constructors 2019-12-11 17:25:40 -05:00
Yusef Napora ca63ecd6bc use Options to configure transport
also, adds NewTransportGenerator for cases when you don't know the
libp2p host key when configuring the Noise transport
2019-12-11 17:25:40 -05:00
Yusef Napora 30b7a7dbbd Merge pull request #27 from libp2p/fix/protocol-id
fix protocol id string
2019-12-11 16:52:46 -05:00
Yusef Napora 8349e50943 fix protocol id string 2019-12-11 16:18:19 -05:00
Yusef Napora b72caed3da guard static key cache with mutex 2019-12-06 15:13:51 -05:00
Yusef Napora 1d0d036ac0 rename imports from ChainSafe to libp2p org 2019-12-06 13:28:22 -05:00
Yusef Napora e360301114 Merge pull request #10 from libp2p/feat/message-chunking
Split large payloads into chunks
2019-12-06 12:47:45 -05:00