1
0
Fork 0
mirror of https://github.com/NeoCloud/NeoNetwork synced 2024-05-17 11:41:45 +08:00

remove legacy reverse pointer generator since it's causing headaches

This commit is contained in:
JerryXiao 2020-12-16 15:29:12 +08:00
parent da2c3488db
commit c602e2fae5
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA
6 changed files with 70 additions and 82 deletions

View file

@ -10,19 +10,19 @@ $TTL 604800
@ IN NS NeoPDP-11.neo.
;
1.1 IN PTR NeoPDP-11.neo.
40.1 IN PTR cklvax.neo.
63.1 IN PTR NNPCC.neo.
20.1 IN PTR NeoBOX.neo.
10.1 IN PTR neostorage.neonetwork.
80.1 IN PTR NeoSystem.neo.
1.3 IN PTR pan.neo.
16.2 IN PTR caasih.neo.
127.2 IN PTR NeoRouter.neo.
1.1 IN PTR NeoPDP-11.neo.
40.1 IN PTR cklvax.neo.
63.1 IN PTR NNPCC.neo.
20.1 IN PTR NeoBOX.neo.
10.1 IN PTR neostorage.neonetwork.
80.1 IN PTR NeoSystem.neo.
1.3 IN PTR pan.neo.
16.2 IN PTR caasih.neo.
127.2 IN PTR NeoRouter.neo.
1.233 IN PTR liqingge.user-icecat.eth-ether5.cn.magicneko.neo.
1.234 IN PTR liqingge.user-icecat.eth-ether5.cn.magicneko.neo.
8.4 IN PTR koishi-v4.up-core.vtap-hentai-bb.hk.magicneko.neo.
8.4 IN PTR koishi-v4.up-core.vtap-hentai-bb.hk.magicneko.neo.
10.4 IN PTR luotianyi-v4.up.vtap-hentai-bb.hk.magicneko.neo.
15.4 IN PTR yuezhengling-v4.up.vtap-hentai-bb.jp.magicneko.neo.
@ -30,23 +30,30 @@ $TTL 604800
1.8 IN PTR librehs.neo.
2.8 IN PTR blog.librehs.neo.
; Loopback Addresses
1.255 IN PTR NeoPDP-11.neo.
4.255 IN PTR pan.neo.
18.255 IN PTR icecat-video.neo.
53.255 IN PTR root-dns.neo.
54.255 IN PTR dns.neo.
56.255 IN PTR frank-hsinchu-1.neo.
80.255 IN PTR NeoSystem.neo.
117.255 IN PTR magicneko-tw.neo.
; DELEGATED ZONES
9 IN NS ns1.jerry.neo.
12 IN NS ns1.yangfl.dn42.
NS ns2.yangfl.dn42.
7 IN NS ns1.staph.neo.
10 IN NS ns1.lantian.neo.
10 IN NS ns2.lantian.neo.
10 IN NS ns3.lantian.neo.
10 IN NS ns4.lantian.neo.
10 IN NS ns5.lantian.neo.
11 IN NS ns1.sun.dn42.
9 IN NS ns1.jerry.neo.
7 IN NS ns1.staph.neo.
10 IN NS ns1.lantian.neo.
10 IN NS ns2.lantian.neo.
10 IN NS ns3.lantian.neo.
10 IN NS ns4.lantian.neo.
10 IN NS ns5.lantian.neo.
11 IN NS ns1.sun.dn42.
; DO NOT MANUALLY EDIT THE FOLLOWING LINES
; AUTOGENERATED
; PLACEHOLDER
12 IN NS ns1.yangfl.dn42.
12 IN NS ns2.yangfl.dn42.

View file

@ -25,6 +25,11 @@ $TTL 604800
0.1.0.0.4.0.0.0.7.2.1.0.0.1.0.0.0.7.2.1.3.3.2.0 IN PTR luotianyi-v6.up.vtap-hentai-bb.hk.magicneko.neo.
5.1.0.0.4.0.0.0.7.2.1.0.0.1.0.0.0.7.2.1.3.3.2.0 IN PTR yuezhengling-v6.up.vtap-hentai-bb.jp.magicneko.neo.
; Loopback Addresses
0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.5.0.0.f.f.f.f IN PTR root-dns.neo.
0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.5.0.0.3.5.0.0 IN PTR dns.neo.
; DELEGATED ZONES
3.5.0.0 IN NS ns1.jerry.neo.

View file

@ -26,6 +26,10 @@ santost12 IN A 10.127.39.1
neko IN TXT "helloworld"
telegram IN TXT "https://t.me/NeoNetworkVPN"
root-dns IN A 10.127.255.53
root-dns IN AAAA fd10:127:ffff:53::
dns IN A 10.127.255.54
dns IN AAAA fd10:127:53:53::
; DELEGATED ZONES
jerry IN NS ns1.jerry

29
scripts/dns-generator.py Executable file
View file

@ -0,0 +1,29 @@
#!/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()

View file

@ -1,57 +0,0 @@
#!/usr/bin/env python3
import sys
from ipaddress import IPv4Address, ip_network, IPv4Network
from pathlib import Path
import toml
from rfc2317 import gen_reverse_pointers
RESOLVE_FILE = Path("dns", "db.10.127")
ROUTE_FILE = Path("route")
RFC2317_FILE = Path("dns", "rfc2317.toml")
def iter_route(route_type: str):
items = []
for f in ROUTE_FILE.iterdir():
routes = toml.loads(f.read_text())
items.extend(
(entity["name"], ip_network(route).network_address)
for route, entity in routes.items()
if entity["type"] == route_type and isinstance(ip_network(route), IPv4Network)
)
routes = []
remove = []
for item in items[::-1]:
if item[1] in routes:
remove.append(item)
else:
routes.append(item[1])
for i in remove:
items.remove(i)
return sorted(items, key=lambda item: item[1])
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()
orignal = orignal[: orignal.find("\n; AUTOGENERATED")]
records = [orignal, "; AUTOGENERATED", "", "; Loopback Addresses"]
for name, address in iter_route("loopback"):
if isinstance(address, IPv4Address):
pointer = address.reverse_pointer.replace(".127.10.in-addr.arpa", "")
records.append("%s\tIN\tPTR\t%s.neo." % (pointer, name))
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()

View file

@ -11,7 +11,7 @@ export MAX_LEN_6=64
mkdir -p generated
mkdir -p generated/dns
scripts/dns-reverse-generator.py
scripts/dns-generator.py
cp -R dns/* generated/dns
scripts/roa.py -m "$MAX_LEN_4" -M "$MAX_LEN_6" -o generated/roa46_bird2.conf