cli: Improve formatting of Node IDs and addresses

Pay more attention to when a Node ID is displayed in compact form. As
this was sometimes used to save space, e.g. in `rad node status` in
combination with long node addresses (like .onion names), also implement
a compact format for node addresses and use that instead in some cases.
Progress notifications in spinners keep the short form.
This commit is contained in:
Lorenz Leutgeb 2025-07-17 17:31:34 +02:00 committed by Fintan Halpenny
parent 010d5134e8
commit 0e3f3f03d2
36 changed files with 137 additions and 100 deletions

View File

@ -7,7 +7,7 @@ c036c0d89ce26aef3ad7da402157dba16b5163b4
$ rad sync --fetch
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
``` ~alice

View File

@ -129,7 +129,7 @@ $ rad remote add z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name alice
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
✓ Remote alice added
✓ Remote-tracking branch alice/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ git push rad master
```
@ -139,7 +139,7 @@ $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
✓ Remote bob added
✓ Remote-tracking branch bob/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ rad id update --title "Add Bob" --delegate did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --no-confirm -q
27ab0d77a95581c59ca9d30e679ceb06a9f758db
$ rad id update --title "Update canonical reference rules" --payload xyz.radicle.crefs rules '{ "refs/tags/*": { "threshold": 2, "allow": "delegates" }, "refs/tags/qa/*": { "threshold": 1, "allow": "delegates" } }' -q
@ -154,7 +154,7 @@ editor instead.
$ rad sync -f
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ rad id accept dace164ba43fa51802697ec28d0b1965a9d7808b -q
```

View File

@ -16,16 +16,16 @@ responsibilities:
$ rad sync --fetch
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
🌱 Fetched from z6Mkux1nVhib7Z
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
``` ~eve
$ rad sync --fetch
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
🌱 Fetched from z6Mkt67v4N1tRk
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
To demonstrate the divergence, Alice, Bob, and Eve will all create a new change,
@ -63,13 +63,13 @@ $ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
✓ Remote bob added
✓ Remote-tracking branch bob/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ rad remote add did:key:z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z --name eve
✓ Follow policy updated for z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z (eve)
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
✓ Remote eve added
✓ Remote-tracking branch eve/master created for z6Mkux1nVhib7Z
✓ Remote-tracking branch eve/master created for z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
```
Alice does indeed have Bob and Eve's references, however, a new canonical
@ -104,7 +104,7 @@ $ rad remote add did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
✓ Remote alice added
✓ Remote-tracking branch alice/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ git reset --hard alice/master
HEAD is now at 0f9bd80 Merge remote-tracking branch 'eve/master'
```
@ -130,7 +130,7 @@ $ rad remote add did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
✓ Remote alice added
✓ Remote-tracking branch alice/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ git reset --hard alice/master
HEAD is now at 0f9bd80 Merge remote-tracking branch 'eve/master'
```

View File

@ -1,4 +1,3 @@
Let's see what happens if we try to push a head which diverges from the
canonical head.
@ -15,7 +14,7 @@ Then, as Bob, we commit some code on top of the canonical head:
$ rad sync --fetch
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ rad inspect --delegates
did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (alice)
did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob)
@ -32,7 +31,7 @@ longer canonical, since Bob pushed a more recent commit, and the threshold is 1:
``` ~alice
$ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --fetch --no-sync
✓ Remote bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk added
✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ git branch -arv
bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master 319a7dc Third commit
rad/master f2de534 Second commit

View File

@ -14,7 +14,7 @@ Bob then syncs these changes and adds a new commit:
$ rad sync --fetch
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ git commit -m "Third commit" --allow-empty -q
$ git push rad
$ git branch -arv
@ -27,7 +27,7 @@ Alice merges these changes and pushes them, which updates the canonical head:
``` ~alice
$ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --fetch --no-sync
✓ Remote bob added
✓ Remote-tracking branch bob/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ git merge bob/master
Updating f2de534..319a7dc
Fast-forward

View File

@ -40,7 +40,7 @@ $ rad remote add z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name alice
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
✓ Remote alice added
✓ Remote-tracking branch alice/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
Bob is able to fetch Alice's tag into his working copy, and they're fetched
@ -76,7 +76,7 @@ update of the tag:
$ rad sync -f
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
``` ~bob (stderr)

