[UPDATE] Parse all supported filter patterns

For both remote and local files, parse all the filter patterns
supported by DNSCrypt. A list of supported patterns are given here:

  https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Filters#filter-patterns
This commit is contained in:
Muntashir Al-Islam 2021-07-20 17:19:35 +06:00
parent f9abbd2e44
commit 23f4f6c5bb
1 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ except (ImportError, ModuleNotFoundError):
def parse_time_restricted_list(content): def parse_time_restricted_list(content):
rx_comment = re.compile(r"^(#|$)") rx_comment = re.compile(r"^(#|$)")
rx_inline_comment = re.compile(r"\s*#\s*[a-z0-9-].*$") rx_inline_comment = re.compile(r"\s*#\s*[a-z0-9-].*$")
rx_trusted = re.compile(r"^([*a-z0-9.-]+)\s*(@\S+)?$") rx_trusted = re.compile(r"^(=?[*a-z0-9.\-\[\]\?\:]+)\s*(@\S+)?$")
rx_timed = re.compile(r".+\s*(@\S+)?$") rx_timed = re.compile(r".+\s*(@\S+)?$")
names = set() names = set()
@ -61,7 +61,7 @@ def parse_list(content, trusted=False):
rx_mdl = re.compile(r'^"[^"]+","([a-z0-9][a-z0-9.-]*[.][a-z]{2,})",') rx_mdl = re.compile(r'^"[^"]+","([a-z0-9][a-z0-9.-]*[.][a-z]{2,})",')
rx_b = re.compile(r"^([a-z0-9][a-z0-9.-]*[.][a-z]{2,}),.+,[0-9: /-]+,") rx_b = re.compile(r"^([a-z0-9][a-z0-9.-]*[.][a-z]{2,}),.+,[0-9: /-]+,")
rx_dq = re.compile(r"^address=/([a-z0-9][a-z0-9.-]*[.][a-z]{2,})/.") rx_dq = re.compile(r"^address=/([a-z0-9][a-z0-9.-]*[.][a-z]{2,})/.")
rx_trusted = re.compile(r"^([*a-z0-9.-]+)\s*(@\S+)?$") rx_trusted = re.compile(r"^(=?[*a-z0-9.\-\[\]\?\:]+)\s*(@\S+)?$")
if trusted: if trusted: