瀏覽代碼

whitespace management

tags/v2.0
Maximilian Eschenbacher 5 年之前
父節點
當前提交
a691e5106e
共有 1 個檔案被更改,包括 27 行新增27 行删除
  1. +27
    -27
      wireguard/files/wg.conf

+ 27
- 27
wireguard/files/wg.conf 查看文件

@@ -1,32 +1,32 @@
{%- macro output_if_set(object, lookup_key, output_key) %}
{%- if object.get(lookup_key) %}
{%- macro output_if_set(object, lookup_key, output_key) -%}
{%- if object.get(lookup_key) -%}
{{output_key}} = {{object.get(lookup_key)}}
{%- endif %}
{%- endmacro %}
{%- macro output_list_if_set(object, lookup_key, output_key) %}
{%- for item in object.get(lookup_key, []) %}
{%- endif -%}
{%- endmacro -%}
{%- macro output_list_if_set(object, lookup_key, output_key) -%}
{%- for item in object.get(lookup_key, []) -%}
{{output_key}} = {{item}}
{%- endfor %}
{%- endmacro %}
{%- endfor -%}
{%- endmacro -%}
[Interface]
{{ output_list_if_set(interface, 'address', 'Address') }}
{{ output_if_set(interface, 'listenport', 'ListenPort') }}
{{ output_list_if_set(interface, 'dns', 'DNS') }}
{{ output_if_set(interface, 'mtu', 'MTU') }}
{{ output_if_set(interface, 'privatekey', 'PrivateKey') }}
{{ output_if_set(interface, 'table', 'Table') }}
{{ output_if_set(interface, 'preup', 'PreUp') }}
{{ output_if_set(interface, 'postup', 'PostUp') }}
{{ output_if_set(interface, 'predown', 'PreDown') }}
{{ output_if_set(interface, 'postdown', 'PostDown') }}
{{ output_if_set(interface, 'saveconfig', 'SaveConfig') }}
{{ output_if_set(interface, 'fwmark', 'FwMark') }}
{{- output_list_if_set(interface, 'address', 'Address') }}
{{- output_if_set(interface, 'listenport', 'ListenPort') }}
{{- output_list_if_set(interface, 'dns', 'DNS') }}
{{- output_if_set(interface, 'mtu', 'MTU') }}
{{- output_if_set(interface, 'privatekey', 'PrivateKey') }}
{{- output_if_set(interface, 'table', 'Table') }}
{{- output_if_set(interface, 'preup', 'PreUp') }}
{{- output_if_set(interface, 'postup', 'PostUp') }}
{{- output_if_set(interface, 'predown', 'PreDown') }}
{{- output_if_set(interface, 'postdown', 'PostDown') }}
{{- output_if_set(interface, 'saveconfig', 'SaveConfig') }}
{{- output_if_set(interface, 'fwmark', 'FwMark') }}

{%- for peer in interface.get('peers', []) %}
{%- for peer in interface.get('peers', []) -%}
[Peer]
{{ output_if_set(peer, 'publickey', 'PublicKey') }}
{{ output_if_set(peer, 'presharedkey', 'PresharedKey') }}
{{ output_list_if_set(peer, 'allowedips', 'AllowedIPs') }}
{{ output_if_set(peer, 'endpoint', 'Endpoint') }}
{{ output_if_set(peer, 'persistentkeepalive', 'PersistentKeepalive') }}
{%- endfor %}
{{- output_if_set(peer, 'publickey', 'PublicKey') }}
{{- output_if_set(peer, 'presharedkey', 'PresharedKey') }}
{{- output_list_if_set(peer, 'allowedips', 'AllowedIPs') }}
{{- output_if_set(peer, 'endpoint', 'Endpoint') }}
{{- output_if_set(peer, 'persistentkeepalive', 'PersistentKeepalive') }}
{%- endfor -%}

Loading…
取消
儲存