mirror of
https://github.com/NeoCloud/NeoNetwork
synced 2024-11-29 14:40:40 +08:00
29 lines
730 B
Python
Executable file
29 lines
730 B
Python
Executable file
#!/usr/bin/env python3
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import toml
|
|
from rfc2317 import gen_reverse_pointers
|
|
|
|
RESOLVE_FILE = Path("dns", "db.10.127")
|
|
RFC2317_FILE = Path("dns", "rfc2317.toml")
|
|
|
|
def iter_rfc2317_entry():
|
|
entries = toml.loads(RFC2317_FILE.read_text())
|
|
for (route, attributes) in entries.items():
|
|
ns = attributes.get('ns')
|
|
yield(route, ns)
|
|
|
|
def main():
|
|
orignal = RESOLVE_FILE.read_text()
|
|
records = [orignal, "; AUTOGENERATED"]
|
|
records.extend(("", "; rfc2317"))
|
|
for route, ns in iter_rfc2317_entry():
|
|
records.extend(gen_reverse_pointers(route, ns))
|
|
records.append("")
|
|
|
|
RESOLVE_FILE.write_text("\n".join(records))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|