first commit

This commit is contained in:
egarette@silique.fr 2024-07-21 11:27:47 +02:00
parent 9121ead1b0
commit 6f6295529a
138 changed files with 1850 additions and 1 deletions

510
README.md
View file

@ -1,2 +1,510 @@
# rougail-tutorials_builder ---
gitea: none
include_toc: true
---
# Tutorial description files
## proxy
### 00-proxy.yml
```yaml
version: 1.1
proxy_mode:
description: Configure Proxy Access to the Internet
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
default: No proxy
```
### 10-manual.yml
```yaml
version: 1.1
manual:
description: Manual proxy configuration
disabled:
type: jinja
jinja: |
{% if _.proxy_mode != 'Manual proxy configuration' %}
the proxy mode is not manual
{% endif %}
description: if the value of "proxy.proxy_mode" is not "Manual proxy configuration"
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: '8080'
use_for_https: true # Also use this proxy for HTTPS
'{{ suffix }}_proxy':
description: '{{ suffix }} Proxy'
type: dynamic
dynamic:
- HTTPS
- SOCKS
hidden:
type: jinja
jinja: |
{% if suffix == 'HTTPS' and _.use_for_https %}
HTTPS is same has HTTP
{% endif %}
params:
suffix:
type: suffix
description: |
if HTTPS and HTTPS is same has HTTP
address:
description: Address
type: domainname
params:
allow_ip: true
default:
type: variable
variable: __.http_proxy.address
port:
description: Port
type: port
default:
type: variable
variable: __.http_proxy.port
version:
description: SOCKS host version used by proxy
choices:
- v4
- v5
default: v5
disabled:
type: jinja
jinja: |
{% if suffix == 'HTTPS' %}
if HTTPS
{% endif %}
params:
suffix:
type: suffix
description: |
if not SOCKS
```
### 20-auto.yml
```yaml
version: 1.1
auto:
description: Automatic proxy configuration URL
type: web_address
disabled:
type: jinja
jinja: |
{% if _.proxy_mode != 'Automatic proxy configuration URL' %}
the proxy mode is not automatic
{% endif %}
description: |
if "proxy.proxy_mode" is not "automatic proxy configuration URL"
```
### 30-no_proxy.yml
```yaml
version: 1.1
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
multi: true
mandatory: false
disabled:
type: jinja
jinja: |
{% if _.proxy_mode == 'No proxy' %}
proxy mode is no proxy
{% endif %}
description: if "proxy.proxy_mode" is "No proxy"
test:
- .mozilla.org
- .net.nz
- 192.168.1.0/24
help: Connections to localhost, 127.0.0.1/8 and ::1 are never proxied
```
### 40-prompt_authentication.yml
```yaml
version: 1.1
prompt_authentication:
description: Prompt for authentication if password is saved
default: true
disabled:
type: jinja
jinja: |
{% if _.proxy_mode == 'No proxy' %}
proxy mode is no proxy
{% endif %}
description: if "proxy.proxy_mode" is "No proxy"
```
### 50-proxy_dns_socks5.yml
```yaml
version: 1.1
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
default: false
mode: advanced
disabled:
type: jinja
jinja: |
{% if _.proxy_mode != 'Manual proxy configuration' %}
the proxy mode is not manual
{% elif socks_version == 'v4' %}
socks version is v4
{% endif %}
params:
socks_version:
type: variable
variable: _.manual.socks_proxy.version
propertyerror: false
description: |
if "proxy.proxy_mode" is not "Manual proxy configuration" or "proxy.manual.socks_proxy.version" is "v4"
```
### 60-dns_over_https.yml
```yaml
version: 1.1
dns_over_https: # DNS over HTTPS
enable_dns_over_https: false # Enable DNS over HTTPS
provider:
description: Use Provider
choices:
- Cloudflare
- NextDNS
- Custom
default: Cloudflare
disabled:
type: jinja
jinja: |
{% if not _.enable_dns_over_https %}
Enable DNS over HTTPS is False
{% endif %}
description: if "proxy.dns_over_https.enable_dns_over_https" is not False
custom_dns_url:
description: Custom DNS URL
type: web_address
disabled:
type: jinja
jinja: |
{% if provider is not defined or provider != 'Custom' %}
provider is not custom
{% endif %}
params:
provider:
type: variable
variable: _.provider
propertyerror: false
description: if "proxy.dns_over_https.provider" is "Custom"
validators:
- type: jinja
jinja: |
{% if _.custom_dns_url.startswith('http://') %}
only https is allowed
{% endif %}
description: must starts with 'https://' only
```
## foxyproxy
### 00-foxyproxy.yml
```yaml
version: 1.1
proxies:
description: Proxy configuration
_type: leadership
title:
description: Title or Description
multi: true
color:
description: Color
type:
description: Type
type: choice
choices:
- HTTP
- HTTPS/SSL
- SOCKS4
- SOCKS5
- PAC URL
- WPAD
- System (use system settings)
- Direct (no proxy)
default: Direct (no proxy)
address:
description: IP address, DNS name, server name
multi: true
disabled:
type: jinja
jinja: |
{% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %}
proxy does not need address
{% endif %}
description: &needs_address |
if type not in:
- HTTP
- HTTPS/SSL
- SOCKS4
- SOCKS5
default:
type: jinja
jinja: |
{% if firefox_address is not undefined %}
{{ firefox_address }}
{% endif %}
params:
firefox_address:
type: variable
variable: proxy.manual.http_proxy.address
propertyerror: false
description: copy HTTP address if proxy is not "Manual"
port:
description: Port
type: port
default:
type: jinja
jinja: |
{% if firefox_port is not undefined %}
{{ firefox_port }}
{% endif %}
params:
firefox_port:
type: variable
variable: proxy.manual.http_proxy.port
propertyerror: false
description: copy HTTP port if proxy is not "Manual"
disabled:
type: jinja
jinja: |
{% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %}
proxy does not need port
{% endif %}
description: *needs_address
username:
description: Username
type: unix_user
mandatory:
type: jinja
jinja: |
{% if _.password %}
username is mandatory
{% endif %}
disabled:
type: jinja
jinja: |
{% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %}
proxy does not need username
{% endif %}
description: *needs_address
password:
description: Password
type: secret
disabled:
type: jinja
jinja: |
{% if _.type not in ['HTTP', 'HTTPS/SSL', 'SOCKS4', 'SOCKS5'] %}
proxy does not need password
{% endif %}
description: *needs_address
url:
description: URL
type: web_address
disabled:
type: jinja
jinja: |
{% if _.type not in ['PAC URL', 'WPAD'] %}
proxy does not need url
{% endif %}
description: |
if type is not in:
- PAC URL
- WPAD
```
### 10-redefine.yml
```yaml
version: 1.1
proxies:
username:
redefine: true
mandatory: false
password:
redefine: true
hidden:
type: jinja
jinja: |
{% if not _.username %}
no username defined
{% endif %}
description: if username is not defined
```
# Generated documentation
## Variables for "proxy"
| Variable                                                                                                                  | Description                                                                                                               |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy.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 |
### Manual proxy configuration
`basic` _`disabled`_
**Disabled**: if the value of "proxy.proxy_mode" is not "Manual proxy configuration"
#### HTTP Proxy
`basic`
| Variable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy.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 |
| **proxy.manual.http_proxy.port**<br/>[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | HTTP Port.<br/>**Default**: 8080 |
| Variable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy.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 |
#### "HTTPS Proxy" ou "SOCKS Proxy"
`standard` _`hidden`_
**Hidden**: if HTTPS and HTTPS is same has HTTP<br/>
Cette famille constuit des familles dyn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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy.manual.https_proxy.address** +<br/>**proxy.manual.socks_proxy.address**<br/>[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Address.<br/>**Validator**: the domain name can be an IP<br/>**Default**: the value of the variable "proxy.manual.http_proxy.address" |
| **proxy.manual.https_proxy.port** +<br/>**proxy.manual.socks_proxy.port**<br/>[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Port.<br/>**Default**: the value of the variable "proxy.manual.http_proxy.port" |
| **proxy.manual.https_proxy.version** +<br/>**proxy.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**: if not SOCKS<br/> |
|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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy.auto**<br/>[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Automatic proxy configuration URL.<br/>**Disabled**: if "proxy.proxy_mode" is not "automatic proxy configuration URL"<br/> |
| **proxy.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 only 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**: if "proxy.proxy_mode" is "No proxy" |
| **proxy.prompt_authentication**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disab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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy.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 |
| **proxy.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**: if "proxy.dns_over_https.enable_dns_over_https" is not False |
| **proxy.dns_over_https.custom_dns_url**<br/>[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Custom DNS URL.<br/>**Validator**: must starts with 'https://' only<br/>**Disabled**: if "proxy.dns_over_https.provider" is "Custom" |
## Variables for "foxyproxy"
### Proxy configuration
`basic`
Cette famille contient des listes de bloc de variables.
| Variable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **foxyproxy.proxies.title**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` `unique` `multiple` | Title or Description. |
| **foxyproxy.proxies.color**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | Color. |
| **foxyproxy.proxies.type**<br/>[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Type.<br/>**Choices**: <br/>- HTTP<br/>- HTTPS/SSL<br/>- SOCKS4<br/>- SOCKS5<br/>- PAC URL<br/>- WPAD<br/>- System (use system settings)<br/>- Direct (no proxy) ← (default) |
| **foxyproxy.proxies.address**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ `multiple` | IP address, DNS name, server name.<br/>**Default**: copy HTTP address if proxy is not "Manual"<br/>**Disabled**: if type not in:<br/>- HTTP<br/>- HTTPS/SSL<br/>- SOCKS4<br/>- SOCKS5<br/> |
| **foxyproxy.proxies.port**<br/>[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Port.<br/>**Default**: copy HTTP port if proxy is not "Manual"<br/>**Disabled**: if type not in:<br/>- HTTP<br/>- HTTPS/SSL<br/>- SOCKS4<br/>- SOCKS5<br/> |
| **foxyproxy.proxies.username**<br/>[`unix_user`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` _`disabled`_ | Username.<br/>**Disabled**: if type not in:<br/>- HTTP<br/>- HTTPS/SSL<br/>- SOCKS4<br/>- SOCKS5<br/> |
| **foxyproxy.proxies.password**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`hidden`_ _`disabled`_ | Password.<br/>**Hidden**: if username is not defined<br/>**Disabled**: if type not in:<br/>- HTTP<br/>- HTTPS/SSL<br/>- SOCKS4<br/>- SOCKS5<br/> |
| **foxyproxy.proxies.url**<br/>[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | URL.<br/>**Disabled**: if type is not in:<br/>- PAC URL<br/>- WPAD<br/> |
## Exemple avec les variables obligatoires non renseignées
```yaml
proxy:
manual:
http_proxy:
address: example.net
https_proxy:
address: example.net
socks_proxy:
address: example.net
auto: https://example.net
dns_over_https:
custom_dns_url: https://example.net
```
## Exemple avec tous les variables modifiables
```yaml
proxy:
proxy_mode: No proxy
manual:
http_proxy:
address: example.net
port: '8080'
use_for_https: true
https_proxy:
address: example.net
port: '8080'
version: v5
socks_proxy:
address: example.net
port: '8080'
version: v5
auto: https://example.net
no_proxy:
- .mozilla.org
- .net.nz
- 192.168.1.0/24
prompt_authentication: true
dns_over_https:
enable_dns_over_https: false
provider: Cloudflare
custom_dns_url: https://example.net
foxyproxy:
proxies:
- title: xxx
color: xxx
type: Direct (no proxy)
address:
- None
port: '8080'
username: xxx
password: xxx
url: https://example.net
```

133
build.py Executable file
View file

@ -0,0 +1,133 @@
#!/usr/bin/env python3
from pathlib import Path
from ruamel.yaml import YAML
from ansi2html import Ansi2HTMLConverter
from rougail import RougailConfig, Rougail
from rougail.output_exporter import RougailOutputExporter
from rougail.user_data_file import RougailUserDataFile
from rougail.output_doc import RougailOutputDoc
NUM="50"
if __name__ == "__main__":
rougailconfig = RougailConfig.copy()
rougailconfig['main_dictionaries'] = ['firefox']
rougailconfig['default_dictionary_format_version'] = '1.1'
if Path('foxyproxy').is_dir():
has_foxyproxy = False
rougailconfig['main_namespace'] = 'Firefox'
rougailconfig['extra_dictionaries'] = {'FoxyProxy': ['foxyproxy']}
else:
has_foxyproxy = True
rougailconfig['main_namespace'] = None
# rougailconfig['tiramisu_cache'] = "cache.py"
# rougail = Rougail(rougailconfig)
# config = rougail.get_config()
# print(config.value.get())
rougailconfig['step.output'] = 'doc'
rougailconfig['doc.output_format'] = 'github'
rougailconfig['doc.title_level'] = 3
inventory = RougailOutputDoc(rougailconfig=rougailconfig)
rougailconfig['step.output'] = 'exporter'
header = inventory.formater.header()
doc = ''
yaml = YAML()
namespace = 'firefox'
file_found = False
subdoc = ''
if rougailconfig['main_namespace']:
all_dirs = [[rougailconfig['main_dictionaries']], rougailconfig['extra_dictionaries'].values()]
else:
all_dirs = [[rougailconfig['main_dictionaries']]]
for r in all_dirs:
for dirs in r:
for d in dirs:
files = list(Path(d).iterdir())
files.sort()
for f in files:
namespace = f.parent.name
file_found = True
if f.name.endswith('.yml') or f.name.endswith('.yaml'):
subdoc += inventory.formater.title(str(f), 2)
with f.open(encoding="utf8") as file_fh:
objects = yaml.load(file_fh)
subdoc += inventory.formater.yaml(objects)
# doc += f'![{namespace.capitalize()} Proxy setting]({namespace}.png)\n'
doc += f'<img src="{namespace}.png" width=50% height=50% alt="{namespace.capitalize()} Proxy setting"/>\n\n'
with Path('summary.md').open('r') as sfh:
summary = sfh.read()
doc_file = Path('README.md')
doc = header + inventory.formater.title('Summary', 1) + '\n' + summary + '\n\n' + inventory.formater.title('Structural files', 1) + doc + '\n' + subdoc
with doc_file.open('r') as docfh:
doc += inventory.formater.title('Description', 2) + docfh.read()
if file_found:
doc += inventory.formater.title('Generated documentation', 2)
if has_foxyproxy:
cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -o doc -do github"
else:
cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -n Firefox -e FoxyProxy -d 1 foxyproxy -o doc -do github"
doc += f'```console\n{cmd}\n```\n'
doc += inventory.gen_doc()
#
config = Path('config')
if config.is_dir():
doc += inventory.formater.title('User data', 1)
configs = list(config.iterdir())
configs.sort()
for idx, dirname in enumerate(configs):
for filename in dirname.iterdir():
if filename.name.endswith('.yml') or filename.name.endswith('.yaml'):
doc += inventory.formater.title(f'Example {idx + 1}', 2)
with filename.open(encoding="utf8") as file_fh:
objects = yaml.load(file_fh)
doc += inventory.formater.title(str(filename), 3)
doc += inventory.formater.yaml(objects)
readme = dirname / 'README.md'
if readme.is_file():
doc += inventory.formater.title('Description', 3)
with readme.open() as fh:
doc += fh.read() + '\n\n'
rougail = Rougail(rougailconfig)
tiramisu_config = rougail.get_config()
rougailconfig['step.user_data'] = ['file']
rougailconfig['file.filename'] = str(filename.absolute())
data = RougailUserDataFile(tiramisu_config, rougailconfig=rougailconfig)
data.read()
export = RougailOutputExporter(tiramisu_config, rougailconfig=rougailconfig)
export.errors = data.errors
export.warnings = data.warnings
export.exporter()
with export.formater.console.capture() as capture:
export.print()
conv = Ansi2HTMLConverter(inline=True)
doc += inventory.formater.title('Output', 3)
if has_foxyproxy:
cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff {filename}"
else:
cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -n Firefox -e FoxyProxy -d 1 foxyproxy -u file -ff {filename}"
doc += f"```console\n{cmd}\n```\n"
doc += '<pre>' + conv.convert(capture.get(), full=False) + "</pre>\n"
if (dirname / 'read_write').is_file():
rougailconfig['exporter.read_write'] = True
export = RougailOutputExporter(tiramisu_config, rougailconfig=rougailconfig)
export.exporter()
with export.formater.console.capture() as capture:
export.print()
conv = Ansi2HTMLConverter(inline=True)
doc += inventory.formater.title('Output in read write mode', 3)
if has_foxyproxy:
cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff {filename} --exporter.read_write"
else:
cmd = f"foo@bar:~$ rougail -v 1.1 -m firefox -n Firefox -e FoxyProxy -d 1 foxyproxy -u file -ff {filename} --exporter.read_write"
doc += f"```console\n{cmd}\n```\n"
doc += '<pre>' + conv.convert(capture.get(), full=False) + "</pre>\n"
#
with doc_file.open('w') as docfh:
docfh.write(doc)
with doc_file.open('w') as docfh:
docfh.write(doc)

102
build.sh Executable file
View file

@ -0,0 +1,102 @@
#!/bin/bash -e
set -x
DEST=../rougail-tutorials
if [ -d $DEST ]; then
echo "déjà fait"
exit 1
fi
export LC_ALL=C
BUILDER="$(pwd)"
mkdir -p $DEST/firefox
rm -f summary.md
touch summary.md
cd "$DEST"
DEST="$(pwd)"
cp "$BUILDER"/firefox.png .
cp "$BUILDER"/foxyproxy.png .
cp "$BUILDER"/summary.md .
touch README.md
"$BUILDER"/build.py
rm -rf summary.md
rm -rf jinja_caches
git init -b 1.1
git add .
git commit -am"$(cat $BUILDER/TITLE)"
cd - > /dev/null
for i in $(ls -d "examples"/* | sort); do
if [ -f "$i/README.md" ]; then
rm -rf "$DEST/config"
cp "summary.md" "$DEST"
echo $(basename "$i")
#
cd "$i/dictionaries"
if [ -d firefox ]; then
for j in $(ls firefox/*.yml 2>/dev/null); do
cp "$j" "$DEST/$j"
done
fi
if [ -d foxyproxy ]; then
mkdir -p $DEST/foxyproxy
for j in $(ls foxyproxy/*.yml 2>/dev/null); do
cp "$j" "$DEST/$j"
done
fi
cp -f ../README.md "$DEST"
if [ -d ../config ]; then
cp -aL ../config "$DEST"
fi
msg="[tutorial $(basename $i)] $(cat ../README.md)"
summary="[tutorial $(basename $i)] $(head -n 1 ../README.md)"
[ -e ../firefox.png ] && cp ../firefox.png "$DEST"
[ -e ../foxyproxy.png ] && cp ../foxyproxy.png "$DEST"
cd - > /dev/null
cd "$DEST"
echo "- $summary" >> summary.md
"$BUILDER"/build.py
rm -rf config/*/README.md config/*/read_write
rm -rf jinja_caches summary.md
git add .
git commit -am"$msg"
commit_id="$(git rev-parse HEAD)"
cd - > /dev/null
echo "- [$summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/$commit_id/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/commit/$commit_id))" >> summary.md
fi
done
cd "$DEST"
echo "# Description
This tutorial shows to you an example of Rougail use on how to set a proxy in the Mozilla Firefox browser.
More precisely, this tutorial aims at reproducing this [Mozilla Firefox](https://www.mozilla.org/firefox/new/) settings page:
![Firefox Proxy setting](firefox.png)
And the integration of part of the [Firefox FoxyProxy plugin](https://addons.mozilla.org/firefox/addon/foxyproxy-standard/).
The idea is to have a namespace specific to FoxyProxy and to find in it part of the settings that we will have made in the main namespace.
This is what the page looks like:
![Foxyproxy Proxy setting](foxyproxy.png)
" > README.md
echo "# Summary
Each step is a separerate commit. You can navigate to history to discover different aspect to the Rougail format.
" >> README.md
cat "$BUILDER"/summary.md >> README.md
echo >> README.md
git add .
rm -rf firefox foxyproxy
git commit -am"Summary"
#
git remote add origin ssh://git@forge.cloud.silique.fr:2222/stove/rougail-tutorials.git
git push --set-upstream origin 1.1 --force
echo "FAIT"
exit 0

10
examples/001/README.md Normal file
View file

@ -0,0 +1,10 @@
A first variable
In the Firefox configuration, it is possible to define several configuration modes,
from no proxy at all ("No proxy") to a kind of automatic configuration mode from a file
("Automatic proxy configuration URL").
Were gonna create a first variable called "proxy_mode":
- accepts only a string as value
- requires a value (that is, None is not an option)

View file

@ -0,0 +1 @@
The user data file is empty. So it's only default value that will be used.

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,2 @@
---
proxy_mode: No proxy

View file

@ -0,0 +1,2 @@
---
proxy_mode: Manual proxy configuration

View file

@ -0,0 +1 @@
"foo" should be an invalid value for this variable.

View file

@ -0,0 +1,2 @@
---
proxy_mode: foo

View file

@ -0,0 +1 @@
The integer value "1" is invalid.

View file

@ -0,0 +1,2 @@
---
proxy_mode: 1

View file

@ -0,0 +1,2 @@
---
proxy_mode:

BIN
examples/001/firefox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

BIN
examples/001/firefox.xcf Normal file

Binary file not shown.

9
examples/002/README.md Normal file
View file

@ -0,0 +1,9 @@
The variable description
We can add a description to this first variable.
This information is useful for:
- documentation
- error message
- help user to known which value to set to this variable (for example with [the user data plugin Questionary](https://forge.cloud.silique.fr/gnunux/rougail-user-data-questionary)).

1
examples/002/config Symbolic link
View file

@ -0,0 +1 @@
../001/config

View file

@ -0,0 +1,3 @@
---
proxy_mode:
description: Configure Proxy Access to the Internet

7
examples/003/README.md Normal file
View file

@ -0,0 +1,7 @@
A default value
Now we can define the default value of this variable.
If the user doesn't touch this variable's value, the value is "No proxy"
As user intervention is no more required, so the variable change it's default mode too (from "basic" to "standard").

1
examples/003/config Symbolic link
View file

@ -0,0 +1 @@
../001/config

View file

@ -0,0 +1,4 @@
---
proxy_mode:
description: Configure Proxy Access to the Internet
default: No proxy

7
examples/004/README.md Normal file
View file

@ -0,0 +1,7 @@
A variable with type choice
"Foo" should not be an option to the "proxy_mode" variable.
Now the "proxy_mode" type is "choice", that means that there is a list of available values that can be selected.
We say that the "proxy_mode" variable is constrained (by choices): this variable accept, in fact, only a list of choices.

1
examples/004/config Symbolic link
View file

@ -0,0 +1 @@
../001/config

View file

@ -0,0 +1,11 @@
---
proxy_mode:
description: Configure Proxy Access to the Internet
type: choice
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
default: No proxy

3
examples/005/README.md Normal file
View file

@ -0,0 +1,3 @@
Choice type is optional
The type is optional in choice type (if we have choices attributes, it's a choice option).

1
examples/005/config Symbolic link
View file

@ -0,0 +1 @@
../001/config

View file

@ -0,0 +1,10 @@
---
proxy_mode:
description: Configure Proxy Access to the Internet
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
default: No proxy

14
examples/010/README.md Normal file
View file

@ -0,0 +1,14 @@
A family
The "manual" mode structural descriptions are write in a new files to separate things. But Rougail will concatenate variables and families.
We create a family, which will contain other variables.
This family has:
- a description
- a type
As there is no variable inside this family, the type is mandatory. Without it, Rougail will create a variable.
In fact, this family will be deleted by Rougail too because it is empty.

View file

@ -0,0 +1,4 @@
---
manual:
description: Manual proxy configuration
type: family

BIN
examples/010/firefox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
examples/010/firefox.xcf Normal file

Binary file not shown.

5
examples/011/README.md Normal file
View file

@ -0,0 +1,5 @@
Conditional desactived family
This family will be desactived if "proxy_mode" is not "manual proxy configuration".
Desactived a variable or a family means that this variable will never be accessible.

View file

@ -0,0 +1,8 @@
---
manual:
description: Manual proxy configuration
type: family
disabled:
type: variable
variable: proxy_mode
when_not: 'Manual proxy configuration'

7
examples/012/README.md Normal file
View file

@ -0,0 +1,7 @@
A sub family
Inside a family, we can have variables or families.
The "type" for family "manual" became unecessary because container an other family, so it's not a variable.
In disabled attribute, it's better tu use relative path (we will see the reason in an other slide).

View file

@ -0,0 +1,11 @@
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: _.proxy_mode
when_not: 'Manual proxy configuration'
http_proxy:
description: HTTP Proxy
type: family

5
examples/013/README.md Normal file
View file

@ -0,0 +1,5 @@
Family in "shorthand" mode
The sub family is now in "shorthand" mode. In this mode we can only define "name" and "description" attributes.
Inside the sub family we add two variables (with domainname and port types).

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,2 @@
---
proxy_mode: Manual proxy configuration

View file

@ -0,0 +1,5 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: example.net

View file

@ -0,0 +1,6 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: example.net
port: '3128'

View file

@ -0,0 +1,20 @@
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: _.proxy_mode
when_not: 'Manual proxy configuration'
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080

3
examples/014/README.md Normal file
View file

@ -0,0 +1,3 @@
A boolean variable
Let's create a boolean variable.

View file

@ -0,0 +1,25 @@
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: _.proxy_mode
when_not: 'Manual proxy configuration'
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
use_for_https:
description: Also use this proxy for HTTPS
type: boolean
default: true

3
examples/015/README.md Normal file
View file

@ -0,0 +1,3 @@
Bases type is optional if default value
The type is deduct with the default value type. This is only true for "string", "number", "float" or "boolean" variables.

1
examples/015/config Symbolic link
View file

@ -0,0 +1 @@
../014/config

View file

@ -0,0 +1,24 @@
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: _.proxy_mode
when_not: 'Manual proxy configuration'
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
use_for_https:
description: Also use this proxy for HTTPS
default: true

9
examples/016/README.md Normal file
View file

@ -0,0 +1,9 @@
A variable in "shorthand" mode
Transform it in "shorthand" mode.
In this notation we can only define:
- name
- default value (so deduct the type)
- description

1
examples/016/config Symbolic link
View file

@ -0,0 +1 @@
../014/config

View file

@ -0,0 +1,22 @@
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: _.proxy_mode
when_not: 'Manual proxy configuration'
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
use_for_https: true # Also use this proxy for HTTPS

9
examples/017/README.md Normal file
View file

@ -0,0 +1,9 @@
Conditional hidden family and calculated default value
Add a sub family "https_proxy" which will be hidden if "use_for_https" is True.
Hidden means that we cannot change value, but we can access to it in read only mode. Inside, we add two variable with calculated default value (with variable type).
So, if user set "use_for_https" to True, the default values of HTTPS configuration will be a copy of HTTP values. The use can change HTTPS values if needed.
If user set "use_for_https" to False, the default values of HTTPS configuration will only be a copy of HTTP values.

View file

@ -0,0 +1 @@
If "use_for_https" is true, HTTPS variables are visible in read only mode, but not in read write mode.

View file

@ -0,0 +1,5 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net

View file

View file

@ -0,0 +1,2 @@
If "use_for_https" is false, HTTPS variables are visible in read only mode and in read write mode.

View file

@ -0,0 +1,9 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
port: '3128'
use_for_https: false
https_proxy:
address: https.proxy.net

View file

View file

@ -0,0 +1,44 @@
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: _.proxy_mode
when_not: 'Manual proxy configuration'
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
use_for_https: true # Also use this proxy for HTTPS
https_proxy:
description: HTTPS Proxy
hidden:
type: variable
variable: _.use_for_https
address:
description: HTTPS address
type: domainname
params:
allow_ip: true
default:
type: variable
variable: __.http_proxy.address
port:
description: HTTPS Port
type: port
default:
type: variable
variable: __.http_proxy.port

15
examples/018/README.md Normal file
View file

@ -0,0 +1,15 @@
A dynamic family
HTTPS and socks proxy are very similar. It could be interesting to do on dynamic family instead of duplicate family and variable description.
First of all, we add a dynamic attribute to the family. Dynamic is here a static list of suffix. It could be a variable or jinja informations too.
The dynamic family is only hidden in the HTTPs case.
Hidden is now a Jinja calculation with a parameter named "suffix".
The suffix is use in:
- family name
- family description
- variables name
- variables description

1
examples/018/config Symbolic link
View file

@ -0,0 +1 @@
../017/config

View file

@ -0,0 +1,54 @@
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: _.proxy_mode
when_not: 'Manual proxy configuration'
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
use_for_https: true # Also use this proxy for HTTPS
"{{ suffix }}_proxy":
description: "{{ suffix }} Proxy"
type: dynamic
dynamic:
- HTTPS
- SOCKS
hidden:
type: jinja
jinja: |
{% if suffix == 'HTTPS' and _.use_for_https %}
HTTPS is same has HTTP
{% endif %}
params:
suffix:
type: suffix
address:
description: "{{ suffix }} address"
type: domainname
params:
allow_ip: true
default:
type: variable
variable: __.http_proxy.address
port:
description: "{{ suffix }} port"
type: port
default:
type: variable
variable: __.http_proxy.port

5
examples/019/README.md Normal file
View file

@ -0,0 +1,5 @@
Description of Jinja calculation
By default, the Jinja calculation is generic in documentation. We can add a useful description.
We add a new variable "version" only accessible in "Socks" family.

1
examples/019/config Symbolic link
View file

@ -0,0 +1 @@
../018/config

View file

@ -0,0 +1,70 @@
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: _.proxy_mode
when_not: 'Manual proxy configuration'
http_proxy: # HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
use_for_https: true # Also use this proxy for HTTPS
"{{ suffix }}_proxy":
description: "{{ suffix }} Proxy"
type: dynamic
dynamic:
- HTTPS
- SOCKS
hidden:
type: jinja
jinja: |
{% if suffix == 'HTTPS' and _.use_for_https %}
HTTPS is same has HTTP
{% endif %}
params:
suffix:
type: suffix
description: |
if "use_for_https" is set to True
address:
description: "{{ suffix }} address"
default:
type: variable
variable: __.http_proxy.address
port:
description: "{{ suffix }} port"
default:
type: variable
variable: __.http_proxy.port
version:
description: SOCKS host version used by proxy
choices:
- v4
- v5
default: v5
disabled:
type: jinja
jinja: |
{% if suffix == 'HTTPS' %}
if HTTPS
{% endif %}
params:
suffix:
type: suffix
description: |
if not SOCKS

3
examples/020/README.md Normal file
View file

@ -0,0 +1,3 @@
A conditional disabled variable
Add a new "auto" variable.

View file

@ -0,0 +1,2 @@
---
proxy_mode: Automatic proxy configuration URL

View file

@ -0,0 +1,3 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat

View file

@ -0,0 +1,8 @@
---
auto:
description: Automatic proxy configuration URL
type: web_address
disabled:
type: variable
variable: _.proxy_mode
when: Automatic proxy configuration URL

BIN
examples/020/firefox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
examples/020/firefox.xcf Normal file

Binary file not shown.

4
examples/030/README.md Normal file
View file

@ -0,0 +1,4 @@
A conditional disabled variable
Add a new "no\_proxy" variable.

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,4 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy: 192.168.1.0/24

View file

@ -0,0 +1,16 @@
---
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
disabled:
type: jinja
jinja: |
{% if _.proxy_mode == 'No proxy' %}
proxy mode is no proxy
{% endif %}
description: if "firefox.proxy_mode" is "No proxy"

3
examples/031/README.md Normal file
View file

@ -0,0 +1,3 @@
A variable multi
This variable accept multiple value.

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,6 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy:
- example.net
- 192.168.1.0/24

View file

@ -0,0 +1,3 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat

View file

@ -0,0 +1,17 @@
---
no_proxy:
description: Address for which proxy will be desactivated
type: "domainname"
multi: true
params:
allow_ip: true
allow_cidr_network: true
allow_without_dot: true
allow_startswith_dot: true
disabled:
type: jinja
jinja: |
{% if _.proxy_mode == 'No proxy' %}
proxy mode is no proxy
{% endif %}
description: if "firefox.proxy_mode" is "No proxy"

1
examples/032/README.md Normal file
View file

@ -0,0 +1 @@
A non mandatory variable

1
examples/032/config Symbolic link
View file

@ -0,0 +1 @@
../031/config

View file

@ -0,0 +1,18 @@
---
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
multi: true
mandatory: false
disabled:
type: jinja
jinja: |
{% if _.proxy_mode == 'No proxy' %}
proxy mode is no proxy
{% endif %}
description: if "firefox.proxy_mode" is "No proxy"

3
examples/033/README.md Normal file
View file

@ -0,0 +1,3 @@
Examples
We can add example (only for documentation).

1
examples/033/config Symbolic link
View file

@ -0,0 +1 @@
../031/config

View file

@ -0,0 +1,22 @@
---
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
multi: true
mandatory: false
disabled:
type: jinja
jinja: |
{% if _.proxy_mode == 'No proxy' %}
proxy mode is no proxy
{% endif %}
description: if "firefox.proxy_mode" is "No proxy"
test:
- .mozilla.org
- .net.nz
- 192.168.1.0/24

3
examples/034/README.md Normal file
View file

@ -0,0 +1,3 @@
Help
We can add help informations for documentation.

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,3 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat

View file

@ -0,0 +1,6 @@
---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy:
- .example.net
- 192.168.1.0/24

View file

@ -0,0 +1,23 @@
---
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
multi: true
mandatory: false
disabled:
type: jinja
jinja: |
{% if _.proxy_mode == 'No proxy' %}
proxy mode is no proxy
{% endif %}
description: if "firefox.proxy_mode" is "No proxy"
test:
- .mozilla.org
- .net.nz
- 192.168.1.0/24
help: Connections to localhost, 127.0.0.1/8 and ::1 are never proxied

1
examples/040/README.md Normal file
View file

@ -0,0 +1 @@
A variable in avanced mode

View file

@ -0,0 +1 @@
---

View file

@ -0,0 +1,5 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net

View file

@ -0,0 +1,6 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
proxy_dns_socks5: true

View file

@ -0,0 +1,7 @@
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
socks_proxy:
version: v4

View file

@ -0,0 +1,11 @@
---
prompt_authentication:
description: Prompt for authentication if password is saved
default: true
disabled:
type: jinja
jinja: |
{% if _.proxy_mode == 'No proxy' %}
proxy mode is no proxy
{% endif %}
description: if "firefox.proxy_mode" is "No proxy"

View file

@ -0,0 +1,20 @@
---
proxy_dns_socks5:
description: Use proxy DNS when using SOCKS v5
default: false
mode: advanced
disabled:
type: jinja
jinja: |
{% if _.proxy_mode != 'Manual proxy configuration' %}
the proxy mode is not manual
{% elif socks_version == 'v4' %}
socks version is v4
{% endif %}
params:
socks_version:
type: variable
variable: _.manual.socks_proxy.version
propertyerror: false
description: |
if "firefox.proxy_mode" is not "Manual proxy configuration" or "firefox.manual.socks_proxy.version" is "v4"

BIN
examples/040/firefox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
examples/040/firefox.xcf Normal file

Binary file not shown.

1
examples/060/README.md Normal file
View file

@ -0,0 +1 @@
A boolean variable

View file

@ -0,0 +1 @@
---

Some files were not shown because too many files have changed in this diff Show more