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
Copy file name to clipboardExpand all lines: iroh-relay/README.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,18 @@ The relay server will run over http on port 3340, as it does using the `--dev` f
64
64
65
65
The relay will use the configured TLS certificates for the QUIC connection, but use http (rather than https) for the server.
66
66
67
+
### Using iroh-relay as a library to run in-process relays in integration tests
68
+
69
+
When using iroh as a transport library in an application or other library, there is a simple way of running an in-process relay server:
70
+
71
+
- Enable `test-utils` feature of the `iroh` crate
72
+
```toml
73
+
iroh = { version = "0.95", features = ["test-utils"] }
74
+
```
75
+
- Spawn a relay server by calling [`iroh::test_utils::run_relay_server().await`](https://docs.rs/iroh/latest/iroh/test_utils/fn.run_relay_server.html)
76
+
This will start a relay server with self-signed TLS certificate, listening on a localhost port, and return the server's URL.
77
+
- For the clients (= endpoints) to successfully connect to the relay, disable TLS certificate verification on the client by calling [`Endpoint::insecure_skip_relay_cert_verify`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.insecure_skip_relay_cert_verify).
0 commit comments