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
## Description
This improves the `transfer`, `publish` and `resolve` examples, which we
often use for dogfooding new releases.
#### `transfer` example:
* Set `prod` or `staging` environments with a single arg, while still
optionally allowing to override relay, pkarr, and DNS servers.
* Add a `dev` environment that uses locally running `iroh-relay` and
`iroh-dns-server` instances, for easily using the example with a locally
running dev setup of all services.
* Optionally enable mDNS discovery
* Print connection type changes
* Allow reusing a node id by setting `IROH_SECRET` environment variable
* Improve help and print output
* Improve code to not duplicate endpoint setup and arguments between
fetch and provide side
Here's the new help text and output:
<details>
<summary>Help text for provide</summary>
```
$ cargo run --release --example transfer --all-features -- provide --help
Provide data
Usage: transfer provide [OPTIONS]
Options:
--size <SIZE>
[default: 100M]
-e, --env <ENV>
Set the environment for relay, pkarr, and DNS servers.
If other options are set, those will override the environment defaults.
[default: staging]
Possible values:
- prod: Use the production servers hosted by number0
- staging: Use the staging servers hosted by number0
- dev: Use localhost servers
--relay-url <RELAY_URL>
Set one or more relay servers to use
--no-relay
Disable relays completely
--relay-only
If set no direct connections will be established
--pkarr-relay-url <PKARR_RELAY_URL>
Use a custom pkarr server
--no-pkarr-publish
Disable publishing node info to pkarr
--dns-origin-domain <DNS_ORIGIN_DOMAIN>
Use a custom domain when resolving node info via DNS
--dns-server <DNS_SERVER>
Use a custom DNS server for resolving relay and node info domains
--no-dns-resolve
Do not resolve node info via DNS
--mdns
Enable mDNS discovery
-h, --help
Print help (see a summary with '-h')
```
</details>
<details>
<summary>Help text for fetch</summary>
```
$ cargo run -q --release --example transfer --all-features -- fetch --help
Fetch data
Usage: transfer fetch [OPTIONS] <TICKET>
Arguments:
<TICKET>
Options:
-e, --env <ENV>
Set the environment for relay, pkarr, and DNS servers.
If other options are set, those will override the environment defaults.
[default: staging]
Possible values:
- prod: Use the production servers hosted by number0
- staging: Use the staging servers hosted by number0
- dev: Use localhost servers
--relay-url <RELAY_URL>
Set one or more relay servers to use
--no-relay
Disable relays completely
--relay-only
If set no direct connections will be established
--pkarr-relay-url <PKARR_RELAY_URL>
Use a custom pkarr server
--no-pkarr-publish
Disable publishing node info to pkarr
--dns-origin-domain <DNS_ORIGIN_DOMAIN>
Use a custom domain when resolving node info via DNS
--dns-server <DNS_SERVER>
Use a custom DNS server for resolving relay and node info domains
--no-dns-resolve
Do not resolve node info via DNS
--mdns
Enable mDNS discovery
-h, --help
Print help (see a summary with '-h')
```
</details>
<details>
<summary>Output on provide side</summary>
```
$ cargo -q run --release --example transfer --all-features -- provide -e staging
Our node id:
fdeb67bd2995cbdf1844e1170b01848af5e6b13beb4d754ec86dd38b4ecdae3a
Our direct addresses:
78.xx.xx.xx:44377 (type: Stun)
192.168.xxx.xxx:44377 (type: Local)
Our home relay server:
https://staging-euw1-1.relay.iroh.network./
Ticket with our home relay and direct addresses:
nodead66wz55[redacted]
Ticket with our home relay but no direct addresses:
nodead66wz55fgk4xxyyitqrocybqsfplzvrhpvu25kozbw5hc2ozwxduajlnb2hi4dthixs643umftws3thfvsxk5zrfuys44tfnrqxsltjojxwqltomv2ho33snmxc6aa
Ticket with only our node id:
nodead66wz55fgk4xxyyitqrocybqsfplzvrhpvu25kozbw5hc2ozwxduaaa
[7b1a7ac46f] Connected
[7b1a7ac46f] Received: "7b1a7ac46f is saying hello!"
[7b1a7ac46f] Connection type changed to: direct(192.168.xxx.xxx:48801)
[7b1a7ac46f] Transferred 100.00 MiB in 0.6929s, 144.31 MiB/s
[7b1a7ac46f] Disconnected
```
</details>
<details>
<summary>Output on fetch side</summary>
```
$ cargo -q run --release --example transfer --all-features -- fetch -e staging nodead66wz55fgk4xxyyitqrocybqsfplzvrhpvu25kozbw5hc2ozwxduaaa
Generated a new node secret. To reuse, set
IROH_SECRET=a924573310dc0c0763b64ea82c307895965883d1046f4555954689dd8a937d8c
Our node id:
7b1a7ac46f528bc5182ea214326fe2a348d2a6f3a3a63d505947c3f0980e8f43
Our direct addresses:
78.xxx.xxx.xxx:48801 (type: Stun)
192.168.xxx.xxx:48801 (type: Local)
Our home relay server:
https://staging-euw1-1.relay.iroh.network./
Connected to fdeb67bd2995cbdf1844e1170b01848af5e6b13beb4d754ec86dd38b4ecdae3a
Sent: "7b1a7ac46f is saying hello!"
[fdeb67bd29] Connection type changed to: direct(192.168.xxx.xxx:44555)
Received 100.00 MiB in 1.0968s (91.17 MiB/s, time to first byte 0.002208444s, 3518 chunks)
```
</details>
#### `publish` and `resolve` examples
* Set a default relay URL in the publish example. Otherwise an empty
node info would be published if not setting any further arguments, which
was a major UX footgun. A new argument `no-relay-url` allows to publish
without relay URL.
* Cleanup constant names to match those used in the `transfer` example
* Allow to set a custom origin domain in the resolve example
## 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. -->
- [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.
0 commit comments