From fdb5f115113e2ee14efd8bfd6d70b0f7fe8bb3dd Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Tue, 7 May 2024 18:11:03 +0200 Subject: [PATCH] first commit --- documentation/autodoc/Cargo.toml | 14 + documentation/autodoc/nym-client.md | 824 ++++++++++++++++++++++++++++ documentation/autodoc/nym-node.md | 308 +++++++++++ documentation/autodoc/src/main.rs | 94 ++++ 4 files changed, 1240 insertions(+) create mode 100644 documentation/autodoc/Cargo.toml create mode 100644 documentation/autodoc/nym-client.md create mode 100644 documentation/autodoc/nym-node.md create mode 100644 documentation/autodoc/src/main.rs diff --git a/documentation/autodoc/Cargo.toml b/documentation/autodoc/Cargo.toml new file mode 100644 index 0000000000..5360b1de1f --- /dev/null +++ b/documentation/autodoc/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "autodoc" +version = "0.1.0" +authors.workspace = true +repository.workspace = true +homepage.workspace = true +documentation.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +env_logger = "0.11.3" +log.workspace = true +nym-client = { path = "../../clients/native" } diff --git a/documentation/autodoc/nym-client.md b/documentation/autodoc/nym-client.md new file mode 100644 index 0000000000..9825e82724 --- /dev/null +++ b/documentation/autodoc/nym-client.md @@ -0,0 +1,824 @@ +# Command Output + +## ../../target/release/nym-client + +### init +#### stdout +``` +Initialise a Nym client. Do this first! + +Usage: nym-client init [OPTIONS] --id + +Options: + --id + Id of client we want to create config for + --gateway + Id of the gateway we are going to connect to + --force-tls-gateway + Specifies whether the client will attempt to enforce tls connection to the desired gateway + --latency-based-selection + Specifies whether the new gateway should be determined based by latency as opposed to being chosen uniformly + --nym-apis + Comma separated list of rest endpoints of the API validators + --disable-socket + Whether to not start the websocket [possible values: true, false] + -p, --port + Port for the socket (if applicable) to listen on in all subsequent runs + --host + Ip for the socket (if applicable) to listen for requests + -o, --output + [default: text] [possible values: text, json] + -h, --help + Print help +``` +#### stderr +``` +``` + +### init +#### stdout +``` +``` +#### stderr +``` +error: the following required arguments were not provided: + --id + +Usage: nym-client init --id + +For more information, try '--help'. +``` + +### run +#### stdout +``` +Run the Nym client with provided configuration client optionally overriding set parameters + +Usage: nym-client run [OPTIONS] --id + +Options: + --id + Id of client we want to create config for + --gateway + Id of the gateway we want to connect to. If overridden, it is user's responsibility to ensure prior registration happened + --nym-apis + Comma separated list of rest endpoints of the API validators + --disable-socket + Whether to not start the websocket [possible values: true, false] + -p, --port + Port for the socket to listen on + --host + Ip for the socket (if applicable) to listen for requests + -h, --help + Print help +``` +#### stderr +``` +``` + +### run +#### stdout +``` +``` +#### stderr +``` +error: the following required arguments were not provided: + --id + +Usage: nym-client run --id + +For more information, try '--help'. +``` + +### import-credential +#### stdout +``` +Import a pre-generated credential + +Usage: nym-client import-credential --id <--credential-data |--credential-path > + +Options: + --id + Id of client that is going to import the credential + --credential-data + Explicitly provide the encoded credential data (as base58) + --credential-path + Specifies the path to file containing binary credential data + -h, --help + Print help +``` +#### stderr +``` +``` + +### import-credential +#### stdout +``` +``` +#### stderr +``` +error: the following required arguments were not provided: + --id + <--credential-data |--credential-path > + +Usage: nym-client import-credential --id <--credential-data |--credential-path > + +For more information, try '--help'. +``` + +### list-gateways +#### stdout +``` +List all registered with gateways + +Usage: nym-client list-gateways [OPTIONS] --id + +Options: + --id Id of client we want to list gateways for + -o, --output [default: text] [possible values: text, json] + -h, --help Print help +``` +#### stderr +``` +``` + +### list-gateways +#### stdout +``` +``` +#### stderr +``` +error: the following required arguments were not provided: + --id + +Usage: nym-client list-gateways --id + +For more information, try '--help'. +``` + +### switch-gateway +#### stdout +``` +Change the currently active gateway. Note that you must have already registered with the new gateway! + +Usage: nym-client switch-gateway --id --gateway-id + +Options: + --id Id of client we want to list gateways for + --gateway-id Id of the gateway we want to switch to + -h, --help Print help +``` +#### stderr +``` +``` + +### switch-gateway +#### stdout +``` +``` +#### stderr +``` +error: the following required arguments were not provided: + --id + --gateway-id + +Usage: nym-client switch-gateway --id --gateway-id + +For more information, try '--help'. +``` + +### build-info +#### stdout +``` +Show build information of this binary + +Usage: nym-client build-info [OPTIONS] + +Options: + -o, --output [default: text] [possible values: text, json] + -h, --help Print help +``` +#### stderr +``` +``` + +### build-info +#### stdout +``` + +Binary Name: nym-client +Build Timestamp: 2024-05-07T13:11:43.523733081Z +Build Version: 1.1.34 +Commit SHA: 7d233a4a2fc697a2f97e504db6a3765cc9f2dd49 +Commit Date: 2024-04-25T11:27:18.000000000+02:00 +Commit Branch: max/auto-docs +rustc Version: 1.78.0 +rustc Channel: stable +cargo Profile: release + +``` +#### stderr +``` +``` + +### completions +#### stdout +``` +Generate shell completions + +Usage: nym-client completions + +Arguments: + [possible values: bash, elvish, fish, power-shell, zsh] + +Options: + -h, --help Print help +``` +#### stderr +``` +``` + +### completions +#### stdout +``` +``` +#### stderr +``` +error: the following required arguments were not provided: + + +Usage: nym-client completions + +For more information, try '--help'. +``` + +### generate-fig-spec +#### stdout +``` +Generate Fig specification + +Usage: nym-client generate-fig-spec + +Options: + -h, --help Print help +``` +#### stderr +``` +``` + +### generate-fig-spec +#### stdout +``` +const completion: Fig.Spec = { + name: "nym-native-client", + description: "Implementation of the Nym Client", + subcommands: [ + { + name: "init", + description: "Initialise a Nym client. Do this first!", + options: [ + { + name: "--id", + description: "Id of client we want to create config for", + isRepeatable: true, + args: { + name: "id", + }, + }, + { + name: "--gateway", + description: "Id of the gateway we are going to connect to", + isRepeatable: true, + args: { + name: "gateway", + isOptional: true, + }, + }, + { + name: "--nyxd-urls", + description: "Comma separated list of rest endpoints of the nyxd validators", + hidden: true, + isRepeatable: true, + args: { + name: "nyxd_urls", + isOptional: true, + }, + }, + { + name: "--nym-apis", + description: "Comma separated list of rest endpoints of the API validators", + isRepeatable: true, + args: { + name: "nym_apis", + isOptional: true, + }, + }, + { + name: "--custom-mixnet", + description: "Path to .json file containing custom network specification", + hidden: true, + isRepeatable: true, + args: { + name: "custom_mixnet", + isOptional: true, + template: "filepaths", + }, + }, + { + name: "--enabled-credentials-mode", + description: "Set this client to work in a enabled credentials mode that would attempt to use gateway with bandwidth credential requirement", + hidden: true, + isRepeatable: true, + args: { + name: "enabled_credentials_mode", + isOptional: true, + suggestions: [ + "true", + "false", + ], + }, + }, + { + name: "--disable-socket", + description: "Whether to not start the websocket", + isRepeatable: true, + args: { + name: "disable_socket", + isOptional: true, + suggestions: [ + "true", + "false", + ], + }, + }, + { + name: ["-p", "--port"], + description: "Port for the socket (if applicable) to listen on in all subsequent runs", + isRepeatable: true, + args: { + name: "port", + isOptional: true, + }, + }, + { + name: "--host", + description: "Ip for the socket (if applicable) to listen for requests", + isRepeatable: true, + args: { + name: "host", + isOptional: true, + }, + }, + { + name: ["-o", "--output"], + isRepeatable: true, + args: { + name: "output", + isOptional: true, + suggestions: [ + "text", + "json", + ], + }, + }, + { + name: "--force-tls-gateway", + description: "Specifies whether the client will attempt to enforce tls connection to the desired gateway", + }, + { + name: "--latency-based-selection", + description: "Specifies whether the new gateway should be determined based by latency as opposed to being chosen uniformly", + exclusiveOn: [ + "--gateway", + ], + }, + { + name: "--fastmode", + description: "Mostly debug-related option to increase default traffic rate so that you would not need to modify config post init", + }, + { + name: "--no-cover", + description: "Disable loop cover traffic and the Poisson rate limiter (for debugging only)", + }, + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + }, + { + name: "run", + description: "Run the Nym client with provided configuration client optionally overriding set parameters", + options: [ + { + name: "--id", + description: "Id of client we want to create config for", + isRepeatable: true, + args: { + name: "id", + }, + }, + { + name: "--gateway", + description: "Id of the gateway we want to connect to. If overridden, it is user's responsibility to ensure prior registration happened", + isRepeatable: true, + args: { + name: "gateway", + isOptional: true, + }, + }, + { + name: "--nyxd-urls", + description: "Comma separated list of rest endpoints of the nyxd validators", + hidden: true, + isRepeatable: true, + args: { + name: "nyxd_urls", + isOptional: true, + }, + }, + { + name: "--nym-apis", + description: "Comma separated list of rest endpoints of the API validators", + isRepeatable: true, + args: { + name: "nym_apis", + isOptional: true, + }, + }, + { + name: "--custom-mixnet", + description: "Path to .json file containing custom network specification", + hidden: true, + isRepeatable: true, + args: { + name: "custom_mixnet", + isOptional: true, + template: "filepaths", + }, + }, + { + name: "--enabled-credentials-mode", + description: "Set this client to work in a enabled credentials mode that would attempt to use gateway with bandwidth credential requirement", + hidden: true, + isRepeatable: true, + args: { + name: "enabled_credentials_mode", + isOptional: true, + suggestions: [ + "true", + "false", + ], + }, + }, + { + name: "--disable-socket", + description: "Whether to not start the websocket", + isRepeatable: true, + args: { + name: "disable_socket", + isOptional: true, + suggestions: [ + "true", + "false", + ], + }, + }, + { + name: ["-p", "--port"], + description: "Port for the socket to listen on", + isRepeatable: true, + args: { + name: "port", + isOptional: true, + }, + }, + { + name: "--host", + description: "Ip for the socket (if applicable) to listen for requests", + isRepeatable: true, + args: { + name: "host", + isOptional: true, + }, + }, + { + name: "--fastmode", + description: "Mostly debug-related option to increase default traffic rate so that you would not need to modify config post init", + }, + { + name: "--no-cover", + description: "Disable loop cover traffic and the Poisson rate limiter (for debugging only)", + }, + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + }, + { + name: "import-credential", + description: "Import a pre-generated credential", + options: [ + { + name: "--id", + description: "Id of client that is going to import the credential", + isRepeatable: true, + args: { + name: "id", + }, + }, + { + name: "--credential-data", + description: "Explicitly provide the encoded credential data (as base58)", + isRepeatable: true, + args: { + name: "credential_data", + isOptional: true, + }, + }, + { + name: "--credential-path", + description: "Specifies the path to file containing binary credential data", + isRepeatable: true, + args: { + name: "credential_path", + isOptional: true, + template: "filepaths", + }, + }, + { + name: "--version", + hidden: true, + isRepeatable: true, + args: { + name: "version", + isOptional: true, + }, + }, + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + }, + { + name: "list-gateways", + description: "List all registered with gateways", + options: [ + { + name: "--id", + description: "Id of client we want to list gateways for", + isRepeatable: true, + args: { + name: "id", + }, + }, + { + name: ["-o", "--output"], + isRepeatable: true, + args: { + name: "output", + isOptional: true, + suggestions: [ + "text", + "json", + ], + }, + }, + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + }, + { + name: "add-gateway", + description: "Add new gateway to this client", + options: [ + { + name: "--id", + description: "Id of client we want to add gateway for", + isRepeatable: true, + args: { + name: "id", + }, + }, + { + name: "--gateway-id", + description: "Explicitly specify id of the gateway to register with. If unspecified, a random gateway will be chosen instead", + isRepeatable: true, + args: { + name: "gateway_id", + isOptional: true, + }, + }, + { + name: "--nym-apis", + description: "Comma separated list of rest endpoints of the API validators", + isRepeatable: true, + args: { + name: "nym_apis", + isOptional: true, + }, + }, + { + name: "--custom-mixnet", + description: "Path to .json file containing custom network specification", + hidden: true, + isRepeatable: true, + args: { + name: "custom_mixnet", + isOptional: true, + template: "filepaths", + }, + }, + { + name: ["-o", "--output"], + isRepeatable: true, + args: { + name: "output", + isOptional: true, + suggestions: [ + "text", + "json", + ], + }, + }, + { + name: "--force-tls-gateway", + description: "Specifies whether the client will attempt to enforce tls connection to the desired gateway", + }, + { + name: "--latency-based-selection", + description: "Specifies whether the new gateway should be determined based by latency as opposed to being chosen uniformly", + exclusiveOn: [ + "--gateway-id", + ], + }, + { + name: "--set-active", + description: "Specify whether this new gateway should be set as the active one", + }, + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + }, + { + name: "switch-gateway", + description: "Change the currently active gateway. Note that you must have already registered with the new gateway!", + options: [ + { + name: "--id", + description: "Id of client we want to list gateways for", + isRepeatable: true, + args: { + name: "id", + }, + }, + { + name: "--gateway-id", + description: "Id of the gateway we want to switch to", + isRepeatable: true, + args: { + name: "gateway_id", + }, + }, + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + }, + { + name: "build-info", + description: "Show build information of this binary", + options: [ + { + name: ["-o", "--output"], + isRepeatable: true, + args: { + name: "output", + isOptional: true, + suggestions: [ + "text", + "json", + ], + }, + }, + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + }, + { + name: "completions", + description: "Generate shell completions", + options: [ + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + args: { + name: "shell", + suggestions: [ + "bash", + "elvish", + "fish", + "power-shell", + "zsh", + ], + }, + }, + { + name: "generate-fig-spec", + description: "Generate Fig specification", + options: [ + { + name: ["-h", "--help"], + description: "Print help", + }, + ], + }, + { + name: "help", + description: "Print this message or the help of the given subcommand(s)", + subcommands: [ + { + name: "init", + description: "Initialise a Nym client. Do this first!", + }, + { + name: "run", + description: "Run the Nym client with provided configuration client optionally overriding set parameters", + }, + { + name: "import-credential", + description: "Import a pre-generated credential", + }, + { + name: "list-gateways", + description: "List all registered with gateways", + }, + { + name: "add-gateway", + description: "Add new gateway to this client", + }, + { + name: "switch-gateway", + description: "Change the currently active gateway. Note that you must have already registered with the new gateway!", + }, + { + name: "build-info", + description: "Show build information of this binary", + }, + { + name: "completions", + description: "Generate shell completions", + }, + { + name: "generate-fig-spec", + description: "Generate Fig specification", + }, + { + name: "help", + description: "Print this message or the help of the given subcommand(s)", + }, + ], + }, + ], + options: [ + { + name: ["-c", "--config-env-file"], + description: "Path pointing to an env file that configures the client", + isRepeatable: true, + args: { + name: "config_env_file", + isOptional: true, + template: "filepaths", + }, + }, + { + name: "--no-banner", + description: "Flag used for disabling the printed banner in tty", + }, + { + name: ["-h", "--help"], + description: "Print help", + }, + { + name: ["-V", "--version"], + description: "Print version", + }, + ], +}; + +export default completion; +``` +#### stderr +``` +``` diff --git a/documentation/autodoc/nym-node.md b/documentation/autodoc/nym-node.md new file mode 100644 index 0000000000..d9d2ad4c22 --- /dev/null +++ b/documentation/autodoc/nym-node.md @@ -0,0 +1,308 @@ +# Command Output + +## ../../target/release/nym-node + +### build-info +#### stdout +``` +Show build information of this binary + +Usage: nym-node build-info [OPTIONS] + +Options: + -o, --output [default: text] [possible values: text, json] + -h, --help Print help +``` +#### stderr +``` +``` + +### build-info +#### stdout +``` + +Binary Name: nym-node +Build Timestamp: 2024-05-07T13:11:43.523733081Z +Build Version: 1.1.0 +Commit SHA: 7d233a4a2fc697a2f97e504db6a3765cc9f2dd49 +Commit Date: 2024-04-25T11:27:18.000000000+02:00 +Commit Branch: max/auto-docs +rustc Version: 1.78.0 +rustc Channel: stable +cargo Profile: release + +``` +#### stderr +``` +``` + +### bonding-information +#### stdout +``` +Show bonding information of this node depending on its currently selected mode + +Usage: nym-node bonding-information [OPTIONS] + +Options: + --id Id of the nym-node to use [env: NYMNODE_ID=] [default: default-nym-node] + --config-file Path to a configuration file of this node [env: NYMNODE_CONFIG=] + --mode [env: NYMNODE_MODE=] [possible values: mixnode, entry-gateway, exit-gateway] + -o, --output Specify the output format of the bonding information (`text` or `json`) [default: text] [possible values: text, json] + -h, --help Print help +``` +#### stderr +``` +``` + +### bonding-information +#### stdout +``` +Node type: Mixnode +Identity Key: FEdugQDfQreKDbESxRbGRzN6RFTzpnA6Q7RGzDAKyfVF +Sphinx Key: CDBU7J19W8JJnxTd8XXCW6JFEFaXqUQZ2p5tTNW4TS9j +Host: YOU NEED TO FILL THIS FIELD MANUALLY +Version: 1.1.0+nymnode + +``` +#### stderr +``` +``` + +### node-details +#### stdout +``` +Show details of this node + +Usage: nym-node node-details [OPTIONS] + +Options: + --id Id of the nym-node to use [env: NYMNODE_ID=] [default: default-nym-node] + --config-file Path to a configuration file of this node [env: NYMNODE_CONFIG=] + -o, --output Specify the output format of the node details (`text` or `json`) [default: text] [possible values: text, json] + -h, --help Print help +``` +#### stderr +``` +``` + +### node-details +#### stdout +``` +current mode: mixnode +moniker: '' +website: '' +security contact: '' +details: '' +ed25519 identity: FEdugQDfQreKDbESxRbGRzN6RFTzpnA6Q7RGzDAKyfVF +x25519 sphinx: CDBU7J19W8JJnxTd8XXCW6JFEFaXqUQZ2p5tTNW4TS9j +x25519 noise: 9Ktca38oTdk9qEfArYuudAGx2XgmiMV3Xquzfm8g8bVe +exit network requester address: HGPiTdzwy2S7Qrt34Zmv9h3MUqujWPV9HS9iti9NYj2f.53tqigBj5DRQvqSk7Wm8ekh96CYrrC3srAvCajW3jnKj@FEdugQDfQreKDbESxRbGRzN6RFTzpnA6Q7RGzDAKyfVF +exit ip packet router address: 27UWQ4rciEaorKGD5PAKqNB5smbzxZp413ihcYhxFEHi.49xWfeGxEtEt6K1kF3sFpDHRe7ZsMwZT1xKE7qgCbaKQ@FEdugQDfQreKDbESxRbGRzN6RFTzpnA6Q7RGzDAKyfVF + +``` +#### stderr +``` +``` + +### migrate +#### stdout +``` +Attempt to migrate an existing mixnode or gateway into a nym-node + +Usage: nym-node migrate [OPTIONS] <--id |--config-file > + +Arguments: + Type of node (mixnode or gateway) to migrate into a nym-node [possible values: mixnode, gateway] + +Options: + --id + Id of the node that's going to get migrated + --config-file + Path to a configuration file of the node that's going to get migrated + --preserve-id + Specify whether to preserve id of the imported node + --public-ips + Comma separated list of public ip addresses that will be announced to the nym-api and subsequently to the clients. In nearly all circumstances, it's going to be identical to the address you're going to use for bonding [env: NYMNODE_PUBLIC_IPS=] + --hostname + Optional hostname associated with this gateway that will be announced to the nym-api and subsequently to the clients [env: NYMNODE_HOSTNAME=] + --location + Optional **physical** location of this node's server. Either full country name (e.g. 'Poland'), two-letter alpha2 (e.g. 'PL'), three-letter alpha3 (e.g. 'POL') or three-digit numeric-3 (e.g. '616') can be provided [env: NYMNODE_LOCATION=] + --http-bind-address + Socket address this node will use for binding its http API. default: `0.0.0.0:8080` [env: NYMNODE_HTTP_BIND_ADDRESS=] + --landing-page-assets-path + Path to assets directory of custom landing page of this node [env: NYMNODE_HTTP_LANDING_ASSETS=] + --http-access-token + An optional bearer token for accessing certain http endpoints. Currently only used for prometheus metrics [env: NYMNODE_HTTP_ACCESS_TOKEN=] + --expose-system-info + Specify whether basic system information should be exposed. default: true [env: NYMNODE_HTTP_EXPOSE_SYSTEM_INFO=] [possible values: true, false] + --expose-system-hardware + Specify whether basic system hardware information should be exposed. default: true [env: NYMNODE_HTTP_EXPOSE_SYSTEM_HARDWARE=] [possible values: true, false] + --expose-crypto-hardware + Specify whether detailed system crypto hardware information should be exposed. default: true [env: NYMNODE_HTTP_EXPOSE_CRYPTO_HARDWARE=] [possible values: true, false] + --mixnet-bind-address + Address this node will bind to for listening for mixnet packets default: `0.0.0.0:1789` [env: NYMNODE_MIXNET_BIND_ADDRESS=] + --nym-api-urls + Addresses to nym APIs from which the node gets the view of the network [env: NYMNODE_NYM_APIS=] + --nyxd-urls + Addresses to nyxd chain endpoint which the node will use for chain interactions [env: NYMNODE_NYXD=] + --wireguard-enabled + Specifies whether the wireguard service is enabled on this node [env: NYMNODE_WG_ENABLED=] [possible values: true, false] + --wireguard-bind-address + Socket address this node will use for binding its wireguard interface. default: `0.0.0.0:51822` [env: NYMNODE_WG_BIND_ADDRESS=] + --wireguard-private-network-ip + Ip address of the private wireguard network. default: `10.1.0.0` [env: NYMNODE_WG_IP_NETWORK=] + --wireguard-announced-port + Port announced to external clients wishing to connect to the wireguard interface. Useful in the instances where the node is behind a proxy [env: NYMNODE_WG_ANNOUNCED_PORT=] + --wireguard-private-network-prefix + The prefix denoting the maximum number of the clients that can be connected via Wireguard. The maximum value for IPv4 is 32 and for IPv6 is 128 [env: NYMNODE_WG_PRIVATE_NETWORK_PREFIX=] + --verloc-bind-address + Socket address this node will use for binding its verloc API. default: `0.0.0.0:1790` [env: NYMNODE_VERLOC_BIND_ADDRESS=] + --entry-bind-address + Socket address this node will use for binding its client websocket API. default: `0.0.0.0:9000` [env: NYMNODE_ENTRY_BIND_ADDRESS=] + --announce-ws-port + Custom announced port for listening for websocket client traffic. If unspecified, the value from the `bind_address` will be used instead [env: NYMNODE_ENTRY_ANNOUNCE_WS_PORT=] + --announce-wss-port + If applicable, announced port for listening for secure websocket client traffic [env: NYMNODE_ENTRY_ANNOUNCE_WSS_PORT=] + --enforce-zk-nyms + Indicates whether this gateway is accepting only coconut credentials for accessing the mixnet or if it also accepts non-paying clients [env: NYMNODE_ENFORCE_ZK_NYMS=] [possible values: true, false] + --mnemonic + Custom cosmos wallet mnemonic used for zk-nym redemption. If no value is provided, a fresh mnemonic is going to be generated [env: NYMNODE_MNEMONIC=] + --upstream-exit-policy-url + Specifies the url for an upstream source of the exit policy used by this node [env: NYMNODE_UPSTREAM_EXIT_POLICY=] + --open-proxy + Specifies whether this exit node should run in 'open-proxy' mode and thus would attempt to resolve **ANY** request it receives [env: NYMNODE_OPEN_PROXY=] [possible values: true, false] + -h, --help + Print help +``` +#### stderr +``` +``` + +### migrate +#### stdout +``` +``` +#### stderr +``` +error: the following required arguments were not provided: + <--id |--config-file > + + +Usage: nym-node migrate <--id |--config-file > + +For more information, try '--help'. +``` + +### run +#### stdout +``` +Start this nym-node + +Usage: nym-node run [OPTIONS] + +Options: + --id + Id of the nym-node to use [env: NYMNODE_ID=] [default: default-nym-node] + --config-file + Path to a configuration file of this node [env: NYMNODE_CONFIG=] + --deny-init + Forbid a new node from being initialised if configuration file for the provided specification doesn't already exist [env: NYMNODE_DENY_INIT=] + --init-only + If this is a brand new nym-node, specify whether it should only be initialised without actually running the subprocesses [env: NYMNODE_INIT_ONLY=] + --mode + Specifies the current mode of this nym-node [env: NYMNODE_MODE=] [possible values: mixnode, entry-gateway, exit-gateway] + -w, --write-changes + If this node has been initialised before, specify whether to write any new changes to the config file [env: NYMNODE_WRITE_CONFIG_CHANGES=] + --bonding-information-output + Specify output file for bonding information of this nym-node, i.e. its encoded keys. NOTE: the required bonding information is still a subject to change and this argument should be treated only as a preview of future features [env: NYMNODE_BONDING_INFORMATION_OUTPUT=] + -o, --output + Specify the output format of the bonding information (`text` or `json`) [env: NYMNODE_OUTPUT=] [default: text] [possible values: text, json] + --public-ips + Comma separated list of public ip addresses that will be announced to the nym-api and subsequently to the clients. In nearly all circumstances, it's going to be identical to the address you're going to use for bonding [env: NYMNODE_PUBLIC_IPS=] + --hostname + Optional hostname associated with this gateway that will be announced to the nym-api and subsequently to the clients [env: NYMNODE_HOSTNAME=] + --location + Optional **physical** location of this node's server. Either full country name (e.g. 'Poland'), two-letter alpha2 (e.g. 'PL'), three-letter alpha3 (e.g. 'POL') or three-digit numeric-3 (e.g. '616') can be provided [env: NYMNODE_LOCATION=] + --http-bind-address + Socket address this node will use for binding its http API. default: `0.0.0.0:8080` [env: NYMNODE_HTTP_BIND_ADDRESS=] + --landing-page-assets-path + Path to assets directory of custom landing page of this node [env: NYMNODE_HTTP_LANDING_ASSETS=] + --http-access-token + An optional bearer token for accessing certain http endpoints. Currently only used for prometheus metrics [env: NYMNODE_HTTP_ACCESS_TOKEN=] + --expose-system-info + Specify whether basic system information should be exposed. default: true [env: NYMNODE_HTTP_EXPOSE_SYSTEM_INFO=] [possible values: true, false] + --expose-system-hardware + Specify whether basic system hardware information should be exposed. default: true [env: NYMNODE_HTTP_EXPOSE_SYSTEM_HARDWARE=] [possible values: true, false] + --expose-crypto-hardware + Specify whether detailed system crypto hardware information should be exposed. default: true [env: NYMNODE_HTTP_EXPOSE_CRYPTO_HARDWARE=] [possible values: true, false] + --mixnet-bind-address + Address this node will bind to for listening for mixnet packets default: `0.0.0.0:1789` [env: NYMNODE_MIXNET_BIND_ADDRESS=] + --nym-api-urls + Addresses to nym APIs from which the node gets the view of the network [env: NYMNODE_NYM_APIS=] + --nyxd-urls + Addresses to nyxd chain endpoint which the node will use for chain interactions [env: NYMNODE_NYXD=] + --wireguard-enabled + Specifies whether the wireguard service is enabled on this node [env: NYMNODE_WG_ENABLED=] [possible values: true, false] + --wireguard-bind-address + Socket address this node will use for binding its wireguard interface. default: `0.0.0.0:51822` [env: NYMNODE_WG_BIND_ADDRESS=] + --wireguard-private-network-ip + Ip address of the private wireguard network. default: `10.1.0.0` [env: NYMNODE_WG_IP_NETWORK=] + --wireguard-announced-port + Port announced to external clients wishing to connect to the wireguard interface. Useful in the instances where the node is behind a proxy [env: NYMNODE_WG_ANNOUNCED_PORT=] + --wireguard-private-network-prefix + The prefix denoting the maximum number of the clients that can be connected via Wireguard. The maximum value for IPv4 is 32 and for IPv6 is 128 [env: NYMNODE_WG_PRIVATE_NETWORK_PREFIX=] + --verloc-bind-address + Socket address this node will use for binding its verloc API. default: `0.0.0.0:1790` [env: NYMNODE_VERLOC_BIND_ADDRESS=] + --entry-bind-address + Socket address this node will use for binding its client websocket API. default: `0.0.0.0:9000` [env: NYMNODE_ENTRY_BIND_ADDRESS=] + --announce-ws-port + Custom announced port for listening for websocket client traffic. If unspecified, the value from the `bind_address` will be used instead [env: NYMNODE_ENTRY_ANNOUNCE_WS_PORT=] + --announce-wss-port + If applicable, announced port for listening for secure websocket client traffic [env: NYMNODE_ENTRY_ANNOUNCE_WSS_PORT=] + --enforce-zk-nyms + Indicates whether this gateway is accepting only coconut credentials for accessing the mixnet or if it also accepts non-paying clients [env: NYMNODE_ENFORCE_ZK_NYMS=] [possible values: true, false] + --mnemonic + Custom cosmos wallet mnemonic used for zk-nym redemption. If no value is provided, a fresh mnemonic is going to be generated [env: NYMNODE_MNEMONIC=] + --upstream-exit-policy-url + Specifies the url for an upstream source of the exit policy used by this node [env: NYMNODE_UPSTREAM_EXIT_POLICY=] + --open-proxy + Specifies whether this exit node should run in 'open-proxy' mode and thus would attempt to resolve **ANY** request it receives [env: NYMNODE_OPEN_PROXY=] [possible values: true, false] + -h, --help + Print help +``` +#### stderr +``` +``` + +### sign +#### stdout +``` +Use identity key of this node to sign provided message + +Usage: nym-node sign [OPTIONS] <--text |--contract-msg > + +Options: + --id Id of the nym-node to use [env: NYMNODE_ID=] [default: default-nym-node] + --config-file Path to a configuration file of this node [env: NYMNODE_CONFIG=] + --text Signs an arbitrary piece of text with your identity key + --contract-msg Signs a transaction-specific payload, that is going to be sent to the smart contract, with your identity key + -o, --output [default: text] [possible values: text, json] + -h, --help Print help +``` +#### stderr +``` +``` + +### sign +#### stdout +``` +``` +#### stderr +``` +error: the following required arguments were not provided: + <--text |--contract-msg > + +Usage: nym-node sign <--text |--contract-msg > + +For more information, try '--help'. +``` diff --git a/documentation/autodoc/src/main.rs b/documentation/autodoc/src/main.rs new file mode 100644 index 0000000000..e0dd693767 --- /dev/null +++ b/documentation/autodoc/src/main.rs @@ -0,0 +1,94 @@ +use log::info; +use std::fs::File; +use std::io::{self, Write}; +use std::process::{Command, Output}; + +fn main() -> io::Result<()> { + env_logger::init(); + + let commands_with_subcommands = vec![ + ( + "../../target/release/nym-client", + vec![ + "init", + "run", + "import-credential", + "list-gateways", + "switch-gateway", + "build-info", + "completions", + "generate-fig-spec", + ], + ), + ( + "../../target/release/nym-node", + vec![ + "build-info", + "bonding-information", + "node-details", + "migrate", + "run", + "sign", + ], + ), + ]; + + for (main_command, subcommands) in commands_with_subcommands { + let last_word = get_last_word_from_filepath(main_command); + info!("{last_word:#?}"); + let mut file = File::create(format!("{}.md", last_word.unwrap()))?; + writeln!(file, "# Command Output")?; + writeln!(file, "\n## {}", main_command)?; + for subcommand in subcommands { + execute_command(&mut file, main_command, subcommand)?; + } + } + Ok(()) +} + +fn get_last_word_from_filepath(filepath: &str) -> Option<&str> { + let parts: Vec<&str> = filepath.split('/').collect(); + parts.last().copied() +} + +fn execute_command(file: &mut File, main_command: &str, subcommand: &str) -> io::Result<()> { + // first execute the command with `--help` + info!("executing {} {} --help ", main_command, subcommand); + let output = Command::new(main_command) + .arg(subcommand) + .arg("--help") + .output()?; + write_output_to_file(file, subcommand, output)?; + + // this check is basically checking for the rare commands (rn just one) that start a process with no params + // perhaps if this list grows we could just add a timeout and shunt the running and writing + // into a thread with a timeout or something but for right now its fine / thats overkill + if get_last_word_from_filepath(main_command).unwrap() == "nym-node" && subcommand == "run" { + info!("SKIPPING {} {}", main_command, subcommand); + } else { + info!("executing {} {}", main_command, subcommand); + let output = Command::new(main_command).arg(subcommand).output()?; + write_output_to_file(file, subcommand, output)?; + } + Ok(()) +} + +fn write_output_to_file(file: &mut File, subcommand: &str, output: Output) -> io::Result<()> { + writeln!(file, "\n### {}", subcommand)?; + + // right now this is good to do imo as it shows us whats failing and whats not + // in 'prod' we don't need to write "stdout" + // see comment below re: keeping this in + writeln!(file, "#### stdout\n```")?; + file.write_all(&output.stdout)?; + writeln!(file, "```")?; + + // if we want to keep this we could create 2 copies if you run this in a certain mode ("debug" + // oder so) so you can see the stderr but in reality, we want dont want the errors in teh md + // file and also probaly not write 'stdout', but just have in a clean fashion + writeln!(file, "#### stderr\n```")?; + file.write_all(&output.stderr)?; + writeln!(file, "```")?; + + Ok(()) +}