Commit Graph
160 Commits
Author SHA1 Message Date
Floris Bruynooghe d64d12db44 feat: Add option to use SSLKEYLOGFILE env var (#153)
This adds support for the SSLKEYLOGFILE environment variable which is
a common standard used by browsers to log the TLS keys used for
connections.  It allows traffic inspectors like tcpdump and wireshark
to use the logged keys and decrypt the traffic.  Using this is a first
step to allowing us to observe our protocol on the wire.

The support is still hidden behind a commandline option so that it can
not be accidentally enabled by only having an environment variable
set.
2023-02-20 10:47:30 +01:00
Kasey 19e2b058c5 fix: ensure we emit TransferAborted event if anything goes wrong during the transfer (#150)
This refactor splits the `handle_stream` function up into smaller
(logical) functions. If these functions error, we can emit a
`TransferAborted` event before returning the error.

This has the added benefit of making the `handle_stream` function a bit
easier to take in. None of these new functions have any code changes,
the only difference is how errors are handled and when we return.
2023-02-17 13:53:39 -05:00
Friedel ZiegelmayerandFloris Bruynooghe 153073a937 start debugging earyl close (#148)
When finished with a stream you have to read to EOF. Sometimes the
sender could be sending the FIN bit in an empty STREAM frame after all
the data is sent, if the receiver did not read EOF in this case the
receiver will still implicitly call `RecvStream::stop` on drop, making
the stream error for the sender.

Co-authored-by: Floris Bruynooghe <flub@devork.be>
2023-02-16 13:52:08 +01:00
Floris Bruynooghe 2edb528007 fix: MSRV in CI (#145)
There's even a comment.  But I seem to have ignored that.
2023-02-15 16:00:40 +01:00
Rüdiger Klaehn 21a5cfd47e Merge pull request #138 from n0-computer/multi-threaded-add
refactor: use multi threading when computing outboards
2023-02-15 15:19:39 +02:00
Floris Bruynooghe c0fafdbcba Fix QUIC stream completion (#143)
Sending a STOP_STREAM frame from the receiver is the way for a receiver
to go to the reset state. It involves sending an extra frame, the
receiver will then send its own RESET_STREAM frame and the stream is
considered ended in an error state.

Instead the right way to end a stream is to set the FIN bit on the final
STREAM frame, ideally not even resulting in an extra frame or packet
sent. This is done on the sender side.
2023-02-15 14:04:51 +01:00
Rüdiger Klaehn 1c6c75fd38 Merge pull request #144 from n0-computer/integrated-bao
ref: use our own bao crate abao
2023-02-15 12:03:47 +02:00
Ruediger Klaehn 659d2d2225 ref: use our own bao crate
Requires just a tiny code change since bao takes a reference of a hash
instead of the value.
2023-02-15 10:44:31 +02:00
Floris Bruynooghe f3086a9576 ref: Allow older rust version (#142)
This matches the rust-version from deltachat and everything still
seems to work.  Not sure why we have the more recent version.
2023-02-14 15:48:43 +01:00
Floris Bruynooghe d09a78636b feat: Add generic progress emitter utility (#141)
This adds a generic utility which can be used to track progress of
data transfers by emitting progress via a tokio broadcast channel.

This is extracted from the deltachat PR:
https://github.com/deltachat/deltachat-core-rust/pull/4007
2023-02-14 13:17:21 +01:00
Kasey c266ab5d9d fix: fail if an on_blob function does not read all the content (#139)
closes #127
2023-02-13 13:32:36 -05:00
Asmir Avdicevic fc8fbeb65c fix(ci): run clippy directly (#140) 2023-02-13 19:30:36 +01:00
Floris Bruynooghe 5bd545d8eb feat: Do not error when the provider closes the connection (#124)
This makes it so that the provider is allowed to close the connection
after a transfer is completed, without the getter resulting in an
error.

It modifies the provider to only emit the transfer completed once the
data has actually reached the client.
2023-02-13 16:34:49 +01:00
Floris Bruynooghe 8e42874a23 deps: Remove duplicate tokio dependency (#137)
The tokio feature of tracing-futures seems crazy outdated and not
needed.  Enabling it pulls in an ancient version of tokio for no
reason whatsoever.  Get rid of it.
2023-02-13 14:12:42 +01:00
Floris Bruynooghe eac7b65a67 ref: on_collection doesn't need to be FnMut (#136)
It is only called once, adding FnMut is a needless restriction.

Closes #133
2023-02-13 14:11:55 +01:00
Ruediger Klaehn a4a3d546d1 docs: add some comments 2023-02-13 14:48:34 +02:00
Ruediger Klaehn 34cf223098 refactor: use multi threading when computing outboards
I did not do this previously because something wasn't ready.
But now I think it is time.
2023-02-13 14:07:19 +02:00
Kasey b3ee39f92f fix: display CIDs in the CLI for the Collection (#131)
closes #130
2023-02-10 02:30:40 -05:00
Kasey 82e2f5649b fix: catch ctrl-c to allow a normal shutdown & clean up any tempfiles that are created (#122)
closes #102
2023-02-08 12:12:02 -05:00
Rüdiger Klaehn 145ec43eb1 Merge pull request #126 from n0-computer/collection-by-ref
refactor: make on_collection take a reference
2023-02-08 16:53:10 +02:00
Ruediger Klaehn 34aa8e1514 refactor: make on_collection take a reference
This way we avoid a clone
2023-02-08 16:31:25 +02:00
Rüdiger Klaehn 1a127fac65 Merge pull request #123 from n0-computer/cid
Add newtype wrapper for Hash that is compatible with Cid
2023-02-07 16:40:38 +02:00
Ruediger Klaehn 2e3d5777ea Merge branch 'main' into cid 2023-02-07 16:00:42 +02:00
Ruediger Klaehn f780d253c8 pr review: some renaming 2023-02-07 15:44:58 +02:00
Ruediger Klaehn 838fa5cb7e docs: add docs for the 4 prefix bytes 2023-02-07 15:17:01 +02:00
Ruediger Klaehn 7158bc047c refactor: move Blake3Cid to main for now 2023-02-07 14:58:40 +02:00
Floris Bruynooghe 13f703f0ef feat: Allow shutdown of Provider (#121)
This adds Provider::shutdown allowing to stop the Provider without
having to abort it.  On the wire however it still does not do anything
graceful: all the connections are stopped and any in-transit data is
lost.

Additionally this adds tracing spans to the connection handling.

Finally it fixes a bug where read_lp would not return None if the
connection was closed normally.

Part of #77 but this is not very graceful on the wire yet.
2023-02-07 12:56:35 +01:00
Ruediger Klaehn 9db0937cb6 feat: add newtype wrapper for Hash that is compatible with Cid 2023-02-07 13:08:28 +02:00
Friedel Ziegelmayer 3eff210755 feat: switch from s2n-quic to quinn (#112)
Tests are failing because of port reuse issues and shutdown, should be
fixed with the other PRs merged

Needed to allow work on hole punching in the short term.

Ref #111 

See

- https://github.com/aws/s2n-quic/issues/1607
- https://github.com/aws/s2n-quic/issues/1608
2023-02-06 17:36:50 +01:00
Floris Bruynooghe 9a22de7e1f Make Provider a Future, remove Provider::join (#120)
This removes the consuming Provider::join method and makes Provider impl
a
Future directly.  This mirrors how a JoinHandle for a tokio task
behaves, which is what this also kind off is.

Primarily this allowes for the await-completion operation to be
cancelable and re-entrant.  This is needed to be able to await
completion of the task in a loop, repeatedly calling tokio::select!
with it.
2023-02-06 17:29:07 +01:00
Rüdiger Klaehn 321ed44b21 Merge pull request #116 from n0-computer/reduce-surface-area
Reduce surface area
2023-02-06 17:07:01 +02:00
Ruediger Klaehn c08fe11c4e pr review: add better module docs etc. 2023-02-06 15:47:40 +02:00
Ruediger Klaehn 8255467c9a docs: add lots of doc comments and enable deny(missing_docs) 2023-02-06 13:50:36 +02:00
Ruediger Klaehn 5994474c4d refactor: more privatization 2023-02-06 13:32:37 +02:00
Ruediger Klaehn d63fea1279 refactor: make a few obvious things private 2023-02-06 13:26:00 +02:00
Floris Bruynooghe eb48132c9c ref: pub api tweaks (#114)
A number of tweaks to the public API that I'm using in the deltachat
PR.
2023-02-06 11:00:56 +01:00
Friedel Ziegelmayer c1eaf28fcc feat: introduce custom Hash type (#115)
- avoids relying on blake3::Hash as a type in the public api
- ensures consistent encoding and decoding
- fixes bug where hex decoding was expected in the UI
2023-02-03 22:34:25 +01:00
Rüdiger Klaehn 694d117315 Merge pull request #113 from n0-computer/async-slice-decoder-newtype
refactor: make AsyncSliceDecoder pub(crate)
2023-02-03 19:58:31 +02:00
Ruediger Klaehn be482945c3 pr review: rename BaoDecoder to DataStream and add doc comment 2023-02-03 19:47:33 +02:00
Kasey 8c254f3ea5 use default-features = false when importing sendme as a library (#110)
closes #74 

Isolate `cli` specific crates behind the `cli` feature.
2023-02-03 11:03:17 -05:00
Ruediger Klaehn 6bc00b3558 refactor: make AsyncSliceDecoder pub(crate)
The public interface is now BaoDecoder. A benefit of this is that we
- hide the exact way we decode bao (bao crate or our own thing)
- hide the s2n_quic::stream::ReceiveStream
2023-02-03 15:11:29 +02:00
Friedel Ziegelmayer 909571810d Merge pull request #106 from n0-computer/feat-base64
feat: switch printing from hex to base64
2023-02-03 12:28:02 +01:00
Friedel Ziegelmayer 1abd7ecbff test: use random free port to avoid collisions (#104)
Closes #49
2023-02-03 12:01:38 +01:00
dignifiedquire e2cd922fd8 chore: update MSRV to 1.64
latest clap requires this
2023-02-03 10:11:08 +01:00
dignifiedquire 1cf338d41a chore: remove unused dependency 2023-02-03 10:01:39 +01:00
dignifiedquire 891004d805 feat: switch printing from hex to base64
Closes #91
2023-02-03 10:01:39 +01:00
Friedel Ziegelmayer 01c711a0f4 Merge pull request #109 from n0-computer/ramfox/update_deps
update deps to fix console bug
2023-02-03 09:52:54 +01:00
Rüdiger Klaehn 475e4578a4 Merge pull request #108 from n0-computer/enforce-overall-size
feature: ensure we are not being lied to about total_blobs_size
2023-02-03 08:42:20 +02:00
Kasey 48df01c933 comply w/ MSRV 2023-02-03 01:27:56 -05:00
Kasey 2bd329d805 comply with minimally supported rust version 2023-02-03 01:18:06 -05:00