Skip to content

Commit

Permalink
Document use of http-path in multiaddr (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero authored Oct 25, 2024
1 parent 1e1a5b4 commit 6477098
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ipni ads get --ai=/ip4/76.219.232.45/tcp/24001/p2p/12D3KooWPNbkEgjdBNeaCGpsgCrPR
```sh
cat ad-cids-list.txt | ipni add get /dns4/ads.example.com/tcp/24001/p2p/<publisher-p2p-id>
```

### `ads list`
- List the 10 most recent advertisements from a provider:
```sh
Expand All @@ -81,6 +82,8 @@ ipni ads dist --ai=/ip4/76.219.232.45/tcp/24001/p2p/12D3KooWPNbkEgjdBNeaCGpsgCrP
--end=baguqeerage4rh6yqy4u37x7i337q57wrwfls5ihiei6l72rr6ezrw5vcucea
```

**Note* To include an HTTP path prefix in the `addr-info` flag of the `ads` command, include the `http-path` component in the multiaddr. For example, `--ai /dns/pool.example.com/https/http-path/eu%2Fprovider1/p2p/12D3KooWPMGfQs5CaJKG4yCxVWizWBRtB85gEUwiX2ekStvYvqgp` fetches ads from `https://pool.example.com/eu/provider1/ipni/v1/ad/head`. Any "/" within the http-path must be escaped.

### `find`
- Ask cid.contact where to find CID `bafybeigvgzoolc3drupxhlevdp2ugqcrbcsqfmcek2zxiw5wctk3xjpjwy`:
```sh
Expand Down
7 changes: 4 additions & 3 deletions pkg/ads/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (

var addrInfoFlag = &cli.StringFlag{
Name: "addr-info",
Usage: "Publisher's address info in form of libp2p multiaddr info.\n" +
"Example ipnisync: /ip4/1.2.3.4/tcp/1234/p2p/12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ\n" +
"Example HTTP: /ip4/1.2.3.4/tcp/1234/http/p2p/12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ",
Usage: "Publisher's address info in form of libp2p multiaddr info. Examples:\n" +
"ipnisync: /ip4/1.2.3.4/tcp/1234/p2p/12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ\n" +
"HTTP: /ip4/1.2.3.4/tcp/1234/http/p2p/12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ\n" +
"HTTP path: /ip4/1.2.3.4/tcp/1234/http/http-path/myprovidrs%2Fprov1/p2p/12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ",
Aliases: []string{"ai"},
Required: true,
}
Expand Down

0 comments on commit 6477098

Please sign in to comment.