You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(iroh-relay)!: add a QUIC server for QUIC address discovery to the iroh relay. (#2965)
## Description
This PR adds a QUIC endpoint to the relay server that can do QUIC
address discovery. It also contains structs/functions for properly doing
the Client side interaction for this process.
Also, this adjust the `RelayNode` to include configuration on how to
speak to the QUIC endpoint on the relay server.
QUIC is disabled by default and requires a `TlsConfig` to be configured
in order to work.
closes#2964
## Breaking Changes
- `iroh_base::relay_map::RelayNode` now has field `quic` that takes a
`Option<iroh_base::relay_map::QuicConfig>`
- `iroh::test_utils::run_relay_server_with(stun: Option<StunConfig>)` =>
`iroh::test_utils::run_relay_server_with(stun: Option<StunConfig>, quic:
bool)`
- when `quic` is `true`, it will start a quic server for QUIC address
discovery, that has self signed tls certs for testing.
- `iroh_relay::server::ServerConfig` has field `quic` that takes a
`Option<iroh_relay::server::QuicConfig>`
- `iroh_relay::server::TlsConfig.quic_bind_addr` is a new field that
takes a `SocketAddr`
- `iroh_relay::server::TlsConfig.server_config` is a new field that
takes a `rustls::ServerConfig`
- field `config` has been removed from variant
`iroh_relay::server::CertConfig::LetsEncrypt`
- variant `iroh_relay::server::CertConfig::LetsEncrypt` has a new field
`state` that takes a `tokio_rustls_acme::AcmeState<EC, EA>`
- variant `iroh_relay::server::CertConfig::Manual` no longer has field
`private_key`
## Change checklist
- [x] Self-review.
- [x] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [x] Tests if relevant.
- [x] All breaking changes documented.
---------
Co-authored-by: “ramfox” <“kasey@n0.computer”>
Copy file name to clipboardexpand all lines: iroh-relay/README.md
+39
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,45 @@ relays, including:
23
23
24
24
Used in [iroh], created with love by the [n0 team](https://n0.computer/).
25
25
26
+
## Local testing
27
+
28
+
Advice for testing your application that uses `iroh` with a locally running `iroh-relay` server
29
+
30
+
### dev mode
31
+
When running the relay server using the `--dev` flag, you will:
32
+
- only run the server over http, not https
33
+
- will NOT run the QUIC endpoint that enables QUIC address discovery
34
+
35
+
The relay can be contacted at "http://localhost:3340".
36
+
37
+
Both https and QUIC address discovery require TLS certificates. It's possible to run QUIC address discovery using locally generated TLS certificates, but it takes a few extra steps and so, is disabled by default for now.
38
+
39
+
### dev mode with QUIC address discovery
40
+
41
+
So you want to test out QUIC address discovery locally?
42
+
43
+
In order to do that you need TLS certificates.
44
+
45
+
The easiest get that is to generate self-signed certificates using `rcgen`
46
+
- get rcgen (`git clone https://github.com/rustls/rcgen`)
47
+
- cd to the `rcgen` directory
48
+
- generate local certs using `cargo run -- -o path/to/certs`
49
+
50
+
Next, add the certificate paths to your iroh-relay config, here is an example of a config.toml file that will enable quic address discovery.
51
+
```toml
52
+
[tlsconfig]
53
+
cert_mode = "Manual"
54
+
manual_cert_path = "/path/to/certs/cert.pem"
55
+
manual_key_path = "/path/to/certs/cert.key.pem"
56
+
```
57
+
58
+
Then run the server with the `--dev-quic` flag:
59
+
`cargo run --bin iroh-relay -- --config-path=/path/to/config.toml --dev-quic`
60
+
61
+
The relay server will run over http on port 3340, as it does using the `--dev` flag, but it will also run a QUIC server on port 7824.
62
+
63
+
The relay will use the configured TLS certificates for the QUIC connection, but use http (rather than https) for the server.
0 commit comments