Update convert.py

Mikrotik fixes:
- Fix `failure: bad name` for tld domains like `.ua` - it should be just `ua`.
This commit is contained in:
Albert Kiskorov 2025-03-12 13:37:42 +07:00 committed by GitHub
parent 4d2d345868
commit ee3c670752
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -168,7 +168,10 @@ def mikrotik_fwd(src, out, remove={'google.com'}):
with open(f'{out}-mikrotik-fwd.lst', 'w') as file:
for name in domains:
file.write(f'/ip dns static add name={name} type=FWD address-list=allow-domains match-subdomain=yes forward-to=localhost\n')
if name.startswith('.'):
file.write(f'/ip dns static add name=*.{name[1:]} type=FWD address-list=allow-domains forward-to=localhost\n')
else:
file.write(f'/ip dns static add name={name} type=FWD address-list=allow-domains match-subdomain=yes forward-to=localhost\n')
def domains_from_file(filepath):
domains = []