summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDaniel McCarney <daniel@binaryparadox.net>2024-01-02 09:56:42 -0500
committerDaniel McCarney <daniel@binaryparadox.net>2024-01-03 15:05:38 +0000
commit0d7c256c32d676c7278c846f49ea8b1622d06a66 (patch)
tree5073e706d2d6884c6769efca6fc79c50744c144d /examples
parentc9963b0eccbef3f6ddf86f3f1686c2ea3cff45b5 (diff)
docs: add README for examples
* Inventory of the existing examples, with brief descriptions * Guidance to look at the "simple" examples first.
Diffstat (limited to 'examples')
-rw-r--r--examples/README.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 00000000..b807bef1
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,21 @@
+# Rustls Examples
+
+This directory contains a number of examples that use Rustls.
+
+We recommend new users start by looking at `simpleclient.rs` and `simpleserver.rs`. Once those are understood, `tlsclient-mio.rs` and `tlsserver-mio.rs` provide more advanced examples.
+
+## Client examples
+
+* `simpleclient.rs` - shows a simple client configuration that uses sensible defaults. It demonstrates using the `Stream` helper to treat a Rustls connection as you would a bi-directional TCP stream.
+* `tlsclient-mio.rs` - shows a more complete client example that handles command line flags for customizing TLS options, and uses MIO to handle asynchronous I/O.
+* `limitedclient.rs` - shows how to configure Rustls so that unused cryptography is discarded by the linker. This client only supports TLS 1.3 and a single cipher suite.
+* `simple_0rtt_client.rs` - shows how to make a TLS 1.3 client connection that sends early 0RTT data.
+* `unbuffered-client.rs` - shows an advanced example of using Rustls lower-level APIs to implement a client that does not buffer any data inside Rustls.
+* `unbuffered-async-client.rs` - shows an advanced example of using Rustls lower-level APIs to implement a client that does not buffer any data inside Rustls, and that processes TLS events asynchronously.
+
+## Server examples
+
+* `simpleserver.rs` - shows a very minimal server example that accepts a single TLS connection. See `tlsserver-mio.rs` or `server_acceptor.rs` for a more realistic example.
+* `tlsserver-mio.rs` - shows a more complete server example that handles command line flags for customizing TLS options, and uses MIO to handle asynchronous I/O.
+* `server_acceptor.rs` - shows how to use the `Acceptor` API to create a server that generates a unique `ServerConfig` for each client. This example also shows how to use client authentication, CRL revocation checking, and uses `rcgen` to generate its own certificates.
+* `unbuffered-server.rs` - shows an advanced example of using Rustls lower-level APIs to implement a server that does not buffer any data inside Rustls.