2024-11-02 14:58:10 +01:00
- [Summary ](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md )
2024-11-02 14:58:54 +01:00
- [[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))
2024-11-02 14:58:10 +01:00
2024-11-02 14:58:54 +01:00
# [tutorial 081] A choice variable
2024-11-02 14:58:10 +01:00
2024-11-02 14:58:54 +01:00
[View the diff ](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_081~1..v1.1_081 )
2024-11-02 14:58:10 +01:00
2024-11-02 14:58:09 +01:00
## Screenshot
< img src = "firefox.png" width = 50% height = 50% alt = "Firefox Proxy setting" / >
## Structure
2024-11-02 14:58:10 +01:00
### firefox/00-proxy.yml
```yml
---
2024-11-02 14:58:12 +01:00
proxy_mode:
2024-11-02 14:58:13 +01:00
description: Configure Proxy Access to the Internet
2024-11-02 14:58:14 +01:00
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
2024-11-02 14:58:13 +01:00
default: No proxy
2024-11-02 14:58:10 +01:00
```
2024-11-02 14:58:16 +01:00
### firefox/10-manual.yml
2024-11-02 14:58:12 +01:00
```yml
---
2024-11-02 14:58:16 +01:00
manual:
description: Manual proxy configuration
2024-11-02 14:58:24 +01:00
disabled:
variable: proxy_mode
when_not: 'Manual proxy configuration'
2024-11-02 14:58:12 +01:00
2024-11-02 14:58:38 +01:00
http_proxy: # HTTP Proxy
2024-11-02 14:58:17 +01:00
2024-11-02 14:58:18 +01:00
address:
description: HTTP address
2024-11-02 14:58:20 +01:00
type: domainname
2024-11-02 14:58:21 +01:00
params:
allow_ip: true
2024-11-02 14:58:18 +01:00
2024-11-02 14:58:22 +01:00
port:
description: HTTP Port
type: port
default: 8080
2024-11-02 14:58:26 +01:00
```
### firefox/20-manual.yml
```yml
---
manual:
2024-11-02 14:58:39 +01:00
use_for_https: true # Also use this proxy for HTTPS
2024-11-02 14:58:26 +01:00
2024-11-02 14:58:33 +01:00
"{{ identifier }}_proxy":
description: "{{ identifier }} Proxy"
dynamic:
- HTTPS
- SOCKS
2024-11-02 14:58:30 +01:00
hidden:
2024-11-02 14:58:34 +01:00
jinja: |
2024-11-02 14:58:35 +01:00
{% if my_identifier == 'HTTPS' and manual.use_for_https %}
2024-11-02 14:58:34 +01:00
HTTPS is same has HTTP
{% endif %}
2024-11-02 14:58:35 +01:00
params:
my_identifier:
type: identifier
2024-11-02 14:58:36 +01:00
description: |
in HTTPS case if "manual.use_for_https" is set to True
2024-11-02 14:58:28 +01:00
address:
2024-11-02 14:58:33 +01:00
description: "{{ identifier }} address"
2024-11-02 14:58:31 +01:00
default:
variable: manual.http_proxy.address
2024-11-02 14:58:28 +01:00
port:
2024-11-02 14:58:33 +01:00
description: "{{ identifier }} port"
2024-11-02 14:58:31 +01:00
default:
variable: manual.http_proxy.port
2024-11-02 14:58:28 +01:00
2024-11-02 14:58:37 +01:00
version:
description: SOCKS host version used by proxy
choices:
- v4
- v5
default: v5
disabled:
type: identifier
when: 'HTTPS'
2024-11-02 14:58:40 +01:00
```
### firefox/30-auto.yml
```yml
---
auto:
description: Automatic proxy configuration URL
type: web_address
2024-11-02 14:58:41 +01:00
disabled:
variable: proxy_mode
when_not: Automatic proxy configuration URL
2024-11-02 14:58:40 +01:00
2024-11-02 14:58:42 +01:00
```
### firefox/40-no_proxy.yml
```yml
---
no_proxy:
description: Address for which proxy will be desactivated
type: "domainname"
params:
allow_ip: true
allow_cidr_network: true
allow_without_dot: true
allow_startswith_dot: true
2024-11-02 14:58:43 +01:00
multi: true
2024-11-02 14:58:44 +01:00
mandatory: false
2024-11-02 14:58:42 +01:00
disabled:
variable: proxy_mode
when: No proxy
2024-11-02 14:58:46 +01:00
examples:
- .mozilla.org
- .net.nz
- 192.168.1.0/24
2024-11-02 14:58:47 +01:00
help: Connections to localhost, 127.0.0.1/8 and ::1 are never proxied
2024-11-02 14:58:42 +01:00
2024-11-02 14:58:48 +01:00
```
### firefox/50-prompt_authentication.yml
```yml
---
prompt_authentication:
description: Prompt for authentication if password is saved
default: true
disabled:
variable: proxy_mode
when: No proxy
2024-11-02 14:58:49 +01:00
```
### firefox/55-proxy_dns_socks5.yml
```yml
---
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
default: false
2024-11-02 14:58:52 +01:00
mode: advanced
2024-11-02 14:58:50 +01:00
disabled:
jinja: |
{% if manual.socks_proxy.version is propertyerror %}
the proxy mode is not manual
{% elif manual.socks_proxy.version == 'v4' %}
socks version is v4
{% endif %}
description: |
if "firefox.proxy_mode" is not "Manual proxy configuration"
or "firefox.manual.socks_proxy.version" is "v4"
2024-11-02 14:58:49 +01:00
2024-11-02 14:58:52 +01:00
```
### firefox/60-dns_over_https.yml
```yml
---
dns_over_https: # DNS over HTTPS
enable_dns_over_https: false # Enable DNS over HTTPS
2024-11-02 14:58:54 +01:00
provider:
description: Use Provider
choices:
- Cloudflare
- NextDNS
- Custom
default: Cloudflare
disabled:
variable: dns_over_https.enable_dns_over_https
when: false
2024-11-02 14:58:12 +01:00
```
2024-11-02 14:58:16 +01:00
### Generated documentation
2024-11-02 14:58:12 +01:00
```console
2024-11-02 14:58:52 +01:00
foo@bar:~$ rougail -v 1.1 -m firefox/ --modes_level basic standard advanced -o doc -do github
2024-11-02 14:58:12 +01:00
```
2024-11-02 14:58:16 +01:00
### Variables
2024-11-02 14:58:12 +01:00
2024-11-02 14:58:54 +01:00
| Variable | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy_mode** < br /> [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Configure Proxy Access to the Internet.< br /> **Choices**: < br /> - No proxy ← (default)< br /> - Auto-detect proxy settings for this network< br /> - Use system proxy settings< br /> - Manual proxy configuration< br /> - Automatic proxy configuration URL |
2024-11-02 14:58:24 +01:00
#### Manual proxy configuration
2024-11-02 14:58:52 +01:00
`basic` _`disabled`_
2024-11-02 14:58:24 +01:00
**Disabled**: proxy_mode.
##### HTTP Proxy
2024-11-02 14:58:52 +01:00
`basic`
2024-11-02 14:58:28 +01:00
2024-11-02 14:58:54 +01:00
| Variable | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **manual.http_proxy.address** < br /> [`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | HTTP address.< br /> **Validator**: the domain name can be an IP |
| **manual.http_proxy.port** < br /> [`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | HTTP Port.< br /> **Default**: 8080 |
2024-11-02 14:58:52 +01:00
2024-11-02 14:58:54 +01:00
| Variable | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **manual.use_for_https** < br /> [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Also use this proxy for HTTPS.< br /> **Default**: True |
2024-11-02 14:58:30 +01:00
2024-11-02 14:58:33 +01:00
##### "*HTTPS* Proxy" or "*SOCKS* Proxy"
2024-11-02 14:58:30 +01:00
2024-11-02 14:58:52 +01:00
`standard` _`hidden`_
2024-11-02 14:58:30 +01:00
2024-11-02 14:58:36 +01:00
**Hidden**: in HTTPS case if "manual.use_for_https" is set to True.
2024-11-02 14:58:30 +01:00
2024-11-02 14:58:33 +01:00
This family builds families dynamically.
**Identifiers**: < br / > - HTTPS< br / > - SOCKS
2024-11-02 14:58:54 +01:00
| Variable | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **manual.https_proxy.address** or **manual.socks_proxy.address** < br /> [`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | "*HTTPS* address" or "*SOCKS* address".< br /> **Validator**: the domain name can be an IP< br /> **Default**: the value of the variable "manual.http_proxy.address". |
| **manual.https_proxy.port** or **manual.socks_proxy.port** < br /> [`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | "*HTTPS* port" or "*SOCKS* port".< br /> **Default**: the value of the variable "manual.http_proxy.port". |
| **manual.https_proxy.version** or **manual.socks_proxy.version** < br /> [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | SOCKS host version used by proxy.< br /> **Choices**: < br /> - v4< br /> - v5 ← (default)< br /> **Disabled**: when the identifier is "HTTPS". |
2024-11-02 14:58:52 +01:00
2024-11-02 14:58:54 +01:00
| Variable | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **auto** < br /> [`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Automatic proxy configuration URL.< br /> **Disabled**: proxy_mode. |
| **no_proxy** < br /> [`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` _`disabled`_ `unique` `multiple` | Address for which proxy will be desactivated.< br /> Connections to localhost, 127.0.0.1/8 and ::1 are never proxied.< br /> **Validators**:< br /> - the domain name can starts by a dot< br /> - the domain name can be a hostname< br /> - the domain name can be an IP< br /> - the domain name can be network in CIDR format< br /> **Examples**: < br /> - .mozilla.org< br /> - .net.nz< br /> - 192.168.1.0/24< br /> **Disabled**: proxy_mode. |
| **prompt_authentication** < br /> [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Prompt for authentication if password is saved.< br /> **Default**: True< br /> **Disabled**: proxy_mode. |
2024-11-02 14:58:52 +01:00
#### DNS over HTTPS
2024-11-02 14:58:40 +01:00
2024-11-02 14:58:52 +01:00
`standard`
2024-11-02 14:58:54 +01:00
| Variable | Description |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **dns_over_https.enable_dns_over_https** < br /> [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Enable DNS over HTTPS.< br /> **Default**: False |
| **dns_over_https.provider** < br /> [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Use Provider.< br /> **Choices**: < br /> - Cloudflare ← (default)< br /> - NextDNS< br /> - Custom< br /> **Disabled**: dns_over_https.enable_dns_over_https. |
2024-11-02 14:58:18 +01:00
2024-11-02 14:58:38 +01:00
## User data
2024-11-02 14:58:26 +01:00
2024-11-02 14:58:38 +01:00
### Example 1
2024-11-02 14:58:26 +01:00
2024-11-02 14:58:38 +01:00
#### config/01/config.yaml
```yml
---
```
#### Output
```console
2024-11-02 14:58:52 +01:00
foo@bar:~$ rougail -v 1.1 -m firefox/ --modes_level basic standard advanced -u file -ff config/01/config.yaml
2024-11-02 14:58:38 +01:00
```
2024-11-02 14:58:42 +01:00
< pre > ╭────────────────────────── Caption ──────────────────────────╮
2024-11-02 14:58:38 +01:00
│ Variable < span style = "color: #ffd700 " > Default value</ span > │
│ < span style = "color: #5c5cff " > Undocumented variable</ span > Modified value │
│ < span style = "color: #ff0000 " > Undocumented but modified variable</ span > (< span style = "color: #00aa00 " > Original default value</ span > ) │
│ < span style = "color: #ffaf00 " > Unmodifiable variable</ span > │
╰─────────────────────────────────────────────────────────────╯
Variables:
2024-11-02 14:58:52 +01:00
< span style = "color: #5c5cff " > ┣━━ </ span > 📓 proxy_mode: < span style = "color: #ffd700 " > No proxy</ span >
< span style = "color: #5c5cff " > ┗━━ </ span > 📂 dns_over_https
< span style = "color: #5c5cff " > </ span >< span style = "color: #5c5cff " > ┗━━ </ span > 📓 enable_dns_over_https: < span style = "color: #ffd700 " > False</ span >
2024-11-02 14:58:38 +01:00
< / pre >
2024-11-02 14:58:54 +01:00
### Example 2
#### config/02/config.yaml
```yml
---
dns_over_https:
enable_dns_over_https: true
```
#### Output
```console
foo@bar:~$ rougail -v 1.1 -m firefox/ --modes_level basic standard advanced -u file -ff config/02/config.yaml
```
< pre > ╭────────────────────────── Caption ──────────────────────────╮
│ Variable < span style = "color: #ffd700 " > Default value</ span > │
│ < span style = "color: #5c5cff " > Undocumented variable</ span > Modified value │
│ < span style = "color: #ff0000 " > Undocumented but modified variable</ span > (< span style = "color: #00aa00 " > Original default value</ span > ) │
│ < span style = "color: #ffaf00 " > Unmodifiable variable</ span > │
╰─────────────────────────────────────────────────────────────╯
Variables:
< span style = "color: #5c5cff " > ┣━━ </ span > 📓 proxy_mode: < span style = "color: #ffd700 " > No proxy</ span >
< span style = "color: #5c5cff " > ┗━━ </ span > 📂 dns_over_https
< span style = "color: #5c5cff " > </ span >< span style = "color: #5c5cff " > ┣━━ </ span > 📓 enable_dns_over_https: True
< span style = "color: #5c5cff " > </ span >< span style = "color: #5c5cff " > ┗━━ </ span > 📓 provider: < span style = "color: #ffd700 " > Cloudflare</ span >
< / pre >
2024-11-02 14:58:38 +01:00
2024-11-02 14:58:54 +01:00
- [[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))