From b019f5ee1e74a55feafb97adaa5017af3bc6954e Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 2 Nov 2024 14:58:55 +0100 Subject: [PATCH] [tutorial 082] A web_address variable (config and doc) --- README.md | 131 ++++++++++++++++++++++++++++++--------- config/03/config.yaml | 5 ++ config/03/output_ro.html | 13 ++++ config/04/config.yaml | 5 ++ config/04/output_ro.html | 13 ++++ 5 files changed, 138 insertions(+), 29 deletions(-) create mode 100644 config/03/config.yaml create mode 100644 config/03/output_ro.html create mode 100644 config/04/config.yaml create mode 100644 config/04/output_ro.html diff --git a/README.md b/README.md index ab8fafb..1ebb7f9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ - [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md) -- [[tutorial 080] A boolean variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_080/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_080~1..v1.1_080)) +- [[tutorial 081] A choice variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_081/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_081~1..v1.1_081)) -# [tutorial 081] A choice variable +# [tutorial 082] A web_address variable -[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_081~1..v1.1_081) +[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_082~1..v1.1_082) ## Screenshot @@ -194,6 +194,16 @@ dns_over_https: # DNS over HTTPS variable: dns_over_https.enable_dns_over_https when: false + custom_dns_url: + description: Custom DNS URL + type: web_address + disabled: + jinja: | + {% if dns_over_https.provider is propertyerror or dns_over_https.provider != 'Custom' %} + provider is not custom + {% endif %} + description: if "dns_over_https.provider" is not "Custom" + ``` ### Generated documentation @@ -202,9 +212,9 @@ foo@bar:~$ rougail -v 1.1 -m firefox/ --modes_level basic standard advanced -o d ``` ### Variables -| Variable                                                                                                                | Description                                                                                                             | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **proxy_mode**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Configure Proxy Access to the Internet.
**Choices**:
- No proxy ← (default)
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL | +| Variable                                                                                                                  | Description                                                                                                               | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **proxy_mode**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Configure Proxy Access to the Internet.
**Choices**:
- No proxy ← (default)
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL | #### Manual proxy configuration @@ -216,14 +226,14 @@ foo@bar:~$ rougail -v 1.1 -m firefox/ --modes_level basic standard advanced -o d `basic` -| Variable                                                                                                                | Description                                                                                                             | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **manual.http_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | HTTP address.
**Validator**: the domain name can be an IP | -| **manual.http_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | HTTP Port.
**Default**: 8080 | +| Variable                                                                                                                  | Description                                                                                                               | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **manual.http_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | HTTP address.
**Validator**: the domain name can be an IP | +| **manual.http_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | HTTP Port.
**Default**: 8080 | -| Variable                                                                                                                | Description                                                                                                             | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **manual.use_for_https**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Also use this proxy for HTTPS.
**Default**: True | +| Variable                                                                                                                  | Description                                                                                                               | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **manual.use_for_https**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Also use this proxy for HTTPS.
**Default**: True | ##### "*HTTPS* Proxy" or "*SOCKS* Proxy" @@ -236,26 +246,27 @@ This family builds families dynamically. **Identifiers**:
- HTTPS
- SOCKS -| Variable                                                                                                                | Description                                                                                                             | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **manual.https_proxy.address** or **manual.socks_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | "*HTTPS* address" or "*SOCKS* address".
**Validator**: the domain name can be an IP
**Default**: the value of the variable "manual.http_proxy.address". | -| **manual.https_proxy.port** or **manual.socks_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | "*HTTPS* port" or "*SOCKS* port".
**Default**: the value of the variable "manual.http_proxy.port". | -| **manual.https_proxy.version** or **manual.socks_proxy.version**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | SOCKS host version used by proxy.
**Choices**:
- v4
- v5 ← (default)
**Disabled**: when the identifier is "HTTPS". | +| Variable                                                                                                                  | Description                                                                                                               | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **manual.https_proxy.address** or **manual.socks_proxy.address**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | "*HTTPS* address" or "*SOCKS* address".
**Validator**: the domain name can be an IP
**Default**: the value of the variable "manual.http_proxy.address". | +| **manual.https_proxy.port** or **manual.socks_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | "*HTTPS* port" or "*SOCKS* port".
**Default**: the value of the variable "manual.http_proxy.port". | +| **manual.https_proxy.version** or **manual.socks_proxy.version**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | SOCKS host version used by proxy.
**Choices**:
- v4
- v5 ← (default)
**Disabled**: when the identifier is "HTTPS". | -| Variable                                                                                                                | Description                                                                                                             | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **auto**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Automatic proxy configuration URL.
**Disabled**: proxy_mode. | -| **no_proxy**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` _`disabled`_ `unique` `multiple` | Address for which proxy will be desactivated.
Connections to localhost, 127.0.0.1/8 and ::1 are never proxied.
**Validators**:
- the domain name can starts by a dot
- the domain name can be a hostname
- the domain name can be an IP
- the domain name can be network in CIDR format
**Examples**:
- .mozilla.org
- .net.nz
- 192.168.1.0/24
**Disabled**: proxy_mode. | -| **prompt_authentication**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Prompt for authentication if password is saved.
**Default**: True
**Disabled**: proxy_mode. | +| Variable                                                                                                                  | Description                                                                                                               | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **auto**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Automatic proxy configuration URL.
**Disabled**: proxy_mode. | +| **no_proxy**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` _`disabled`_ `unique` `multiple` | Address for which proxy will be desactivated.
Connections to localhost, 127.0.0.1/8 and ::1 are never proxied.
**Validators**:
- the domain name can starts by a dot
- the domain name can be a hostname
- the domain name can be an IP
- the domain name can be network in CIDR format
**Examples**:
- .mozilla.org
- .net.nz
- 192.168.1.0/24
**Disabled**: proxy_mode. | +| **prompt_authentication**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Prompt for authentication if password is saved.
**Default**: True
**Disabled**: proxy_mode. | #### DNS over HTTPS -`standard` +`basic` -| Variable                                                                                                                | Description                                                                                                             | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **dns_over_https.enable_dns_over_https**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Enable DNS over HTTPS.
**Default**: False | -| **dns_over_https.provider**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Use Provider.
**Choices**:
- Cloudflare ← (default)
- NextDNS
- Custom
**Disabled**: dns_over_https.enable_dns_over_https. | +| Variable                                                                                                                  | Description                                                                                                               | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **dns_over_https.enable_dns_over_https**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Enable DNS over HTTPS.
**Default**: False | +| **dns_over_https.provider**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Use Provider.
**Choices**:
- Cloudflare ← (default)
- NextDNS
- Custom
**Disabled**: dns_over_https.enable_dns_over_https. | +| **dns_over_https.custom_dns_url**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Custom DNS URL.
**Disabled**: if "dns_over_https.provider" is not "Custom". | ## User data @@ -313,6 +324,68 @@ Variables: ┣━━ 📓 enable_dns_over_https: True ┗━━ 📓 provider: Cloudflare +### Example 3 + +#### config/03/config.yaml -- [[tutorial 082] A web_address variable ](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_082/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_082~1..v1.1_082)) +```yml +--- +dns_over_https: + enable_dns_over_https: true + provider: Custom + custom_dns_url: http://dns.net + +``` +#### Output + +```console +foo@bar:~$ rougail -v 1.1 -m firefox/ --modes_level basic standard advanced -u file -ff config/03/config.yaml +``` +
╭────────────────────────── Caption ──────────────────────────╮
+│ Variable                           Default value            │
+│ Undocumented variable              Modified value           │
+│ Undocumented but modified variable (Original default value) │
+│ Unmodifiable variable                                       │
+╰─────────────────────────────────────────────────────────────╯
+Variables:
+┣━━ 📓 proxy_mode: No proxy
+┗━━ 📂 dns_over_https
+    ┣━━ 📓 enable_dns_over_https: True
+    ┣━━ 📓 provider: Custom (Cloudflare)
+    ┗━━ 📓 custom_dns_url: http://dns.net
+
+### Example 4 + +#### config/04/config.yaml + + +```yml +--- +dns_over_https: + enable_dns_over_https: true + provider: Custom + custom_dns_url: https://dns.net + +``` +#### Output + +```console +foo@bar:~$ rougail -v 1.1 -m firefox/ --modes_level basic standard advanced -u file -ff config/04/config.yaml +``` +
╭────────────────────────── Caption ──────────────────────────╮
+│ Variable                           Default value            │
+│ Undocumented variable              Modified value           │
+│ Undocumented but modified variable (Original default value) │
+│ Unmodifiable variable                                       │
+╰─────────────────────────────────────────────────────────────╯
+Variables:
+┣━━ 📓 proxy_mode: No proxy
+┗━━ 📂 dns_over_https
+    ┣━━ 📓 enable_dns_over_https: True
+    ┣━━ 📓 provider: Custom (Cloudflare)
+    ┗━━ 📓 custom_dns_url: https://dns.net
+
+ + +- [[tutorial 083] A variable with custom validation](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_083/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_083~1..v1.1_083)) diff --git a/config/03/config.yaml b/config/03/config.yaml new file mode 100644 index 0000000..2497fc1 --- /dev/null +++ b/config/03/config.yaml @@ -0,0 +1,5 @@ +--- +dns_over_https: + enable_dns_over_https: true + provider: Custom + custom_dns_url: http://dns.net diff --git a/config/03/output_ro.html b/config/03/output_ro.html new file mode 100644 index 0000000..94673d0 --- /dev/null +++ b/config/03/output_ro.html @@ -0,0 +1,13 @@ +
╭────────────────────────── Caption ──────────────────────────╮
+│ Variable                           Default value            │
+│ Undocumented variable              Modified value           │
+│ Undocumented but modified variable (Original default value) │
+│ Unmodifiable variable                                       │
+╰─────────────────────────────────────────────────────────────╯
+Variables:
+┣━━ 📓 proxy_mode: No proxy
+┗━━ 📂 dns_over_https
+    ┣━━ 📓 enable_dns_over_https: True
+    ┣━━ 📓 provider: Custom (Cloudflare)
+    ┗━━ 📓 custom_dns_url: http://dns.net
+
diff --git a/config/04/config.yaml b/config/04/config.yaml new file mode 100644 index 0000000..7f28b0d --- /dev/null +++ b/config/04/config.yaml @@ -0,0 +1,5 @@ +--- +dns_over_https: + enable_dns_over_https: true + provider: Custom + custom_dns_url: https://dns.net diff --git a/config/04/output_ro.html b/config/04/output_ro.html new file mode 100644 index 0000000..d297e52 --- /dev/null +++ b/config/04/output_ro.html @@ -0,0 +1,13 @@ +
╭────────────────────────── Caption ──────────────────────────╮
+│ Variable                           Default value            │
+│ Undocumented variable              Modified value           │
+│ Undocumented but modified variable (Original default value) │
+│ Unmodifiable variable                                       │
+╰─────────────────────────────────────────────────────────────╯
+Variables:
+┣━━ 📓 proxy_mode: No proxy
+┗━━ 📂 dns_over_https
+    ┣━━ 📓 enable_dns_over_https: True
+    ┣━━ 📓 provider: Custom (Cloudflare)
+    ┗━━ 📓 custom_dns_url: https://dns.net
+