File: views.lua.j2

package info (click to toggle)
knot-resolver 6.0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,376 kB
  • sloc: javascript: 42,732; ansic: 40,311; python: 12,580; cpp: 2,121; sh: 1,988; xml: 193; makefile: 181
file content (27 lines) | stat: -rw-r--r-- 868 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{% from 'macros/common_macros.lua.j2' import quotes %}
{% from 'macros/view_macros.lua.j2' import get_proto_set, view_flags, view_answer %}
{% from 'macros/policy_macros.lua.j2' import policy_flags, policy_tags_assign, policy_price_factor %}

{% if cfg.views %}
{% for view in cfg.views %}
{% for subnet in view.subnets %}

assert(C.kr_view_insert_action('{{ subnet }}', '{{ view.dst_subnet or '' }}',
  {{ get_proto_set(view.protocols) }}, policy.COMBINE({
{%- set flags = view_flags(view.options) -%}
{% if flags %}
	{{ quotes(policy_flags(flags)) }},
{%- endif %}
{% if view.options.price_factor|float != 1.0 %}
	{{ quotes(policy_price_factor(view.options.price_factor)) }},
{%- endif %}
{% if view.tags %}
	{{ policy_tags_assign(view.tags) }},
{% elif view.answer %}
	{{ view_answer(view.answer) }},
{%- endif %}
  })) == 0)

{% endfor %}
{% endfor %}
{% endif %}