This repository has been archived on 2024-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
dn42.nix/modules/default.nix

133 lines
3.1 KiB
Nix
Raw Normal View History

2024-03-10 23:21:55 +01:00
{ config, lib, ... }:
let
cfg = config.networking.dn42;
in
{
imports = [
./firewall.nix
2024-03-14 18:56:09 +01:00
./bird2.nix
];
2024-03-10 23:21:55 +01:00
options.networking.dn42 = {
enable = lib.mkEnableOption "Whether to enable dn42 integration.";
routerId = lib.mkOption {
type = lib.types.str;
description = "32bit router identifier.";
2024-03-11 23:04:11 +01:00
default = cfg.addr.v4;
2024-03-10 23:21:55 +01:00
};
as = lib.mkOption {
type = lib.types.int;
2024-03-11 22:32:09 +01:00
description = "Autonomous System Number";
2024-03-10 23:21:55 +01:00
};
2024-03-14 21:42:08 +01:00
geo = lib.mkOption {
type = lib.types.int;
description = "";
};
country = lib.mkOption {
type = lib.types.int;
description = "";
};
blockedAs = lib.mkOption {
type = lib.types.listOf lib.types.int;
description = "";
};
2024-03-10 23:21:55 +01:00
addr = {
v4 = lib.mkOption {
type = lib.types.str;
2024-03-11 22:32:09 +01:00
description = "Primary IPv4 address";
2024-03-10 23:21:55 +01:00
};
v6 = lib.mkOption {
type = lib.types.str;
2024-03-11 22:32:09 +01:00
description = "Primary IPv6 address";
2024-03-10 23:21:55 +01:00
};
};
nets = {
2024-03-10 23:21:55 +01:00
v4 = lib.mkOption {
type = with lib.types; listOf str;
description = "Own IPv4 networks, list of CIDR";
2024-03-10 23:21:55 +01:00
};
v6 = lib.mkOption {
type = with lib.types; listOf str;
description = "Own IPv6 networks, list of CIDR";
2024-03-10 23:21:55 +01:00
};
};
peers = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule ({ config, name, ... }: {
options = {
as = lib.mkOption {
type = lib.types.int;
2024-03-11 22:32:09 +01:00
description = "Autonomous System number of the peer.";
2024-03-10 23:21:55 +01:00
};
2024-03-12 19:56:30 +01:00
extendedNextHop = lib.mkOption {
type = lib.types.bool;
description = "If extended next-hop should be used. Creating IPv4 routes using an IPv6 next-hop address.";
default = false;
2024-03-10 23:21:55 +01:00
};
2024-03-14 21:42:08 +01:00
latency = lib.mkOption {
type = lib.types.int;
description = "";
};
bandwidth = lib.mkOption {
type = lib.types.int;
description = "";
};
crypto = lib.mkOption {
type = lib.types.int;
description = "";
};
2024-03-15 22:15:51 +01:00
transit = lib.mkOption {
type = lib.types.bool;
description = "";
};
2024-03-10 23:21:55 +01:00
addr = {
v4 = lib.mkOption {
2024-03-12 19:56:30 +01:00
type = lib.types.nullOr lib.types.str;
2024-03-10 23:21:55 +01:00
description = "IPv4 address of the peer.";
2024-03-12 19:56:30 +01:00
default = null;
2024-03-10 23:21:55 +01:00
};
v6 = lib.mkOption {
type = lib.types.str;
description = "IPv6 address of the peer.";
};
};
2024-03-12 00:20:15 +01:00
srcAddr = {
v4 = lib.mkOption {
type = with lib.types; nullOr str;
description = "Local IPv4 address to use for BGP.";
2024-03-12 19:56:30 +01:00
default = null;
2024-03-12 00:20:15 +01:00
};
v6 = lib.mkOption {
type = with lib.types; nullOr str;
description = "Local IPv6 address to use for BGP.";
};
};
2024-03-12 19:56:30 +01:00
interface = lib.mkOption {
type = lib.types.str;
description = "Interface name of the peer.";
};
2024-03-10 23:21:55 +01:00
};
}));
};
};
}