99 lines
5.7 KiB
Python
99 lines
5.7 KiB
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""Le domaine interne d'un SITE : une etoile boreale suivie de son index.
|
||
|
|
|
||
|
|
DECISION DE DANIEL (2026-10-18). Les domaines internes des sites etaient choisis a la main
|
||
|
|
(`genese.internal`, `socle.internal`), et rien ne gardait deux sites contre le meme nom — or une
|
||
|
|
reprise fait justement se rencontrer deux sites dans un meme resolveur. Le nom se DERIVE
|
||
|
|
desormais de l'index du site, que P21 garde deja unique :
|
||
|
|
|
||
|
|
index 31 -> achird31 site-forge-01.achird31 = 10.31.33.11
|
||
|
|
index 37 -> miram37 site-forge-01.miram37 = 10.37.33.11
|
||
|
|
|
||
|
|
L'etoile se retient, l'index redonne l'adresse. Les LOCATAIRES gardent leur nom
|
||
|
|
d'organisation (`chezlepro.internal`) : la regle ne vise que les sites.
|
||
|
|
|
||
|
|
SANS `.internal`, ET SANS RISQUE DE COLLISION AVEC L'INTERNET. Le nom du site est lui-meme un
|
||
|
|
domaine de premier niveau. L'ICANN exige qu'un TLD soit fait de LETTRES seulement : un libelle
|
||
|
|
qui porte un chiffre ne sera jamais delegue a la racine. C'est aussi ce qui permet de le
|
||
|
|
reconnaitre comme prive (`est_prive`).
|
||
|
|
|
||
|
|
LA TABLE EST FIGEE. Source : IAU Catalog of Star Names (IAU-CSN, WGSN, mise a jour du
|
||
|
|
2022-04-04, CC BY). Ordre, applique UNE fois :
|
||
|
|
1. les 70 etoiles CIRCUMPOLAIRES vues de Montreal (declinaison > +44,5 deg) — elles ne se
|
||
|
|
couchent jamais, et tournent toute l'annee autour de Polaris ;
|
||
|
|
2. puis les autres etoiles BOREALES (declinaison > 0) ;
|
||
|
|
chaque groupe par eclat decroissant (magnitude, puis nom). Nom ASCII de l'UAI, en minuscules,
|
||
|
|
lettres seules (`La Superba` -> `lasuperba`).
|
||
|
|
L'entree N est celle de l'index N. NE JAMAIS RECALCULER NI REORDONNER : l'UAI ajoute des noms,
|
||
|
|
et un tri refait decalerait le domaine de chaque site. Un nom nouveau s'ajoute a la FIN.
|
||
|
|
"""
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import re
|
||
|
|
|
||
|
|
ETOILES: tuple[str, ...] = (
|
||
|
|
"capella", "deneb", "alioth", "mirfak", "dubhe", "alkaid", "menkalinan", "kochab",
|
||
|
|
"polaris", "mizar", "eltanin", "schedar", "caph", "merak", "phecda", "alderamin",
|
||
|
|
"ruchbah", "athebyne", "rastaban", "fawaris", "pherkad", "altais", "talitha",
|
||
|
|
"aldhibah", "errai", "alfirk", "edasich", "megrez", "muscida", "segin", "achird",
|
||
|
|
"nembus", "thuban", "fulu", "taiyangshou", "grumium", "miram", "misam", "giausar",
|
||
|
|
"alcor", "alkaphrah", "xuange", "kurhah", "yildun", "dziban", "castula", "alsafi",
|
||
|
|
"azelfafage", "fafnir", "adhil", "taiyi", "intercrus", "lasuperba", "tianyi", "alrakis",
|
||
|
|
"alruba", "merga", "tonatiuh", "mago", "baekdu", "aniara", "liesma", "nushagak",
|
||
|
|
"nasti", "funi", "koit", "dombay", "taika", "muspelheim", "tuiren", "arcturus", "vega",
|
||
|
|
"procyon", "betelgeuse", "altair", "aldebaran", "pollux", "regulus", "bellatrix",
|
||
|
|
"elnath", "alhena", "castor", "hamal", "alpheratz", "mirach", "rasalhague", "algol",
|
||
|
|
"almach", "denebola", "alphecca", "sadr", "izar", "enif", "scheat", "aljanah", "markab",
|
||
|
|
"menkar", "zosma", "algieba", "unukalhai", "mahasim", "muphrid", "hassaleh", "sheratan",
|
||
|
|
"tarazed", "cebalrai", "kornephoros", "algenib", "alcyone", "vindemiatrix", "tejat",
|
||
|
|
"corcaroli", "gomeisa", "matar", "tianguan", "okab", "almaaz", "seginus", "mebsuta",
|
||
|
|
"taniaaustralis", "sarin", "haedus", "tabit", "sulafat", "propus", "chertan", "alzirr",
|
||
|
|
"albireo", "rasalgethi", "meissa", "minelauva", "homam", "mothallah", "adhafera",
|
||
|
|
"taniaborealis", "alulaborealis", "ashlesha", "nekkar", "sadalbari", "biham", "subra",
|
||
|
|
"wasat", "ain", "tarf", "kaffaljidhma", "zavijava", "sheliak", "bharani", "atlas",
|
||
|
|
"rotanev", "primahyadum", "saclateni", "alshain", "electra", "chamukuy",
|
||
|
|
"secundahyadum", "praecipua", "alrescha", "marfik", "alpherg", "atik", "sualocin",
|
||
|
|
"maia", "rasalas", "nusakan", "kitalpha", "asellusaustralis", "menkib", "mekbuda",
|
||
|
|
"aldulfin", "gudja", "titawin", "merope", "chara", "alsciaukat", "acubens", "torcular",
|
||
|
|
"taygeta", "alkalurops", "alterf", "botein", "sham", "alulaaustralis", "maasym",
|
||
|
|
"alkarab", "aladfar", "anser", "minchir", "fumalsamakah", "liliiborea", "cujam", "salm",
|
||
|
|
"alya", "asellusborealis", "libertas", "mesarthim", "diadem", "jishui", "marsic",
|
||
|
|
"chalawan", "pleione", "revati", "veritate", "tegmine", "celaeno", "musica",
|
||
|
|
"helvetios", "nahn", "asterope", "piautos", "copernicus", "xihe", "meleph", "chechia",
|
||
|
|
"formosa", "kamuy", "belenos", "buna", "illyrian", "arcalis", "nikawiy",
|
||
|
|
"lucilinburhuc", "rosaliadecastro", "kaveh", "stribor", "flegetonte", "lusitania",
|
||
|
|
"nervia", "ogma", "gakyid", "citadelle", "hoggar", "mahsati", "hunor", "uruk", "irena",
|
||
|
|
"barnardsstar", "solaris", "franz", "sansuna", "gloas", "sterrennacht", "mpingo",
|
||
|
|
"moldoveanu", "tangra", "parumleo", "mazaalai", "berehynia", "chason", "absolutno",
|
||
|
|
"anadolu", "lerna", "tevel", "moriah", "morava", "pipoltr", "horna", "geminga", "lich",
|
||
|
|
)
|
||
|
|
|
||
|
|
# 70 premieres : les circumpolaires.
|
||
|
|
CIRCUMPOLAIRES = 70
|
||
|
|
|
||
|
|
|
||
|
|
def domaine_site(index: int) -> str:
|
||
|
|
"""Le domaine interne du site d'index `index` (1 a 254)."""
|
||
|
|
if not isinstance(index, int) or not 1 <= index <= 254:
|
||
|
|
raise ValueError(f"index de site hors de 1..254 : {index!r}")
|
||
|
|
return f"{ETOILES[index - 1]}{index}"
|
||
|
|
|
||
|
|
|
||
|
|
def est_prive(zone: str) -> bool:
|
||
|
|
"""Vrai si `zone` ne peut pas etre un nom de l'Internet.
|
||
|
|
|
||
|
|
Deux formes : sous `.internal` (le TLD reserve par l'ICANN, celui des locataires), ou sous
|
||
|
|
un TLD qui porte un chiffre (celui des sites, `achird31`). Les gardes qui refusent de
|
||
|
|
publier une zone privee lisent cette regle, et les roles la recopient en expression
|
||
|
|
reguliere (`(^|\\.)(internal|[a-z0-9-]*[0-9][a-z0-9-]*)\\.?$`).
|
||
|
|
"""
|
||
|
|
tld = str(zone).strip().rstrip(".").lower().rsplit(".", 1)[-1]
|
||
|
|
return tld == "internal" or bool(re.search(r"[0-9]", tld))
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
import sys
|
||
|
|
for a in sys.argv[1:] or ["31", "37"]:
|
||
|
|
print(domaine_site(int(a)))
|
||
|
|
|