View File

@ -5,7 +5,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential s
✓ Target met: 1 seed(s)
✓ Creating checkout in ./heartwood..
✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
✓ Repository successfully cloned under [..]/heartwood/
╭────────────────────────────────────╮
│ heartwood │
@ -53,7 +53,7 @@ We can then setup a git remote for `bob`:
```
$ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --no-sync --fetch
✓ Remote bob added
✓ Remote-tracking branch bob/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ git branch --remotes
alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master
bob/master

View File

@ -8,7 +8,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential s
✓ Target met: 1 seed(s)
✓ Creating checkout in ./heartwood..
✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
✓ Repository successfully cloned under [..]/heartwood/
╭────────────────────────────────────╮
│ heartwood │

View File

@ -8,7 +8,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential s
✓ Target met: 1 seed(s)
✓ Creating checkout in ./Developer/Radicle..
✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
✓ Repository successfully cloned under [..]/Developer/Radicle/
╭────────────────────────────────────╮
│ heartwood │

View File

@ -2,13 +2,13 @@ Eve knows about three seeds.
```
$ rad node routing
╭─────────────────────────────────────────────────────╮
╭──────────────────────────────────────────────────────────────────────────────────────
│ RID NID │
├─────────────────────────────────────────────────────┤
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MknSLStBU8Vi │
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MksFqbS9wzpT │
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6Mkt67v4N1tRk │
╰─────────────────────────────────────────────────────╯
├──────────────────────────────────────────────────────────────────────────────────────
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MksFqXN3Yhqk8pTJdUGLwBTkRfQvwZXPqR2qMEhbS9wzpT │
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │
╰──────────────────────────────────────────────────────────────────────────────────────
```
When she tries to clone, one of those will fail to fetch. But the clone command
still returns successfully.
@ -20,7 +20,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 3 potential s
✓ Target met: 1 seed(s)
✓ Creating checkout in ./heartwood..
✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
✓ Repository successfully cloned under [..]/heartwood/
╭────────────────────────────────────╮
│ heartwood │

View File

@ -8,7 +8,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found [..] potentia
✓ Target met: [..] seed(s)
✓ Creating checkout in ./heartwood..
✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
✓ Repository successfully cloned under [..]/heartwood/
╭────────────────────────────────────╮
│ heartwood │

View File

@ -21,7 +21,7 @@ by passing the `--fetch` option.
$ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
However, we don't have a local fork of the project. We can follow this

View File

@ -9,7 +9,7 @@ $ cd heartwood
$ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
One thing that can happen is that two delegates propose a revision at the same
@ -31,7 +31,7 @@ revisions.
$ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6Mkt67v4N1tRk
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ rad id list
╭─────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Status Created │
@ -66,7 +66,7 @@ accepted now.
$ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
``` ~bob (fail)
$ rad id accept 12d7300 -q

View File

@ -8,7 +8,7 @@ $ rad watch --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --node z6Mkux1aUQD2voWWukVb
$ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ rad id --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
╭────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Status Created │
@ -60,8 +60,8 @@ $ rad id update --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --title "Add Eve" --des
$ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
🌱 Fetched from z6Mkux1nVhib7Z
🌱 Fetched from z6Mkt67v4N1tRk
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --delegates
did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (alice)
did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob)

View File

@ -98,7 +98,7 @@ errors:
$ rad sync rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -f
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
We can also inspect the repository to ensure all the data is
@ -175,7 +175,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential s
✓ Target met: 1 seed(s)
✓ Creating checkout in ./heartwood..
✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
✓ Repository successfully cloned under [..]/bob/heartwood/
╭────────────────────────────────────╮
│ heartwood │
@ -195,8 +195,8 @@ $ rad fork
$ rad sync -f
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
🌱 Fetched from z6Mkux1nVhib7Z
🌱 Fetched from z6Mkt67v4N1tRk
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ rad inspect --sigrefs
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ae3c6b77dc1ed51c1c1e6a2772339c2779fa9ba8
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk dace6fe948548168a2bb687718949d9b5d9076ee

