Commit graph

178 commits

Author SHA1 Message Date
9c2b3482e5 xso: Add PrintRawXml helper struct with Display
Some checks failed
Build / lint (push) Has been cancelled
Build / test-stable (push) Has been cancelled
Build / test-nightly (push) Has been cancelled
Add a helper struct to be able to display Raw Xml, useful for debug
logs.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-11-19 19:29:24 +01:00
Alvaro Parker
347e8d6f17 Impl Error for ReadError 2024-09-20 15:17:54 -03:00
Emmanuel Gil Peyrot
c24275c098 tokio-xmpp: Add support for kernel TLS
This drastically improve the debuggability of the network parts, by
moving the task of encrypting/decrypting TLS packets from userland to
the kernel.  This makes them appear in clear in strace as sendto() and
recvfrom().

I introduced a new tls-rust-ktls feature which depends on both rustls
and ktls, but isn’t enabled by default since it probably isn’t available
on every computer.  It requires the tls kernel module to be loaded,
which then can offload encryption/decryption to dedicated hardware if
available.

I have tested this change on Linux 6.11 on a rk3588.
2024-09-17 20:45:41 +00:00
Alvaro Parker
904bdeae11 add debug to StreamHeader 2024-09-17 12:07:06 -03:00
Emmanuel Gil Peyrot
ebfae4bddc tokio-xmpp: Run rustfmt on that one example
It started breaking CI for some reason, probably a rustfmt update.
2024-09-16 23:32:49 +02:00
Alvaro Parker
2ff89a9e42 fix typos 2024-09-16 18:29:44 -03:00
Emmanuel Gil Peyrot
425be4bef4 tokio-xmpp: Improve highlight_xml()
First switch to LazyLock from OnceLock, to simplify the code.

Then concatenate the colour reset escape code instead of using
format!(), since the vast majority of those strings have more capacity
than their length it will avoid a reallocation in most cases.
2024-09-01 12:32:50 +02:00
Jonas Schäfer
263839a5f8 xmlstream: add tests to capture thingy
This would've caught the embarrassing error made in the previous commit.
2024-09-01 09:07:34 +00:00
Jonas Schäfer
c795921631 xmlstream: fix crash
This happened when (a bit too hastily) applying suggestions from a
review.
2024-09-01 09:07:34 +00:00
Jonas Schäfer
ce4b739026 xmlstream: allow simplex stream shutdown
Unlike poll_close, poll_shutdown will only kill the sending side of the
stream. This is relevant to perform a fully clean shutdown procedure in
XMPP.
2024-09-01 10:02:36 +02:00
Jonas Schäfer
4cfe4f8429 xmlstream: implement simple timeout logic
This allows to detect and handle dying streams without getting stuck
forever.

Timeouts are always wrong, though, so we put the burden of choosing the
right values (mostly) on the creator of a stream.
2024-09-01 10:02:36 +02:00
Jonas Schäfer
960fd782bd xmlstream: fix clean shutdown sequence
Without the early return in XmlStream::poll_next in case of the stream
footer, the read state gets recreated and the logic at the top of that
function to actually handle stream shutdown gracefully is never
triggered.

