<model>
    <mount>//OPNsense/unboundplus</mount>
    <description>Unbound configuration</description>
    <version>1.0.6</version>
    <items>
        <general>
            <enabled type="BooleanField">
                <default>0</default>
                <Required>Y</Required>
            </enabled>
            <port type="PortField">
                <default>53</default>
                <Required>Y</Required>
            </port>
            <stats type="BooleanField">
                <default>0</default>
                <Required>N</Required>
            </stats>
            <active_interface type=".\UnboundInterfaceField">
                <Required>N</Required>
                <Multiple>Y</Multiple>
            </active_interface>
            <dnssec type="BooleanField">
                <default>0</default>
            </dnssec>
            <dns64 type="BooleanField">
                <default>0</default>
            </dns64>
            <dns64prefix type="NetworkField">
                <default>64:ff9b::/96</default>
                <Required>N</Required>
                <NetMaskRequired>Y</NetMaskRequired>
                <AddressFamily>ipv6</AddressFamily>
            </dns64prefix>
            <noarecords type="BooleanField">
                <default>0</default>
            </noarecords>
            <regdhcp type="BooleanField">
                <default>0</default>
            </regdhcp>
            <regdhcpdomain type="TextField">
                <Required>N</Required>
                <mask>/^(?:(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$/i</mask>
                <ValidationMessage>A valid domain must be specified.</ValidationMessage>
            </regdhcpdomain>
            <regdhcpstatic type="BooleanField">
                <default>0</default>
            </regdhcpstatic>
            <noreglladdr6 type="BooleanField">
                <default>0</default>
            </noreglladdr6>
            <noregrecords type="BooleanField">
                <default>0</default>
            </noregrecords>
            <txtsupport type="BooleanField">
                <default>0</default>
            </txtsupport>
            <cacheflush type="BooleanField">
                <default>0</default>
            </cacheflush>
            <local_zone_type type="OptionField">
                <default>transparent</default>
                <Required>Y</Required>
                <OptionValues>
                    <opt1 value="transparent">transparent</opt1>
                    <opt2 value="always_nxdomain">always_nxdomain</opt2>
                    <opt3 value="always_refuse">always_refuse</opt3>
                    <opt4 value="always_transparent">always_transparent</opt4>
                    <opt5 value="deny">deny</opt5>
                    <opt6 value="inform">inform</opt6>
                    <opt7 value="inform_deny">inform_deny</opt7>
                    <opt8 value="nodefault">nodefault</opt8>
                    <opt9 value="refuse">refuse</opt9>
                    <opt10 value="static">static</opt10>
                    <opt11 value="typetransparent">typetransparent</opt11>
                </OptionValues>
            </local_zone_type>
            <outgoing_interface type=".\UnboundInterfaceField">
                <Required>N</Required>
                <Multiple>Y</Multiple>
            </outgoing_interface>
            <enable_wpad type="BooleanField">
                <default>0</default>
            </enable_wpad>
        </general>
        <advanced>
            <hideidentity type="BooleanField">
                <default>0</default>
            </hideidentity>
            <hideversion type="BooleanField">
                <default>0</default>
            </hideversion>
            <prefetch type="BooleanField">
                <default>0</default>
            </prefetch>
            <prefetchkey type="BooleanField">
                <default>0</default>
            </prefetchkey>
            <dnssecstripped type="BooleanField">
                <default>0</default>
            </dnssecstripped>
            <serveexpired type="BooleanField">
                <default>0</default>
            </serveexpired>
            <serveexpiredreplyttl type="NumericField">
            </serveexpiredreplyttl>
            <serveexpiredttl type="NumericField">
            </serveexpiredttl>
            <serveexpiredttlreset type="BooleanField">
                <default>0</default>
            </serveexpiredttlreset>
            <serveexpiredclienttimeout type="NumericField">
            </serveexpiredclienttimeout>
            <qnameminstrict type="BooleanField">
                <default>0</default>
            </qnameminstrict>
            <extendedstatistics type="BooleanField">
                <default>0</default>
            </extendedstatistics>
            <logqueries type="BooleanField">
                <default>0</default>
            </logqueries>
            <logreplies type="BooleanField">
                <default>0</default>
            </logreplies>
            <logtagqueryreply type="BooleanField">
                <default>0</default>
            </logtagqueryreply>
            <logservfail type="BooleanField">
                <default>0</default>
            </logservfail>
            <loglocalactions type="BooleanField">
                <default>0</default>
            </loglocalactions>
            <logverbosity type="OptionField">
                <default>1</default>
                <Required>Y</Required>
                <OptionValues>
                    <opt1 value="0">Level 0</opt1>
                    <opt2 value="1">Level 1 (Default)</opt2>
                    <opt3 value="2">Level 2</opt3>
                    <opt4 value="3">Level 3</opt4>
                    <opt5 value="4">Level 4</opt5>
                    <opt6 value="5">Level 5</opt6>
                </OptionValues>
            </logverbosity>
            <valloglevel  type="OptionField">
                <default>0</default>
                <Required>Y</Required>
                <OptionValues>
                    <opt1 value="0">Level 0 (Default)</opt1>
                    <opt2 value="1">Level 1</opt2>
                    <opt3 value="2">Level 2</opt3>
                </OptionValues>
            </valloglevel>
            <privatedomain type="CSVListField">
                <Required>N</Required>
            </privatedomain>
            <privateaddress type="NetworkField">
                <Required>N</Required>
                <FieldSeparator>,</FieldSeparator>
                <WildcardEnabled>N</WildcardEnabled>
                <default>0.0.0.0/8,10.0.0.0/8,100.64.0.0/10,169.254.0.0/16,172.16.0.0/12,192.0.2.0/24,192.168.0.0/16,198.18.0.0/15,198.51.100.0/24,203.0.113.0/24,233.252.0.0/24,::1/128,2001:db8::/32,fc00::/8,fd00::/8,fe80::/10</default>
                <asList>Y</asList>
            </privateaddress>
            <insecuredomain type="CSVListField">
                <Required>N</Required>
            </insecuredomain>
            <msgcachesize type="TextField">
                <Mask>/[0-9]+[kmg]?/i</Mask>
                <ValidationMessage>The cache size should be numeric, optionally appended with 'k', 'm', or 'g'</ValidationMessage>
            </msgcachesize>
            <rrsetcachesize type="TextField">
                <Mask>/[0-9]+[kmg]?/i</Mask>
                <ValidationMessage>The cache size should be numeric, optionally appended with 'k', 'm', or 'g'</ValidationMessage>
            </rrsetcachesize>
            <outgoingnumtcp type="NumericField">
            </outgoingnumtcp>
            <incomingnumtcp type="NumericField">
            </incomingnumtcp>
            <numqueriesperthread type="NumericField">
            </numqueriesperthread>
            <outgoingrange type="NumericField">
            </outgoingrange>
            <jostletimeout type="NumericField">
            </jostletimeout>
            <cachemaxttl type="NumericField">
            </cachemaxttl>
            <cachemaxnegativettl type="NumericField">
            </cachemaxnegativettl>
            <cacheminttl type="NumericField">
            </cacheminttl>
            <infrahostttl type="NumericField">
            </infrahostttl>
            <infrakeepprobing type="BooleanField">
                <default>0</default>
            </infrakeepprobing>
            <infracachenumhosts type="NumericField">
            </infracachenumhosts>
            <unwantedreplythreshold type="NumericField">
            </unwantedreplythreshold>
        </advanced>
        <acls>
            <default_action type="OptionField">
                <default>allow</default>
                <Required>Y</Required>
                <OptionValues>
                    <opt1 value="allow">Allow</opt1>
                    <opt2 value="deny">Deny</opt2>
                    <opt3 value="refuse">Refuse</opt3>
                </OptionValues>
            </default_action>
            <acl type="ArrayField">
                <enabled type="BooleanField">
                    <default>1</default>
                    <Required>Y</Required>
                </enabled>
                <name type="TextField">
                    <Required>Y</Required>
                    <ValidationMessage>An Access list name is required</ValidationMessage>
                </name>
                <action type="OptionField">
                    <default>allow</default>
                    <Required>Y</Required>
                    <OptionValues>
                        <opt1 value="allow">Allow</opt1>
                        <opt2 value="deny">Deny</opt2>
                        <opt3 value="refuse">Refuse</opt3>
                        <opt4 value="allow_snoop">Allow Snoop</opt4>
                        <opt5 value="deny_non_local">Deny Non-local</opt5>
                        <opt6 value="refuse_non_local">Refuse Non-local</opt6>
                    </OptionValues>
                </action>
                <networks type="NetworkField">
                    <Multiple>Y</Multiple>
                    <Required>Y</Required>
                    <ValidationMessage>Please specify a one or more valid network segment in CIDR notation (Ipv4/IPv6).</ValidationMessage>
                    <WildcardEnabled>N</WildcardEnabled>
                    <FieldSeparator>,</FieldSeparator>
                    <NetMaskRequired>Y</NetMaskRequired>
                    <asList>Y</asList>
                </networks>
                <description type="TextField">
                    <Required>N</Required>
                    <mask>/^(.){1,255}$/u</mask>
                    <ValidationMessage>Description should be a string between 1 and 255 characters</ValidationMessage>
                </description>
            </acl>
        </acls>
        <dnsbl>
            <enabled type="BooleanField">
                <default>0</default>
                <Required>Y</Required>
            </enabled>
            <safesearch type="BooleanField">
                <default>0</default>
                <Required>N</Required>
            </safesearch>
            <type type="OptionField">
                <Required>N</Required>
                <Multiple>Y</Multiple>
                <OptionValues>
                    <atf>Abuse.ch - ThreatFox IOC database</atf>
                    <aa>AdAway List</aa>
                    <ag>AdGuard List</ag>
                    <bla0>Blocklist.site Abuse</bla0>
                    <bla>Blocklist.site Ads</bla>
                    <blc>Blocklist.site Crypto</blc>
                    <bld>Blocklist.site Drugs</bld>
                    <blf>Blocklist.site Fraud</blf>
                    <blf0>Blocklist.site Facebook</blf0>
                    <blg>Blocklist.site Gambling</blg>
                    <blm>Blocklist.site Malware</blm>
                    <blp>Blocklist.site Phishing</blp>
                    <blp0>Blocklist.site Piracy</blp0>
                    <blp1>Blocklist.site Porn</blp1>
                    <blr>Blocklist.site Ransomware</blr>
                    <blr0>Blocklist.site Redirect</blr0>
                    <bls>Blocklist.site Scam</bls>
                    <blt>Blocklist.site Tiktok</blt>
                    <blt0>Blocklist.site Torrent</blt0>
                    <blt1>Blocklist.site Tracking</blt1>
                    <bly>Blocklist.site Youtube</bly>
                    <el>EasyList</el>
                    <ep>EasyPrivacy</ep>
                    <nc>NoCoin List</nc>
                    <pa>All Porn List</pa>
                    <pt>PornTop1M List</pt>
                    <sa>Simple Ad List</sa>
                    <st>Simple Tracker List</st>
                    <sb>Steven Black List</sb>
                    <ws>WindowsSpyBlocker (spy)</ws>
                    <wsu>WindowsSpyBlocker (update)</wsu>
                    <wse>WindowsSpyBlocker (extra)</wse>
                    <yy>YoYo List</yy>
                </OptionValues>
            </type>
            <lists type="CSVListField">
                <Required>N</Required>
            </lists>
            <whitelists type="CSVListField">
                <Required>N</Required>
            </whitelists>
            <blocklists type="CSVListField">
                <Required>N</Required>
            </blocklists>
            <wildcards type="CSVListField">
                <Required>N</Required>
                <Mask>/^((?:(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.){1,})(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$/i</Mask>
                <ValidationMessage>A valid domain must be specified.</ValidationMessage>
                <MaskPerItem>Y</MaskPerItem>
            </wildcards>
            <address type="NetworkField">
                <Required>N</Required>
                <NetMaskAllowed>N</NetMaskAllowed>
                <AddressFamily>ipv4</AddressFamily>
            </address>
            <nxdomain type="BooleanField">
                <Required>N</Required>
                <default>0</default>
            </nxdomain>
        </dnsbl>
        <forwarding>
            <enabled type="BooleanField">
                <default>0</default>
                <Required>N</Required>
            </enabled>
        </forwarding>
        <dots>
            <dot type="ArrayField">
                <enabled type="BooleanField">
                    <Required>Y</Required>
                    <default>1</default>
                </enabled>
                <type type="OptionField">
                    <Required>Y</Required>
                    <default>dot</default>
                    <OptionValues>
                        <dot>DNS over TLS</dot>
                        <forward>Forward</forward>
                    </OptionValues>
                </type>
                <domain type="TextField">
                    <Required>N</Required>
                    <mask>/^(?:(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$/i</mask>
                    <ValidationMessage>A valid domain must be specified.</ValidationMessage>
                </domain>
                <server type="NetworkField">
                    <Required>Y</Required>
                </server>
                <port type="PortField">
                    <Required>N</Required>
                </port>
                <verify type="HostnameField">
                    <Required>N</Required>
                </verify>
            </dot>
        </dots>
        <hosts>
            <host type="ArrayField">
                <enabled type="BooleanField">
                    <default>1</default>
                    <Required>Y</Required>
                </enabled>
                <hostname type="HostnameField">
                    <Required>N</Required>
                    <HostWildcardAllowed>Y</HostWildcardAllowed>
                </hostname>
                <domain type="TextField">
                    <Required>Y</Required>
                    <mask>/^(?:(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$/i</mask>
                    <ValidationMessage>A valid domain must be specified.</ValidationMessage>
                </domain>
                <rr type="OptionField">
                    <Required>Y</Required>
                    <default>A</default>
                    <OptionValues>
                        <A>A (IPv4 address)</A>
                        <AAAA>AAAA (IPv6 address)</AAAA>
                        <MX>MX (Mail server)</MX>
                    </OptionValues>
                    <Constraints>
                        <check001>
                            <reference>mxprio.check001</reference>
                        </check001>
                        <check002>
                            <reference>mx.check001</reference>
                        </check002>
                        <check003>
                            <reference>server.check001</reference>
                        </check003>
                        <check004>
                            <reference>server.check002</reference>
                        </check004>
                    </Constraints>
                </rr>
                <mxprio type="IntegerField">
                    <Constraints>
                        <check001>
                            <ValidationMessage>The field MX Priority is required.</ValidationMessage>
                            <type>SetIfConstraint</type>
                            <field>rr</field>
                            <check>MX</check>
                        </check001>
                    </Constraints>
                </mxprio>
                <mx type="HostnameField">
                    <Constraints>
                        <check001>
                            <ValidationMessage>The field MX Host is required.</ValidationMessage>
                            <type>SetIfConstraint</type>
                            <field>rr</field>
                            <check>MX</check>
                        </check001>
                    </Constraints>
                </mx>
                <server type="NetworkField">
                    <Constraints>
                        <check001>
                            <ValidationMessage>The field IP address is required.</ValidationMessage>
                            <type>SetIfConstraint</type>
                            <field>rr</field>
                            <check>A</check>
                        </check001>
                        <check002>
                            <ValidationMessage>The field IP address is required.</ValidationMessage>
                            <type>SetIfConstraint</type>
                            <field>rr</field>
                            <check>AAAA</check>
                        </check002>
                    </Constraints>
                </server>
                <description type="TextField">
                    <Required>N</Required>
                    <mask>/^(.){1,255}$/u</mask>
                    <ValidationMessage>Description should be a string between 1 and 255 characters</ValidationMessage>
                </description>
            </host>
        </hosts>
        <aliases>
            <alias type="ArrayField">
                <enabled type="BooleanField">
                    <default>1</default>
                    <Required>Y</Required>
                </enabled>
                <host type="ModelRelationField">
                    <Model>
                        <host>
                            <source>OPNsense.Unbound.Unbound</source>
                            <items>hosts.host</items>
                            <display>hostname,domain</display>
                            <display_format>%s.%s</display_format>
                        </host>
                    </Model>
                    <Required>Y</Required>
                </host>
                <hostname type="HostnameField">
                    <Constraints>
                        <check001>
                            <ValidationMessage>The host field is required if a domain has not been specified.</ValidationMessage>
                            <type>SetIfConstraint</type>
                            <field>domain</field>
                            <check></check>
                        </check001>
                    </Constraints>
                    <HostWildcardAllowed>Y</HostWildcardAllowed>
                </hostname>
                <domain type="TextField">
                    <Constraints>
                        <check001>
                            <ValidationMessage>The domain field is required if a host has not been specified.</ValidationMessage>
                            <type>SetIfConstraint</type>
                            <field>hostname</field>
                            <check></check>
                        </check001>
                    </Constraints>
                    <mask>/^(?:(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$/i</mask>
                    <ValidationMessage>A valid domain must be specified.</ValidationMessage>
                </domain>
                <description type="TextField">
                    <Required>N</Required>
                    <mask>/^(.){1,255}$/u</mask>
                    <ValidationMessage>Description should be a string between 1 and 255 characters</ValidationMessage>
                </description>
            </alias>
        </aliases>
        <domains>
            <domain type="ArrayField">
                <enabled type="BooleanField">
                    <default>1</default>
                    <Required>Y</Required>
                </enabled>
                <domain type=".\UnboundDomainField">
                    <Required>Y</Required>
                    <ValidationMessage>A valid domain must be specified.</ValidationMessage>
                </domain>
                <server type=".\UnboundServerField">
                    <Required>Y</Required>
                    <ValidationMessage>A valid IP must be specified.</ValidationMessage>
                </server>
                <forward_tcp_upstream type="BooleanField">
                    <default>0</default>
                    <Required>Y</Required>
                </forward_tcp_upstream>
                <description type="TextField">
                    <Required>N</Required>
                    <mask>/^(.){1,255}$/u</mask>
                    <ValidationMessage>Description should be a string between 1 and 255 characters</ValidationMessage>
                </description>
            </domain>
        </domains>
    </items>
</model>