View File

@ -35,7 +35,7 @@ Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential s
✓ Target met: 1 preferred seed(s).
✓ Creating checkout in ./heartwood..
✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
✓ Repository successfully cloned under [...]/.radicle/heartwood/
╭────────────────────────────────────╮
│ heartwood │

View File

@ -8,9 +8,9 @@ $ rad ls
$ rad clone rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1
✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all'
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
✗ Target not met: could not fetch from [z6MknSLStBU8Vi], and required 1 more seed(s)
✗ Target not met: could not fetch from [z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi], and required 1 more seed(s)
! Warning: Failed to fetch from 1 seed(s).
! Warning: z6MknSLStBU8Vi: failed to perform fetch handshake
! Warning: z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi: failed to perform fetch handshake
✗ Error: no seeds found for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu
```
@ -31,7 +31,7 @@ that Alice has the repo after she announced her refs:
$ rad sync rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --fetch
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ rad ls --private --all
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Name RID Visibility Head Description │

View File

@ -26,7 +26,7 @@ He has to specify a seed that isn't in his routing table:
$ rad sync rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --fetch --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
✓ Target met: 1 preferred seed(s).
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
``` ~bob
@ -45,5 +45,5 @@ seed succeeds.
$ rad sync rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --fetch --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --seed z6MkwPUeUS2fJMfc2HZN1RQTQcTTuhw4HhPySB8JeUg2mVvx
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```

View File

@ -65,11 +65,11 @@ created.
```
$ rad node routing
╭─────────────────────────────────────────────────────╮
╭──────────────────────────────────────────────────────────────────────────────────────
│ RID NID │
├─────────────────────────────────────────────────────┤
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MknSLStBU8Vi │
╰─────────────────────────────────────────────────────╯
├──────────────────────────────────────────────────────────────────────────────────────
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
╰──────────────────────────────────────────────────────────────────────────────────────
```
Finally, if we want to stop the daemon process from running we can

View File

@ -26,7 +26,7 @@ $ cd heartwood
$ rad sync -f
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ rad patch checkout aa45913 --name alice-init
✓ Switched to branch alice-init at revision aa45913
✓ Branch alice-init setup to track rad/patches/aa45913e757cacd46972733bddee5472c78fa32a

View File

@ -21,8 +21,8 @@ $ cd heartwood
$ rad sync -f
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6Mkux1nVhib7Z
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
$ rad patch comment 6c61ef1 -m "I think we should use MIT"
╭───────────────────────────╮
│ bob (you) now 833db19 │

View File

@ -27,7 +27,7 @@ Fetching rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK from the network, found 1 potential se
✓ Target met: 1 seed(s)
✓ Creating checkout in ./heartwood..
✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLStBU8Vi
✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
✓ Repository successfully cloned under [..]/heartwood/
╭────────────────────────────────────╮
│ heartwood │

View File

@ -20,7 +20,7 @@ $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
✓ Remote bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk added
✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
$ git checkout master -q
$ cat .git/FETCH_HEAD
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 not-for-merge branch 'master' of rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk

View File

@ -3,7 +3,7 @@ Now, let's add a bob as a new remote:
```
$ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --no-sync
✓ Remote bob added
✓ Remote-tracking branch bob/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
```
Now, we can see that there is a new remote in the list of remotes:
@ -41,7 +41,7 @@ able to fetch the node alias from our db!
```
$ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --no-sync
✓ Remote bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk added
✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
```
We can also use `rad remote` to list all the remotes that are
@ -70,7 +70,7 @@ let's add them to our set of working copy remotes:
```
$ rad remote add did:key:z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z --name eve --no-sync
✓ Remote eve added
✓ Remote-tracking branch eve/master created for z6Mkux1nVhib7Z
✓ Remote-tracking branch eve/master created for z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
```
After adding `eve`'s remote, we no longer see any entries that are

View File

@ -57,8 +57,8 @@ We can also use the `--fetch` option to only fetch objects:
$ rad sync --fetch
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
🌱 Fetched from z6Mkux1nVhib7Z
🌱 Fetched from z6Mkt67v4N1tRk
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
```
Specifying both `--fetch` and `--announce` is equivalent to specifying none:
@ -67,8 +67,8 @@ Specifying both `--fetch` and `--announce` is equivalent to specifying none:
$ rad sync --fetch --announce
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 2 seed(s)
🌱 Fetched from z6Mkux1nVhib7Z
🌱 Fetched from z6Mkt67v4N1tRk
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
✓ Nothing to announce, already in sync with 2 seed(s) (see `rad sync status`)
```
@ -78,7 +78,7 @@ It's also possible to use the `--seed` flag to only sync with a specific node:
$ rad sync --fetch --seed z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 3 potential seed(s).
✓ Target met: 1 preferred seed(s).
🌱 Fetched from z6Mkt67v4N1tRk
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
```
And the `--replicas` flag to sync with a number of nodes. First we'll
@ -92,7 +92,7 @@ $ rad issue open --title "Test `rad sync --replicas`" --description "Check that
$ rad sync --replicas 1
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6Mkux1nVhib7Z
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
✓ Synced with 1 seed(s)
```
@ -118,10 +118,10 @@ Or when trying to fetch from an unknown seed, using `--seed`:
```
$ rad sync --fetch rad:z39mP9rQAaGmERfUMPULfPUi473tY --seed z6MkjM3HpqNVV4ZsL5s3RAd8ThVG3VG98YsDCjHBNnGMq5o7
Fetching rad:z39mP9rQAaGmERfUMPULfPUi473tY from the network, found 1 potential seed(s).
✗ Target not met: could not fetch from [z6MkjM3nGMq5o7], and required 1 more seed(s)
✗ Target not met: could not fetch from [z6MkjM3HpqNVV4ZsL5s3RAd8ThVG3VG98YsDCjHBNnGMq5o7], and required 1 more seed(s)
✗ Error: Fetched from 0 preferred seed(s), could not reach 1 seed(s)
✗ Error: Could not replicate from 1 preferred seed(s)
✗ Error: z6MkjM3nGMq5o7: Could not connect. No addresses known.
✗ Error: z6MkjM3HpqNVV4ZsL5s3RAd8ThVG3VG98YsDCjHBNnGMq5o7: Could not connect. No addresses known.
```
Also note that you cannot sync an unseeded repo:

View File

@ -11,7 +11,7 @@ $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --s
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
✓ Remote bob added
✓ Remote-tracking branch bob/master created for z6Mkt67v4N1tRk
✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
```
The contributor's changes are now visible to us.

