Skip to content

Commit 6bca5d0

Browse files
authored
example: add qlog support to transfer example
## Description usage: `QLOGDIR=./qlog cargo run --examples transfer --release --features qlog` or `QLOGDIR=./qlog cargo run --examples transfer --release --all-features` ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist <!-- Remove any that are not relevant. --> - [ ] Self-review. - [ ] 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. - [ ] Tests if relevant. - [ ] All breaking changes documented. - [ ] List all breaking changes in the above "Breaking Changes" section. - [ ] Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are: - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc) - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip) - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs) - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe) - [ ] [`sendme`](https://github.com/n0-computer/sendme)
1 parent faa2119 commit 6bca5d0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

iroh/examples/transfer.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ const DEV_DNS_SERVER: &str = "127.0.0.1:5300";
4444
///
4545
/// --mdns needs the `discovery-local-network` feature
4646
///
47+
/// To emit qlog files, enable the `qlog` feature and set the QLOGDIR
48+
/// environment variable to the path where qlog files should be written to.
49+
///
4750
/// To enable all features, run the example with --all-features:
4851
///
4952
/// cargo run --release --example transfer --all-features -- ARGS
@@ -146,9 +149,12 @@ enum Commands {
146149
},
147150
/// Fetch data.
148151
Fetch {
152+
/// Endpoint id of the remote to connect to.
149153
remote_id: EndpointId,
154+
/// Optionally set a relay URL for the remote.
150155
#[clap(long)]
151156
remote_relay_url: Option<RelayUrl>,
157+
/// Optionally set direct addresses for the remote.
152158
#[clap(long)]
153159
remote_direct_address: Vec<SocketAddr>,
154160
#[clap(flatten)]
@@ -257,6 +263,13 @@ impl EndpointArgs {
257263
builder = builder.dns_resolver(DnsResolver::with_nameserver(addr));
258264
}
259265

266+
#[cfg(feature = "qlog")]
267+
{
268+
let mut transport_config = iroh::endpoint::QuicTransportConfig::default();
269+
transport_config.qlog_from_env("transfer");
270+
builder = builder.transport_config(transport_config)
271+
}
272+
260273
let endpoint = builder.alpns(vec![TRANSFER_ALPN.to_vec()]).bind().await?;
261274

262275
if self.mdns {

0 commit comments

Comments
 (0)