Also that logic was incorrect; the correct behaviour is to wait for the
true EOF.
2024-09-01 10:02:36 +02:00
Jonas Schäfer
efc859abc0 xmlstream: re-introduce syntax-highlit logging of XML stream I/O 2024-09-01 10:02:36 +02:00
Jonas Schäfer
51884eedf7 Fix missing copyright header 2024-08-30 15:40:32 +02:00
Jonas Schäfer
c85c98b0bf xmlstream: improve responder-side of stream resets
This makes the stream resets a lot safer, by preventing the forbidden
send-read-reset combination of events: the reset function on the
responder side now takes the element to send right before the reset,
enforcing a send-reset pattern.
2024-08-29 16:47:13 +02:00
Jonas Schäfer
ab10e30ac0 Port crates to use new XSO-based xmlstream 2024-08-29 16:47:13 +02:00
Jonas Schäfer
7cfda820a6 xmlstream: introduce XMPP specifics 2024-08-29 16:43:20 +02:00
Jonas Schäfer
2c944ebbf8 xmlstream: add access to inner stream 2024-08-29 16:43:06 +02:00
Jonas Schäfer
2931df22db xmlstream: split initiation reset in two phases 2024-08-29 16:43:00 +02:00
Jonas Schäfer
c723897326 tokio_xmpp: introduce xmlstream module
This module provides XSO-based parsing, proper typestates and will
soon replace the proto module.
2024-08-29 16:42:57 +02:00
schnell
274baaef9a
add support for local trust store for rustls
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-08-22 15:38:39 +02:00
Jonas Schäfer
f77c21f0fc Update to rxml 0.12.0 2024-08-12 16:16:32 +02:00
xmppftw
cc3400bac7 Reorganize component modules 2024-08-12 10:59:20 +00:00
xmppftw
e6863bd9dd Reorganized client modules 2024-08-12 10:59:20 +00:00
xmppftw
df106dfbaf Relative dependencies 2024-08-12 10:39:09 +00:00
xmppftw
c63b554e9e Fix broken link 2024-08-11 20:06:39 +02:00
xmppftw
38baf53de5 Absolute document link 2024-08-11 17:42:58 +00:00
xmppftw
9f4af1625d Component is now behind insecure-tcp feature flag 2024-08-10 18:09:12 +02:00
xmppftw
16a78d3bb5 More documentation for tokio_xmpp 2024-08-10 16:57:51 +02:00
xmppftw
0b58561003 Rename AsyncClient to Client 2024-08-10 16:57:51 +02:00
xmppftw
311e7406f0 Make Client and Component more unified, and connectors too 2024-08-10 16:57:49 +02:00
xmppftw
fde4c2b640 Move XmppCodec and XmppStream to proto module 2024-08-10 16:49:26 +02:00
xmppftw
ec3c7694a7 Moved starttls connector to tokio_xmpp::connect::starttls module 2024-08-10 16:49:26 +02:00
xmppftw
9151461b10 TCP connector is now in connect module 2024-08-10 16:49:26 +02:00
xmppftw
a3fbd77050 Remove tokio_xmpp::SimpleClient 2024-08-10 16:49:24 +02:00
xmppftw
97698b4d1e Add dns feature for DNS stuff (not just in starttls) 2024-08-10 16:48:47 +02:00
Emmanuel Gil Peyrot
27e4499153 xmpp-parsers: Simplify SASL mechanisms type
These can be a simple String for now.
2024-08-08 13:52:01 +00:00
xmppftw
2fc8e1c1dd AsyncClient::new reconnects by default, fixes disconnect logic 2024-08-08 15:33:17 +02:00
Emmanuel Gil Peyrot
35932268af tokio-xmpp: Error out when the stream:features couldn’t be parsed
This is nicer than sleeping forever with no debug info whatsoever.
2024-08-06 16:14:42 +02:00
xmppftw
fa99c09585 Indicate which feature flag for each module/type 2024-08-05 11:14:41 +02:00
xmppftw
b3fd0b5372 Move SimpleClient constructors to client::simple_client module 2024-08-04 21:32:38 +02:00
xmppftw
fc0071a0c5 Move AsyncClient::new to client::async_client module 2024-08-04 21:32:36 +02:00
xmppftw
84511b54a0 Only expose one error type in crate root 2024-08-04 18:17:17 +02:00
xmppftw
34796c90d4 Only expose one error type in crate root 2024-08-04 16:04:09 +00:00
xmppftw
5de1891f06 Merged starttls::ConnectorError into starttls::Error 2024-08-04 12:39:56 +00:00
xmppftw
b9fc15977b Replace tokio_xmpp::stream_features with parsers 2024-08-02 18:25:32 +00:00
xmppftw
ee3d86ec42 Remove tokio_xmpp::ParseError and tokio_xmpp::starttls::ParseError 2024-08-01 12:55:17 +00:00
1a452523bd
tokio-xmpp: Bump version to 4.0
Some checks failed
Build / lint (push) Has been cancelled
Build / test-stable (push) Has been cancelled
Build / test-nightly (push) Has been cancelled
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-28 01:00:01 +02:00
6995961d38 tokio-xmpp: Update ChangeLog
Some checks failed
Build / lint (push) Has been cancelled
Build / test-stable (push) Has been cancelled
Build / test-nightly (push) Has been cancelled
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-27 19:04:03 +02:00
5b1706a311
tokio-xmpp: Update dependencies
Update tokio_rustls, idna, webpki_roots.

https://github.com/rustls/rustls/releases/tag/v%2F0.22.0
> ConfigBuilder::with_safe_defaults - calls to this can simply be deleted since safe defaults are now implicit.
> OwnedTrustAnchor - use rustls_pki_types::TrustAnchor instead, and replace from_subject_spki_name_constraints with direct assignment to the struct fields.

`RootCertStore::add_trust_anchors` seems to be removed too.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-25 20:51:20 +02:00