Skip to content

Commit bbf9510

Browse files
djcRalith
authored andcommitted
book: fix code references
1 parent eec45e6 commit bbf9510

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

docs/book/src/quinn/certificate-certs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::error::Error;
22

3-
use rustls::{client, pki_types::pem::PemObject};
3+
use rustls::pki_types::pem::PemObject;
44

55
fn read_certs_from_file() -> Result<
66
(

docs/book/src/quinn/certificate.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ rustls = { version = "*", features = ["dangerous_configuration", "quic"] }
1919
Then, allow the client to skip the certificate validation by implementing [ServerCertVerifier][ServerCertVerifier] and letting it assert verification for any server.
2020

2121
```rust
22-
{{#include certificate-insecure.rs:5:57}}
22+
{{#include certificate-insecure.rs:8:60}}
2323
```
2424

2525
After that, modify the [ClientConfig][ClientConfig] to use this [ServerCertVerifier][ServerCertVerifier] implementation.
2626

2727
```rust
28-
{{#include certificate-insecure.rs:59:66}}
28+
{{#include certificate-insecure.rs:62:71}}
2929
```
3030

3131
Finally, if you plug this [ClientConfig][ClientConfig] into the [Endpoint::set_default_client_config()][set_default_client_config] your client endpoint should verify all connections as trustworthy.
@@ -45,7 +45,7 @@ This example uses [rcgen][4] to generate a certificate.
4545
Let's look at an example:
4646

4747
```rust
48-
{{#include certificate-certs.rs:14:19}}
48+
{{#include certificate-certs.rs:20:31}}
4949
```
5050

5151
*Note that [generate_simple_self_signed][generate_simple_self_signed] returns a [Certificate][2] that can be serialized to both `.der` and `.pem` formats.*
@@ -68,7 +68,7 @@ certbot asks for the required data and writes the certificates to `fullchain.pem
6868
These files can then be referenced in code.
6969

7070
```rust
71-
{{#include certificate-certs.rs:5:12}}
71+
{{#include certificate-certs.rs:5:18}}
7272
```
7373

7474
### Configuring Certificates
@@ -79,15 +79,15 @@ After configuring plug the configuration into the `Endpoint`.
7979
**Configure Server**
8080

8181
```rust
82-
{{#include certificate-certs.rs:24}}
82+
{{#include certificate-certs.rs:36}}
8383
```
8484

8585
This is the only thing you need to do for your server to be secured.
8686

8787
**Configure Client**
8888

8989
```rust
90-
{{#include certificate-certs.rs:25}}
90+
{{#include certificate-certs.rs:37}}
9191
```
9292

9393
This is the only thing you need to do for your client to trust a server certificate signed by a conventional certificate authority.

docs/book/src/quinn/data-transfer.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ This chapter continues with the subject of sending data over this connection.
66

77
## Multiplexing
88

9-
Multiplexing is the act of combining data from multiple streams into a single stream.
10-
This can have a significant positive effect on the performance of the application.
11-
With QUIC, the programmer is in full control over the stream allocation.
12-
9+
Multiplexing is the act of combining data from multiple streams into a single stream.
10+
This can have a significant positive effect on the performance of the application.
11+
With QUIC, the programmer is in full control over the stream allocation.
12+
1313
## Stream Types
1414

1515
QUIC provides support for both stream and message-based communication.
@@ -28,53 +28,53 @@ New streams can be created with [Connection][Connection]'s [open_bi()][open_bi]
2828

2929
## Bidirectional Streams
3030

31-
With bidirectional streams, data can be sent in both directions.
31+
With bidirectional streams, data can be sent in both directions.
3232
For example, from the connection initiator to the peer and the other way around.
33-
33+
3434
*open bidirectional stream*
3535

3636
```rust
37-
{{#include data-transfer.rs:7:13}}
37+
{{#include data-transfer.rs:4:10}}
3838
```
3939

4040
*iterate incoming bidirectional stream(s)*
4141

4242
```rust
43-
{{#include data-transfer.rs:15:23}}
43+
{{#include data-transfer.rs:12:20}}
4444
```
4545

46-
## Unidirectional Streams
46+
## Unidirectional Streams
4747

4848
With unidirectional streams, you can carry data only in one direction: from the initiator of the stream to its peer.
4949
It is possible to get reliability without ordering (so no head-of-line blocking) by opening a new stream for each packet.
5050

5151
*open unidirectional stream*
5252

5353
```rust
54-
{{#include data-transfer.rs:25:30}}
54+
{{#include data-transfer.rs:22:27}}
5555
```
5656

5757
*iterating incoming unidirectional stream(s)*
5858

5959
```rust
60-
{{#include data-transfer.rs:32:38}}
60+
{{#include data-transfer.rs:29:35}}
6161
```
6262

6363
## Unreliable Messaging
6464

65-
With unreliable messaging, you can transfer data without reliability.
65+
With unreliable messaging, you can transfer data without reliability.
6666
This could be useful if data arrival isn't essential or when high throughput is important.
6767

6868
*send datagram*
6969

7070
```rust
71-
{{#include data-transfer.rs:40:43}}
71+
{{#include data-transfer.rs:37:40}}
7272
```
7373

7474
*iterating datagram stream(s)*
7575

7676
```rust
77-
{{#include data-transfer.rs:45:51}}
77+
{{#include data-transfer.rs:42:48}}
7878
```
7979

8080
[Endpoint]: https://docs.rs/quinn/latest/quinn/struct.Endpoint.html

0 commit comments

Comments
 (0)