)
+class PROXYv2Schema(SchemaNode):
+ """
+ PROXYv2 protocol configuration.
+
+ ---
+ allow: Allow usage of the PROXYv2 protocol headers by clients on the specified addresses.
+ """
+
+ allow: List[Union[IPAddress, IPNetwork]]
+
+
class NetworkSchema(SchemaNode):
"""
Network connections and protocols configuration.
edns_buffer_size: Maximum EDNS payload size advertised in DNS packets. Different values can be configured for communication downstream (towards clients) and upstream (towards other DNS servers).
address_renumbering: Renumbers addresses in answers to different address space.
tls: TLS configuration, also affects DNS over TLS and DNS over HTTPS.
+ proxy_v2: PROXYv2 protocol configuration.
listen: List of interfaces to listen to and its configuration.
"""
edns_buffer_size: EdnsBufferSizeSchema = EdnsBufferSizeSchema()
address_renumbering: Optional[List[AddressRenumberingSchema]] = None
tls: TLSSchema = TLSSchema()
+ proxy_v2: Union[Literal[False], PROXYv2Schema] = False
listen: List[ListenSchema] = [
ListenSchema({"interface": "127.0.0.1"}),
ListenSchema({"interface": "::1", "freebind": True}),
{{ http_config(cfg.network.tls,"doh_legacy") }}
{% endif %}
+{% if cfg.network.proxy_v2 %}
+-- network.proxy-v2
+net.proxy_allowed({
+{% for item in cfg.network.proxy_v2.allow %}
+'{{ item }}',
+{% endfor %}
+})
+{% else %}
+net.proxy_allowed({})
+{% endif %}
+
-- network.listen
{% for listen in cfg.network.listen %}
{{ network_listen(listen) }}