View File

@ -12,7 +12,7 @@ Then, we call `rad sync --fetch` to fetch from the maintainer:
$ rad sync --fetch
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLStBU8Vi
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
Now let's checkout `master` and pull the maintainer's changes:

View File

@ -178,7 +178,7 @@ pub fn setup_remote(
term::success!(
"Remote-tracking branch {} created for {}",
term::format::tertiary(branch),
term::format::tertiary(term::format::node(remote_id))
term::format::tertiary(term::format::node_id_human(remote_id))
);
}
Ok(remote_name)

View File

@ -355,7 +355,7 @@ fn handle_fetch_error(id: RepoId, failure: &node::sync::fetch::TargetMissed) ->
for (node, reason) in failure.fetch_results().failed() {
term::warning(format!(
"{}: {}",
term::format::node(node),
term::format::node_id_human(node),
term::format::yellow(reason),
))
}

View File

@ -189,7 +189,7 @@ pub fn connect(
) -> anyhow::Result<()> {
let spinner = term::spinner(format!(
"Connecting to {}@{addr}...",
term::format::node(&nid)
term::format::node_id_human_compact(&nid)
));
match node.connect(
nid,
@ -217,7 +217,7 @@ pub fn connect_many(
for addr in addrs {
spinner.message(format!(
"Connecting to {}@{addr}...",
term::format::node(&nid)
term::format::node_id_human_compact(&nid)
));
match node.connect(
nid,
@ -353,7 +353,7 @@ pub fn sessions(node: &Node) -> Result<Option<term::Table<5, term::Label>>, node
table.divider();
for sess in sessions {
let nid = term::format::tertiary(term::format::node(&sess.nid)).into();
let nid = term::format::tertiary(term::format::node_id_human(&sess.nid)).into();
let (addr, state, time) = match sess.state {
node::State::Initial => (
term::Label::blank(),
@ -361,17 +361,17 @@ pub fn sessions(node: &Node) -> Result<Option<term::Table<5, term::Label>>, node
term::Label::blank(),
),
node::State::Attempted => (
sess.addr.to_string().into(),
term::format::addr_compact(&sess.addr).into(),
term::Label::from(state_attempted()),
term::Label::blank(),
),
node::State::Connected { since, .. } => (
sess.addr.to_string().into(),
term::format::addr_compact(&sess.addr).into(),
term::Label::from(state_connected()),
term::format::dim(now - since).into(),
),
node::State::Disconnected { since, .. } => (
sess.addr.to_string().into(),
term::format::addr_compact(&sess.addr).into(),
term::Label::from(state_disconnected()),
term::format::dim(now - since).into(),
),

View File

@ -36,7 +36,7 @@ fn print_table(entries: impl IntoIterator<Item = (RepoId, NodeId)>) {
for (rid, nid) in entries {
t.push([
term::format::highlight(rid.to_string()),
term::format::node(&nid),
term::format::node_id_human(&nid),
]);
}
t.print();

View File

@ -674,8 +674,8 @@ impl FetcherSpinner {
term::format::secondary(self.preferred_seeds),
term::format::secondary(progress.succeeded()),
term::format::secondary(self.replicas.lower_bound()),
term::format::tertiary(term::format::node(node)),
term::format::tertiary(addr),
term::format::tertiary(term::format::node_id_human_compact(node)),
term::format::tertiary(term::format::addr_compact(addr)),
))
}
@ -691,8 +691,8 @@ impl FetcherSpinner {
term::format::secondary(self.preferred_seeds),
term::format::secondary(progress.succeeded()),
term::format::secondary(self.replicas.lower_bound()),
term::format::tertiary(term::format::node(node)),
term::format::tertiary(addr),
term::format::tertiary(term::format::node_id_human_compact(node)),
term::format::tertiary(term::format::addr_compact(addr)),
))
}
@ -731,7 +731,7 @@ impl FetcherSpinner {
let missing_preferred_seeds = missed
.missed_nodes()
.iter()
.map(|nid| term::format::node(nid).to_string())
.map(|nid| term::format::node_id_human(nid).to_string())
.collect::<Vec<_>>();
let required = missed.required_nodes();
if !missing_preferred_seeds.is_empty() {
@ -760,7 +760,7 @@ fn display_fetch_result(result: &sync::FetcherResult, verbose: bool) {
for (node, reason) in results.failed() {
term::warning(format!(
"{}: {}",
term::format::node(node),
term::format::node_id_human(node),
term::format::yellow(reason),
))
}
@ -784,7 +784,7 @@ fn display_fetch_result(result: &sync::FetcherResult, verbose: bool) {
for (node, reason) in results.failed() {
term::error(format!(
"{}: {}",
term::format::node(node),
term::format::node_id_human(node),
term::format::negative(reason),
))
}
@ -803,7 +803,7 @@ fn display_success<'a>(
for (node, updates, _) in results {
term::println(
"🌱 Fetched from",
term::format::secondary(term::format::node(node)),
term::format::secondary(term::format::node_id_human(node)),
);
if verbose {
let mut updates = updates
@ -858,7 +858,7 @@ fn print_announcer_result(result: &sync::AnnouncerResult, verbose: bool) {
if verbose {
print_synced(result.synced());
for node in timed_out {
term::warning(format!("{} timed out", term::format::node(node)));
term::warning(format!("{} timed out", term::format::node_id_human(node)));
}
}
}
@ -873,7 +873,7 @@ fn print_announcer_result(result: &sync::AnnouncerResult, verbose: bool) {
fn print_synced(synced: &BTreeMap<NodeId, sync::announce::SyncStatus>) {
for (node, status) in synced.iter() {
let mut message = format!("🌱 Synced with {}", term::format::node(node));
let mut message = format!("🌱 Synced with {}", term::format::node_id_human(node));
match status {
sync::announce::SyncStatus::AlreadySynced => {

View File

@ -242,7 +242,7 @@ where
match node.announce(rid, settings.timeout, announcer, |node, progress| {
spinner.message(format!(
"Synced with {}, {} of {} preferred seeds, and {} of at least {} replica(s).",
term::format::node(node),
term::format::node_id_human_compact(node),
term::format::secondary(progress.preferred()),
term::format::secondary(n_preferred_seeds),
term::format::secondary(progress.synced()),

View File

@ -8,7 +8,7 @@ pub use radicle_term::{style, Paint};
use radicle::cob::ObjectId;
use radicle::identity::Visibility;
use radicle::node::policy::Policy;
use radicle::node::{Alias, AliasStore, NodeId};
use radicle::node::{Address, Alias, AliasStore, HostName, NodeId};
use radicle::prelude::Did;
use radicle::profile::{env, Profile};
use radicle::storage::RefUpdate;
@ -17,7 +17,7 @@ use radicle_term::element::Line;
use crate::terminal as term;
/// Format a node id to be more compact.
pub fn node(node: &NodeId) -> Paint<String> {
pub fn node_id_human_compact(node: &NodeId) -> Paint<String> {
let node = node.to_human();
let start = node.chars().take(7).collect::<String>();
let end = node.chars().skip(node.len() - 7).collect::<String>();
@ -25,6 +25,32 @@ pub fn node(node: &NodeId) -> Paint<String> {
Paint::new(format!("{start}{end}"))
}
/// Format a node id.
pub fn node_id_human(node: &NodeId) -> Paint<String> {
Paint::new(node.to_human())
}
pub fn addr_compact(address: &Address) -> Paint<String> {
let host = match address.host() {
HostName::Ip(ip) => ip.to_string(),
HostName::Dns(dns) => dns.clone(),
HostName::Tor(onion) => {
let onion = onion.to_string();
let start = onion.chars().take(8).collect::<String>();
let end = onion
.chars()
.skip(onion.len() - 8 - ".onion".len())
.collect::<String>();
format!("{start}{end}")
}
_ => unreachable!(),
};
let port = address.port().to_string();
Paint::new(format!("{host}:{port}"))
}
/// Format a git Oid.
pub fn oid(oid: impl Into<radicle::git::Oid>) -> Paint<String> {
Paint::new(format!("{:.7}", oid.into()))
@ -173,7 +199,7 @@ impl fmt::Display for Identity<'_> {
let nid = self.profile.id();
let alias = self.profile.aliases().alias(nid);
let node_id = match self.short {
true => self::node(nid).to_string(),
true => self::node_id_human_compact(nid).to_string(),
false => nid.to_human(),
};
@ -231,13 +257,15 @@ impl<'a> Author<'a> {
pub fn labels(self) -> (term::Label, term::Label) {
let alias = match self.alias.as_ref() {
Some(alias) => term::format::primary(alias).into(),
None if self.you => term::format::primary(term::format::node(self.nid))
None if self.you => {
term::format::primary(term::format::node_id_human_compact(self.nid))
.dim()
.into(),
.into()
}
None => term::Label::blank(),
};
let author = self.you().unwrap_or_else(|| {
term::format::primary(term::format::node(self.nid))
term::format::primary(term::format::node_id_human_compact(self.nid))
.dim()
.into()
});

View File

@ -2,7 +2,7 @@ use std::{mem, net};
use bytes::Buf;
use bytes::BufMut;
use cyphernet::addr::{tor, Addr, HostName, NetAddr};
use cyphernet::addr::{tor, HostName, NetAddr};
use radicle::crypto::Signature;
use radicle::git::Oid;
use radicle::identity::RepoId;

View File

@ -573,6 +573,16 @@ impl Address {
_ => true,
}
}
/// Return the [`HostName`] of the [`Address`].
pub fn host(&self) -> &HostName {
&self.0.host
}
/// Return the port number of the [`Address`].
pub fn port(&self) -> u16 {
self.0.port
}
}
impl cyphernet::addr::Host for Address {