router/unbound: allow temporary dynamic query modification
This commit is contained in:
parent
74b244ff22
commit
be14dc2b30
|
@ -638,11 +638,11 @@ def operate(id, event, qstate, qdata):
|
|||
|
||||
n2 = name.rstrip('.')
|
||||
|
||||
if NFT_TOKEN and n2.endswith(f'.{NFT_TOKEN}'):
|
||||
n3 = n2.removesuffix(f'.{NFT_TOKEN}')
|
||||
for k, v in NFT_QUERIES.items():
|
||||
if v['dynamic']:
|
||||
if n3.endswith(f'.{k}'):
|
||||
if NFT_TOKEN and n2.endswith(f'{NFT_TOKEN}'):
|
||||
if n2.endswith(f'.{NFT_TOKEN}'):
|
||||
n3 = n2.removesuffix(f'.{NFT_TOKEN}')
|
||||
for k, v in NFT_QUERIES.items():
|
||||
if v['dynamic'] and n3.endswith(f'.{k}'):
|
||||
n3 = n3.removesuffix(f'.{k}')
|
||||
qdomains = v['domains']
|
||||
if not lookup_domain(qdomains, n3):
|
||||
|
@ -655,6 +655,15 @@ def operate(id, event, qstate, qdata):
|
|||
old.append('*.' + n3)
|
||||
with open(f'/var/lib/unbound/{k}_domains.json', 'wt') as f:
|
||||
json.dump(old, f)
|
||||
elif n2.endswith(f'.tmp{NFT_TOKEN}'):
|
||||
n3 = n2.removesuffix(f'.tmp{NFT_TOKEN}')
|
||||
for k, v in NFT_QUERIES.items():
|
||||
if v['dynamic'] and n3.endswith(f'.{k}'):
|
||||
n3 = n3.removesuffix(f'.{k}')
|
||||
qdomains = v['domains']
|
||||
if not lookup_domain(qdomains, n3):
|
||||
add_split_domain(qdomains, ['*'] + n3.split('.'))
|
||||
return True
|
||||
qnames = []
|
||||
for k, v in NFT_QUERIES.items():
|
||||
if lookup_domain(v['domains'], n2):
|
||||
|
|
Loading…
Reference in a new issue