just needs reserved prefix warnings implemented

This commit is contained in:
2025-02-02 03:45:29 -05:00
parent 3a7ed5973b
commit 30355294c0
14 changed files with 643 additions and 598 deletions

View File

@@ -31,9 +31,11 @@ var (
tplDir embed.FS
tblTpl *template.Template = template.Must(template.New("").Funcs(
template.FuncMap{
"legacy4": tplClass4Iter,
"addrs": tplAddrIter,
"mask4": tplMaskIter4,
"bold": tplFmtBold,
"legacy4": tplTableLegacy4,
"mask4": tplTableMasks4,
"notes": tplTableNotes,
"prefixes": tplTablePrefixes,
},
).ParseFS(tplDir, "_tpl/*.tpl"))
)
@@ -41,9 +43,19 @@ var (
var (
// Primarily output formatting stuff in this block.
sectSepCnt = 48
sectSep1 = strings.Repeat("=", sectSepCnt)
sectSep2 = strings.Repeat("-", sectSepCnt)
sectSep3 = strings.Repeat(".", sectSepCnt)
// sectFmts contains a lookup of map[<is plain>][]string{<level 1>, <level 2>, <level 3>}
sectFmts map[bool][]string = map[bool][]string{
true: []string{
strings.Repeat("=", sectSepCnt),
strings.Repeat("-", sectSepCnt),
strings.Repeat(".", sectSepCnt),
},
false: []string{
strings.Repeat("━", sectSepCnt),
strings.Repeat("─", sectSepCnt),
strings.Repeat("╍", sectSepCnt),
},
}
// tblFmts contains a lookup of map[<is plain>]*tableFormatter.
tblFmts map[bool]*tableFormatter = map[bool]*tableFormatter{
// Plaintext/ASCII-only
@@ -101,3 +113,43 @@ var (
},
}
)
var (
// netNotes is keyed first on IP/inet family version (4/6) and then the prefix size.
netNotes map[uint8]map[uint8]string = map[uint8]map[uint8]string{
4: map[uint8]string{
32: "Host route/single host",
31: "PTP link",
30: "PTP (legacy/compatibility)",
29: "Smallest multi-host network size possible",
28: "Typical/common size for small LANs/VLANs",
27: "Typical/common size for small LANs/VLANs",
26: "Typical/common size for small LANs/VLANs",
25: "Typical/common size for large LANs/VLANs",
24: "Typical/common size for large LANs/VLANs",
22: "Typical/common size for smaller business networks",
21: "Typical/common size for larger business networks, smaller ISPs",
20: "Typical/common size for larger business networks, smaller ISPs",
19: "Typical/common size for enterprise business networks, larger ISPs",
18: "Typical/common size for enterprise business networks, larger ISPs",
17: "Typical/common size for enterprise business networks, larger ISPs",
8: "Largest IANA block allocation size possible",
0: "Entire IPv4 Internet address prefix; commonly used to indicate default route",
},
6: map[uint8]string{
128: "Host route/single host, single endpoints, and loopback (::1 explicitly)",
127: "Point-to-Point link (inter-router)",
64: "Single LAN; default prefix size for SLAAC",
60: "Some (very limited) 6rd networks",
56: "Minimum end site assignment (RFC 6177)",
48: "Typical/common assignment for larger sites",
36: "Possible future LIR \"extra-small\" allocation",
32: "\"Minimal\" LIR allocation",
28: "\"Medium\" LIR allocation",
24: "\"Large\" LIR allocation",
20: "\"Extra-large\" LIR allocation",
12: "RIR allocation from IANA",
0: "Entire IPv6 Internet address prefix; commonly used to represent default route",
},
}
)