Commit 14bae03
authored
refactor(iroh)!: Use FourTuple for selected path (#4273)
## Description
Track the selected path in the RemoteStateActor by FourTuple.
Handling and exposing the local address is .. weird:
* For IP transports, it is the address of the local socket, if known
* For relay transports, we never set the local_ip in the recv meta.
* For custom transports, the custom transport implementation can set a
`CustomAddr` in `RecvMeta`, which we convert to a mapped addr with port
0 internally in the recv path
The address we get back from noq for a path is this address. We don't
want to ever expose mapped addresses, so we need to convert this address
into something else. We have a precedent: We recently introduced a
`IncomingLocalAddr` which is basically this.
So I decided to reuse this type and renam eit to `LocalTransportAddr`,
which mirrors `TransportAddr` nicely.
The conversions are nothing to be happy about, but I don't see a solid
alternative right now without larger refactors.
## Breaking Changes
* changed: The variants of `iroh::endpoint::PathEvent` are now marked
`#[non_exhaustive]`
* renamed: `iroh::endpoint::IncomingLocalAddr` ->
`iroh::endpoint::LocalTransportAddr`, and the `Relay` variant is now a
tuple variant
## Notes & open questions
Instead of reusing and renaming the exisitng `IncomingLocalAddr`, we
could also expose local_addr as `Option<LocalTransportAddr>`, with `enum
LocalTransportAddr { Ip(IpAddr), Custom(CustomAddr) }`, i.e. remove the
`Relay` case. I had this in an earlier version but then found yet
another public address type a bit too much so instead went for the
existing `IncomingLocalAddr`.
## 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.
- [x] Tests if relevant.
- [x] All breaking changes documented.1 parent 0c60851 commit 14bae03
10 files changed
Lines changed: 342 additions & 134 deletions
File tree
- iroh
- examples
- src
- endpoint
- socket
- remote_map
- remote_state
- test_utils
- tests/patchbay
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
961 | 961 | | |
962 | 962 | | |
963 | 963 | | |
| 964 | + | |
964 | 965 | | |
965 | 966 | | |
966 | 967 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
85 | | - | |
| 85 | + | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
1682 | 1683 | | |
1683 | 1684 | | |
1684 | 1685 | | |
1685 | | - | |
1686 | | - | |
1687 | | - | |
1688 | | - | |
1689 | | - | |
1690 | 1686 | | |
1691 | 1687 | | |
1692 | 1688 | | |
| |||
3491 | 3487 | | |
3492 | 3488 | | |
3493 | 3489 | | |
3494 | | - | |
| 3490 | + | |
3495 | 3491 | | |
3496 | 3492 | | |
3497 | 3493 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 95 | | |
111 | 96 | | |
112 | 97 | | |
| |||
208 | 193 | | |
209 | 194 | | |
210 | 195 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
223 | 200 | | |
224 | 201 | | |
225 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
533 | 535 | | |
534 | 536 | | |
535 | 537 | | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
544 | 549 | | |
545 | 550 | | |
546 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
290 | 301 | | |
291 | 302 | | |
292 | 303 | | |
| |||
0 commit comments