* Muxer selection in TLS handshake first cut
* Clean up some part of the code
* Change earlydata to ConnectionState for security connection.
* resolve merging conflicts
* Add stubs for noise
* clean up code
* Switch over to passing muxers to security transport constructors
* Address feedback points
* Update p2p/net/upgrader/upgrader.go
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* clean up accidental checked file.
* Review points round 2
* Address some go nit points
* Update tls transport test to address review points
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* noise: make it possible for the server to send early data
* noise: use separate early data handlers for initiator and responder
* noise: use a 2 kb buffer for all handshake operations
* Add comments around EarlyData(Handler)
* noise: send early data with 2nd and 3rd handshake message
* Update p2p/security/noise/session_transport.go
Co-authored-by: Marco Munizaga <git@marcopolo.io>
* bump go.mod to Go 1.18 and run go fix
* bump go.mod to Go 1.18 and run go fix
* bump go.mod to Go 1.18 and run go fix
* bump go.mod to Go 1.18 and run go fix
* run gofmt -s
* update .github/workflows/go-test.yml
* update .github/workflows/go-check.yml
* stop using the deprecated io/ioutil package
Co-authored-by: web3-bot <web3-bot@users.noreply.github.com>
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
On my 11th gen Intel laptop, this library is 3x faster than the default
one (and is the one we use in go-multihash).
See below (GEN_ is the builtin version, SHA_ is this library).
BenchmarkHash/SHA_/8Bytes-8 94.31 ns/op 84.82 MB/s
BenchmarkHash/SHA_/1K-8 926.9 ns/op 1104.74 MB/s
BenchmarkHash/SHA_/8K-8 6793 ns/op 1205.98 MB/s
BenchmarkHash/SHA_/1M-8 883694 ns/op 1186.58 MB/s
BenchmarkHash/SHA_/5M-8 4347298 ns/op 1206.01 MB/s
BenchmarkHash/SHA_/10M-8 8810864 ns/op 1190.09 MB/s
BenchmarkHash/GEN_/8Bytes-8 283.2 ns/op 28.25 MB/s
BenchmarkHash/GEN_/1K-8 3587 ns/op 285.48 MB/s
BenchmarkHash/GEN_/8K-8 27706 ns/op 295.68 MB/s
BenchmarkHash/GEN_/1M-8 3414827 ns/op 307.07 MB/s
BenchmarkHash/GEN_/5M-8 16789216 ns/op 312.28 MB/s
BenchmarkHash/GEN_/10M-8 34073478 ns/op 307.74 MB/s
Previously, each noise message read would make two syscalls:
1. one to read the length prefix.
2. one to read the encrypted payload.
This patch adds bufio.Reader mediation to cushion syscalls, and
significantly enhaces throughput in read-dominated connections, such
as file transfers.