1
0

profiles/dn42-router: Automatically generate peering documentation

This commit is contained in:
2025-12-03 20:23:44 +01:00
parent b768bf6deb
commit 7403159730
2 changed files with 95 additions and 0 deletions

View File

@@ -11,6 +11,9 @@ let
bgp6Table = 2342;
in {
imports = [
./documentation.nix
];
options.profiles.clerie.dn42-router = {
enable = mkEnableOption "DN42 router base config";
@@ -93,6 +96,10 @@ in {
type = types.str;
default = "";
};
htmlDocumentation = mkOption {
type = types.str;
description = "This option is set by the module itself and contains the documentation for this router setup";
};
};
config = mkIf config.profiles.clerie.dn42-router.enable {

View File

@@ -0,0 +1,88 @@
{ config, lib, ... }:
with lib;
let
cfg = config.profiles.clerie.dn42-router;
in {
profiles.clerie.dn42-router.htmlDocumentation = ''
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>${config.networking.fqdn}</h1>
<p>This is a router in the <a href="https://wiki.dn42.us/">experimental decentralized network dn42</a>.</p>
<p>If you like to peer, please drop me an email to <a href="mailto:dn42@clerie.de">dn42@clerie.de</a>.</p>
<p>Happy peering!</p>
<h2>Router Information</h2>
<ul>
<li>ASN: <code>AS4242422574</code></li>
<li>Loopback IP: <code>${cfg.loopbackIp}</code></li>
<li>Router ID: <code>${cfg.routerId}</code></li>
</ul>
<h2>Wireguard Peers</h2>
<table>
${concatMapStringsSep "\n" (peer: ''
<tr>
<td>${peer.peerName}</td>
<td><a href="https://explorer.burble.com/#/aut-num/AS${peer.remoteAsn}">AS${peer.remoteAsn}</a></td>
<td>
<details>
<summary>Peering config</summary>
<ul>
<li>Local Endpoint: <code>${config.networking.fqdn}:???</code></li>
<li>Local Address: <code>${peer.localAddress}</code></li>
<li>Local ASN: <code>AS4242422574</code></li>
</ul>
<ul>
<li>Remote Endpoint: <code>???</code></li>
<li>Remote Address: <code>${peer.remoteAddress}</code></li>
<li>Remote ASN: <code>AS${peer.remoteAsn}</code></li>
</ul>
</details>
</td>
<td><a href="https://map.iedon.net/#${peer.remoteAsn}">[Map]</a></td>
</tr>
'') cfg.wireguardPeers}
</table>
<h2>BGP Peers</h2>
<table>
${concatMapStringsSep "\n" (peer: ''
<tr>
<td>${peer.peerName}</td>
<td>AS${peer.remoteAsn}</td>
<td>
<details>
<summary>Peering config</summary>
<ul>
<li>Local Address: <code>${peer.localAddress}</code></li>
<li>Local ASN: <code>AS4242422574</code></li>
</ul>
<ul>
<li>Remote Address: <code>${peer.remoteAddress}</code></li>
<li>Remote ASN: <code>AS${peer.remoteAsn}</code></li>
</ul>
</details>
</td>
<td><a href="https://map.iedon.net/#${peer.remoteAsn}">[Map]</a></td>
</tr>
'') cfg.bgpPeers}
</table>
</body>
</html>
'';
}