ipv6
This commit is contained in:
@@ -149,6 +149,26 @@ def github_latest_release_tag(repo: str, override: str | None) -> str:
|
||||
tag = data["tag_name"]
|
||||
return tag.lstrip("v")
|
||||
|
||||
def write_resolvers_conf(ipv6_enabled: bool):
|
||||
ns_v4, ns_v6 = [], []
|
||||
try:
|
||||
for line in Path("/etc/resolv.conf").read_text().splitlines():
|
||||
line = line.strip()
|
||||
if not line.startswith("nameserver"):
|
||||
continue
|
||||
ip = line.split()[1].split("%")[0]
|
||||
(ns_v6 if ":" in ip else ns_v4).append(ip)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
ips = ns_v4 + (ns_v6 if ipv6_enabled else [])
|
||||
if not ips:
|
||||
ips = ["1.1.1.1", "8.8.8.8"] + (["2606:4700:4700::1111", "2001:4860:4860::8888"] if ipv6_enabled else [])
|
||||
|
||||
ipv6_flag = " ipv6=on" if ipv6_enabled and any(":" in x for x in ips) else ""
|
||||
content = f"resolver {' '.join(ips)} valid=10s{ipv6_flag};\n"
|
||||
write_file(Path("/etc/angie/conf.d/include/resolvers.conf"), content, 0o644)
|
||||
|
||||
def download_extract_tar_gz(url: str, dest_dir: Path) -> Path:
|
||||
dest_dir.mkdir(parents=True, exist_ok=True)
|
||||
with step("Downloading and untaring"):
|
||||
@@ -733,27 +753,7 @@ def gather_versions(npm_app_version: str):
|
||||
angie_v = run_out(["bash","-lc","angie -v 2>&1 | awk 'NR==1{print $3}'"], check=False).strip()
|
||||
node_v = run_out(["bash","-lc","node -v | sed 's/^v//'"], check=False).strip()
|
||||
yarn_v = run_out(["bash","-lc","yarn -v || yarnpkg -v"], check=False).strip()
|
||||
return ip, angie_v, node_v, yarn_v, npm_app_version
|
||||
|
||||
def write_resolvers_conf(ipv6_enabled: bool):
|
||||
ns_v4, ns_v6 = [], []
|
||||
try:
|
||||
for line in Path("/etc/resolv.conf").read_text().splitlines():
|
||||
line = line.strip()
|
||||
if not line.startswith("nameserver"):
|
||||
continue
|
||||
ip = line.split()[1].split("%")[0]
|
||||
(ns_v6 if ":" in ip else ns_v4).append(ip)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
ips = ns_v4 + (ns_v6 if ipv6_enabled else [])
|
||||
if not ips:
|
||||
ips = ["1.1.1.1", "8.8.8.8"] + (["2606:4700:4700::1111", "2001:4860:4860::8888"] if ipv6_enabled else [])
|
||||
|
||||
ipv6_flag = " ipv6=on" if ipv6_enabled and any(":" in x for x in ips) else ""
|
||||
content = f"resolver {' '.join(ips)} valid=10s{ipv6_flag};\n"
|
||||
write_file(Path("/etc/angie/conf.d/include/resolvers.conf"), content, 0o644)
|
||||
return ip, angie_v, node_v, yarn_v, npm_app_versio
|
||||
|
||||
def update_motd(enabled: bool, info, ipv6_enabled: bool):
|
||||
if not enabled:
|
||||
|
||||
Reference in New Issue
Block a user