-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: update the examples README.md
- Loading branch information
Showing
2 changed files
with
34 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,59 @@ | ||
|
||
# Examples | ||
|
||
## Publish | ||
|
||
```sh | ||
cargo run --example publish | ||
``` | ||
|
||
or to use a Relay client: | ||
Publish a SignedPacket for a randomly generated keypair. | ||
|
||
```sh | ||
cargo run --features relay --example publish | ||
cargo run --example publish [MODE] [RELAYS] | ||
``` | ||
``` | ||
Arguments: | ||
[MODE] Publish to DHT only, Relays only, or default to both [possible values: dht, relays, both] | ||
[RELAYS]... List of relays (only valid if mode is 'relays') | ||
``` | ||
|
||
## Resolve | ||
|
||
```sh | ||
cargo run --example resolve <zbase32 public key from Publish step> | ||
``` | ||
|
||
or to use a Relay client: | ||
Resolve a SignedPacket for a given public key. | ||
|
||
```sh | ||
cargo run --features relay --example resolve <zbase32 public key from Publish step> | ||
cargo run --example resolve <PUBLIC_KEY> [MODE] [RELAYS] | ||
``` | ||
``` | ||
Arguments: | ||
<PUBLIC_KEY> Pkarr public key (z-base32 encoded) or a url where the TLD is a Pkarr key | ||
[MODE] Resolve from DHT only, Relays only, or default to both [possible values: dht, relays, both] | ||
[RELAYS]... List of relays (only valid if mode is 'relays') | ||
``` | ||
|
||
## HTTP | ||
|
||
### Serve | ||
|
||
Run an HTTP server listening on a Pkarr key | ||
|
||
```sh | ||
cargo run --features endpoints --example http-serve <ip address> <port number> | ||
cargo run --features=tls --example http-serve <IP> <PORT> | ||
``` | ||
``` | ||
Arguments: | ||
<IP> IP address to listen on (needs to be a public IP address) | ||
<PORT> Port number to listen no (needs to be an open port) | ||
``` | ||
|
||
An HTTPs url will be printend with the Pkarr key as the TLD, paste in another terminal window: | ||
An HTTPs url will be printend with the Pkarr key as the TLD, paste in another terminal window with the next command. | ||
|
||
### Get | ||
|
||
|
||
```sh | ||
cargo run --features reqwest-resolve --example http-get <url> | ||
cargo run --features=reqwest-builder --example http-get <URL> | ||
``` | ||
``` | ||
Arguments: | ||
<URL> Url to GET from | ||
``` | ||
|
||
And you should see a `Hello, World!` response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters