@takodotid/circuit 0.43.1 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -37
- package/package.json +21 -58
- package/src/checks/across.ts +402 -0
- package/src/checks/built-in.ts +256 -0
- package/src/checks/device.ts +436 -0
- package/src/checks/index.ts +53 -0
- package/src/cli/advisories.ts +108 -0
- package/src/cli/app.ts +71 -0
- package/src/cli/editor-types.generated.ts +30 -0
- package/src/cli/editor-types.ts +69 -0
- package/src/cli/format.ts +124 -0
- package/src/cli/git-hooks.ts +79 -0
- package/src/cli/index.ts +350 -1170
- package/src/cli/migrate.ts +554 -0
- package/src/cli/project-commands.ts +656 -0
- package/src/cli/releases.ts +374 -0
- package/src/cli/remember.ts +339 -0
- package/src/cli/rename.ts +27 -33
- package/src/cli/secrets-password.ts +60 -0
- package/src/cli/secrets.ts +258 -0
- package/src/cli/setup.ts +300 -0
- package/src/cli/signing.ts +23 -0
- package/src/cli/text-editor.ts +268 -0
- package/src/cli/ui.ts +298 -0
- package/src/cli/version.ts +2 -0
- package/src/cli/versions.ts +158 -0
- package/src/config/address.ts +102 -0
- package/src/config/circuit.d.ts +30 -0
- package/src/config/common.ts +65 -0
- package/src/config/communities.ts +479 -0
- package/src/config/define.ts +684 -0
- package/src/config/device.ts +164 -0
- package/src/config/firewall.ts +150 -0
- package/src/config/index.ts +22 -0
- package/src/{schema → config}/interfaces.ts +121 -85
- package/src/config/keys.ts +434 -0
- package/src/config/management.ts +61 -0
- package/src/config/merge.ts +335 -0
- package/src/config/models.ts +70 -0
- package/src/config/monitoring.ts +64 -0
- package/src/config/network.ts +180 -0
- package/src/config/presets.ts +149 -0
- package/src/config/routing.ts +401 -0
- package/src/config/services.ts +51 -0
- package/src/config/switching.ts +84 -0
- package/src/config/system.ts +103 -0
- package/src/{schema → config}/time-zones.ts +1 -1
- package/src/core/address.ts +1 -1
- package/src/core/cabling.ts +8 -43
- package/src/core/graph.ts +40 -0
- package/src/{integrations → core}/registries.ts +5 -3
- package/src/core/secrets-file.ts +539 -0
- package/src/core/secrets.ts +83 -64
- package/src/core/topology.ts +103 -146
- package/src/core/utils.ts +12 -1
- package/src/model.ts +83 -0
- package/src/platforms/derive.ts +64 -37
- package/src/platforms/finding.ts +9 -0
- package/src/platforms/fortios/firewall.ts +76 -64
- package/src/platforms/fortios/index.ts +189 -125
- package/src/platforms/fortios/names.ts +51 -18
- package/src/platforms/fortios/render.ts +69 -62
- package/src/platforms/fortios/routing.ts +89 -58
- package/src/platforms/fortios/vdoms.ts +47 -16
- package/src/platforms/junos/TRAPS.md +2 -2
- package/src/platforms/junos/bgp.ts +63 -42
- package/src/platforms/junos/index.ts +122 -89
- package/src/platforms/junos/render.ts +139 -104
- package/src/platforms/platform.ts +10 -8
- package/src/platforms/raisecom-ros/TRAPS.md +1 -1
- package/src/platforms/raisecom-ros/index.ts +89 -70
- package/src/platforms/raisecom-ros/render.ts +49 -45
- package/src/platforms/routeros/TRAPS.md +3 -3
- package/src/platforms/routeros/index.ts +121 -60
- package/src/platforms/routeros/render.ts +214 -195
- package/src/platforms/vrp/TRAPS.md +1 -1
- package/src/platforms/vrp/index.ts +74 -50
- package/src/platforms/vrp/render.ts +67 -56
- package/src/project/project.ts +725 -0
- package/src/studio/app/env.d.ts +9 -0
- package/src/studio/app/index.html +18 -0
- package/src/studio/app/src/App.vue +95 -0
- package/src/studio/app/src/components/AddressesView.vue +38 -0
- package/src/studio/app/src/components/CablesView.vue +29 -0
- package/src/studio/app/src/components/CompareView.vue +160 -0
- package/src/studio/app/src/components/DataTable.vue +49 -0
- package/src/studio/app/src/components/DeviceView.vue +237 -0
- package/src/studio/app/src/components/DevicesView.vue +32 -0
- package/src/studio/app/src/components/Faceplate.vue +75 -0
- package/src/studio/app/src/components/GraphView.vue +282 -0
- package/src/studio/app/src/components/LineDiff.vue +24 -0
- package/src/studio/app/src/components/ProblemsView.vue +42 -0
- package/src/studio/app/src/components/SearchView.vue +72 -0
- package/src/studio/app/src/components/SecretsView.vue +112 -0
- package/src/studio/app/src/components/SessionsView.vue +35 -0
- package/src/studio/app/src/components/Settings.vue +95 -0
- package/src/studio/app/src/components/ToolsView.vue +118 -0
- package/src/studio/app/src/components/VlansView.vue +50 -0
- package/src/studio/app/src/lib/csv.ts +19 -0
- package/src/studio/{public/diff.js → app/src/lib/diff.ts} +40 -35
- package/src/studio/app/src/lib/format.ts +38 -0
- package/src/studio/app/src/lib/net.ts +68 -0
- package/src/studio/app/src/lib/secrets-crypto.ts +35 -0
- package/src/studio/app/src/lib/store.ts +71 -0
- package/src/studio/app/src/lib/tools.ts +217 -0
- package/src/studio/app/src/main.ts +9 -0
- package/src/studio/{public → app/src}/style.css +14 -4
- package/src/studio/app/tsconfig.json +17 -0
- package/src/studio/app/vite.config.ts +16 -0
- package/src/studio/assets.generated.ts +3 -0
- package/src/studio/data.ts +96 -188
- package/src/studio/git.ts +27 -43
- package/src/studio/server.ts +196 -107
- package/src/studio/types.ts +141 -0
- package/src/transport/console.ts +3 -3
- package/src/transport/ssh.ts +1 -1
- package/dist/chunks/index-3b343xva.js +0 -177
- package/dist/chunks/index-6wb41q67.js +0 -62
- package/dist/chunks/index-n7w3tg5y.js +0 -149
- package/dist/chunks/index-yzw86rc8.js +0 -921
- package/dist/chunks/new-w3zys5y4.js +0 -172
- package/dist/chunks/server-cxr9ynxc.js +0 -259
- package/dist/cli/index.js +0 -12922
- package/dist/helpers/index.js +0 -881
- package/dist/index.js +0 -28
- package/dist/types/core/address-space.d.ts +0 -62
- package/dist/types/core/address.d.ts +0 -44
- package/dist/types/core/cabling.d.ts +0 -41
- package/dist/types/core/cross-checks.d.ts +0 -28
- package/dist/types/core/define.d.ts +0 -79
- package/dist/types/core/project-files.d.ts +0 -12
- package/dist/types/core/schema-docs.d.ts +0 -25
- package/dist/types/core/secrets.d.ts +0 -62
- package/dist/types/core/topology.d.ts +0 -96
- package/dist/types/core/utils.d.ts +0 -10
- package/dist/types/core/validator.d.ts +0 -23
- package/dist/types/helpers/bgp.d.ts +0 -195
- package/dist/types/helpers/cables.d.ts +0 -69
- package/dist/types/helpers/checks.d.ts +0 -36
- package/dist/types/helpers/exchange.d.ts +0 -55
- package/dist/types/helpers/filters.d.ts +0 -51
- package/dist/types/helpers/index.d.ts +0 -14
- package/dist/types/helpers/route-server.d.ts +0 -52
- package/dist/types/helpers/upstreams.d.ts +0 -192
- package/dist/types/index.d.ts +0 -10
- package/dist/types/integrations/librenms.d.ts +0 -60
- package/dist/types/integrations/netbox.d.ts +0 -89
- package/dist/types/integrations/peeringdb.d.ts +0 -24
- package/dist/types/integrations/prometheus.d.ts +0 -24
- package/dist/types/integrations/registries.d.ts +0 -8
- package/dist/types/platforms/bgp-wait.d.ts +0 -24
- package/dist/types/platforms/catalog.d.ts +0 -109
- package/dist/types/platforms/derive.d.ts +0 -17
- package/dist/types/platforms/fortios/firewall.d.ts +0 -47
- package/dist/types/platforms/fortios/index.d.ts +0 -140
- package/dist/types/platforms/fortios/models.d.ts +0 -14
- package/dist/types/platforms/fortios/names.d.ts +0 -52
- package/dist/types/platforms/fortios/plan.d.ts +0 -114
- package/dist/types/platforms/fortios/render.d.ts +0 -77
- package/dist/types/platforms/fortios/routing.d.ts +0 -56
- package/dist/types/platforms/fortios/tree.d.ts +0 -37
- package/dist/types/platforms/fortios/vdoms.d.ts +0 -50
- package/dist/types/platforms/index.d.ts +0 -13
- package/dist/types/platforms/junos/bgp.d.ts +0 -44
- package/dist/types/platforms/junos/index.d.ts +0 -114
- package/dist/types/platforms/junos/models.d.ts +0 -14
- package/dist/types/platforms/junos/render.d.ts +0 -154
- package/dist/types/platforms/line-diff.d.ts +0 -67
- package/dist/types/platforms/platform.d.ts +0 -135
- package/dist/types/platforms/raisecom-ros/index.d.ts +0 -71
- package/dist/types/platforms/raisecom-ros/models.d.ts +0 -14
- package/dist/types/platforms/raisecom-ros/render.d.ts +0 -41
- package/dist/types/platforms/routeros/export.d.ts +0 -59
- package/dist/types/platforms/routeros/index.d.ts +0 -116
- package/dist/types/platforms/routeros/models.d.ts +0 -18
- package/dist/types/platforms/routeros/plan.d.ts +0 -58
- package/dist/types/platforms/routeros/render.d.ts +0 -250
- package/dist/types/platforms/vrp/index.d.ts +0 -83
- package/dist/types/platforms/vrp/models.d.ts +0 -12
- package/dist/types/platforms/vrp/render.d.ts +0 -96
- package/dist/types/schema/common.d.ts +0 -30
- package/dist/types/schema/device.d.ts +0 -126
- package/dist/types/schema/firewall.d.ts +0 -131
- package/dist/types/schema/index.d.ts +0 -8
- package/dist/types/schema/interfaces.d.ts +0 -205
- package/dist/types/schema/policy.d.ts +0 -107
- package/dist/types/schema/routing.d.ts +0 -161
- package/dist/types/schema/system.d.ts +0 -198
- package/dist/types/schema/time-zones.d.ts +0 -2
- package/dist/types/transport/console.d.ts +0 -115
- package/dist/types/transport/path-check.d.ts +0 -32
- package/dist/types/transport/ssh.d.ts +0 -27
- package/src/cli/graph-format.ts +0 -91
- package/src/cli/new.ts +0 -234
- package/src/core/address-space.ts +0 -320
- package/src/core/cross-checks.ts +0 -369
- package/src/core/define.ts +0 -124
- package/src/core/project-files.ts +0 -35
- package/src/core/schema-docs.ts +0 -174
- package/src/core/validator.ts +0 -508
- package/src/helpers/bgp.ts +0 -473
- package/src/helpers/cables.ts +0 -74
- package/src/helpers/checks.ts +0 -201
- package/src/helpers/exchange.ts +0 -123
- package/src/helpers/filters.ts +0 -107
- package/src/helpers/index.ts +0 -25
- package/src/helpers/route-server.ts +0 -212
- package/src/helpers/upstreams.ts +0 -369
- package/src/index.ts +0 -13
- package/src/integrations/librenms.ts +0 -291
- package/src/integrations/netbox.ts +0 -620
- package/src/integrations/peeringdb.ts +0 -173
- package/src/integrations/prometheus.ts +0 -90
- package/src/schema/common.ts +0 -41
- package/src/schema/device.ts +0 -145
- package/src/schema/firewall.ts +0 -140
- package/src/schema/index.ts +0 -8
- package/src/schema/policy.ts +0 -115
- package/src/schema/routing.ts +0 -173
- package/src/schema/system.ts +0 -203
- package/src/studio/public/app.js +0 -186
- package/src/studio/public/compare.js +0 -250
- package/src/studio/public/dom.js +0 -138
- package/src/studio/public/evaluate.js +0 -687
- package/src/studio/public/export.js +0 -130
- package/src/studio/public/graph.js +0 -1541
- package/src/studio/public/index.html +0 -83
- package/src/studio/public/net.js +0 -134
- package/src/studio/public/tables.js +0 -1289
- package/src/studio/public/tools.js +0 -610
- package/templates/colocation/checks.ts +0 -53
- package/templates/colocation/circuit.config.ts +0 -9
- package/templates/colocation/edge-01.ts +0 -133
- package/templates/colocation/routing.ts +0 -13
- package/templates/colocation/tenancy.ts +0 -76
- package/templates/colocation/tenants/acme.ts +0 -19
- package/templates/colocation/tenants/index.ts +0 -6
- package/templates/colocation/tor-01.ts +0 -33
- package/templates/edge-router/checks.ts +0 -20
- package/templates/edge-router/circuit.config.ts +0 -8
- package/templates/edge-router/edge-01.ts +0 -110
- package/templates/edge-router/routing.ts +0 -13
- package/templates/project/AGENTS.md +0 -51
- package/templates/project/CLAUDE.md +0 -1
- package/templates/project/README.md +0 -16
- package/templates/project/gitignore +0 -5
- package/templates/project/tsconfig.json +0 -13
- package/templates/single-site/checks.ts +0 -26
- package/templates/single-site/circuit.config.ts +0 -8
- package/templates/single-site/router.ts +0 -86
- package/templates/single-site/site.ts +0 -18
- package/templates/single-site/switch.ts +0 -34
- /package/src/studio/{public → app/public}/favicon.svg +0 -0
- /package/src/studio/{public → app/public}/special-gothic-latin-ext.woff2 +0 -0
- /package/src/studio/{public → app/public}/special-gothic-latin.woff2 +0 -0
- /package/src/studio/{public → app/public}/special-gothic-license.txt +0 -0
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { Device } from "../../schema/index.js";
|
|
2
|
-
/** Builds the configuration as blocks: a header line, its indented lines, then `#`. */
|
|
3
|
-
export declare class VrpRender {
|
|
4
|
-
private readonly device;
|
|
5
|
-
/** The ACL that guards every management service. */
|
|
6
|
-
private static readonly MANAGEMENT_ACL;
|
|
7
|
-
/** The ACL that guards SNMP when it has sources of its own. */
|
|
8
|
-
private static readonly SNMP_ACL;
|
|
9
|
-
/** The channel that writes the log files on the device's own storage. */
|
|
10
|
-
private static readonly LOGFILE_CHANNEL;
|
|
11
|
-
/** How many log files the device keeps when the config sets none. It is not printed. */
|
|
12
|
-
private static readonly LOGFILES_DEFAULT;
|
|
13
|
-
/** The BFD multiplier the device uses when the config sets none. It is not printed. */
|
|
14
|
-
private static readonly BFD_MULTIPLIER;
|
|
15
|
-
/** The syslog port the device uses when the config sets none. It is not printed. */
|
|
16
|
-
private static readonly SYSLOG_PORT;
|
|
17
|
-
/** A severity as the platform spells it. `debugging` is the default for a log host and for the log files, and is not printed. */
|
|
18
|
-
private static readonly LOG_LEVEL;
|
|
19
|
-
/** The OSPF process number. One process per device. */
|
|
20
|
-
private static readonly OSPF_PROCESS;
|
|
21
|
-
/** The sFlow collectors are numbered from here, in the order the config lists them. */
|
|
22
|
-
private static readonly FIRST_COLLECTOR;
|
|
23
|
-
/** The SNMPv3 group every user joins, with read access to everything. */
|
|
24
|
-
private static readonly SNMP_GROUP;
|
|
25
|
-
/** An alarm severity as the platform prints it. */
|
|
26
|
-
private static readonly ALARM_SEVERITY;
|
|
27
|
-
private static readonly USER_LEVEL;
|
|
28
|
-
private static readonly SNMP_AUTH;
|
|
29
|
-
private static readonly SNMP_PRIVACY;
|
|
30
|
-
/** Layer 2 ACLs, one for each set of ethertypes a port takes, are numbered from here. */
|
|
31
|
-
private static readonly FIRST_L2_ACL;
|
|
32
|
-
/** An ethertype as the platform prints it in a layer 2 ACL rule: `0x0800` prints as `type ip`. */
|
|
33
|
-
private static readonly ETHERTYPE;
|
|
34
|
-
private readonly lines;
|
|
35
|
-
private readonly vlans;
|
|
36
|
-
private readonly interfaces;
|
|
37
|
-
private readonly lagNumbers;
|
|
38
|
-
/** The layer 2 ACL of each set of ethertypes the ports take, by the set written as `ipv4 ipv6 arp`. */
|
|
39
|
-
private readonly ethertypeAcls;
|
|
40
|
-
private constructor();
|
|
41
|
-
/** The whole configuration the device should run. Secrets appear as markers, never values. */
|
|
42
|
-
static of(device: Device): string;
|
|
43
|
-
/** `99 999 to 1000 2000`, the platform's compression of a VLAN list. */
|
|
44
|
-
static vlanBatch(ids: number[]): string;
|
|
45
|
-
private build;
|
|
46
|
-
private line;
|
|
47
|
-
/** A header and its lines. A block with nothing in it is still written, so that its header exists. */
|
|
48
|
-
private block;
|
|
49
|
-
private separator;
|
|
50
|
-
private text;
|
|
51
|
-
private vlanId;
|
|
52
|
-
/** What the platform calls a port, a LAG or a VLAN interface. */
|
|
53
|
-
private nameOf;
|
|
54
|
-
private system;
|
|
55
|
-
private vlanBlocks;
|
|
56
|
-
/** One ACL guards every management service: a permit per source, then an explicit deny. */
|
|
57
|
-
private managementAcl;
|
|
58
|
-
/** SNMP with sources of its own gets an ACL of its own, built the same way. */
|
|
59
|
-
private ethertypeAclBlocks;
|
|
60
|
-
private snmpAcl;
|
|
61
|
-
/** A permit per source, then an explicit deny. The platform prints the wildcard of a single address as `0`. */
|
|
62
|
-
private static aclRules;
|
|
63
|
-
private users;
|
|
64
|
-
private vrfs;
|
|
65
|
-
private static lagMode;
|
|
66
|
-
/** Layer 2 membership of a port or LAG. */
|
|
67
|
-
private switching;
|
|
68
|
-
private static vrrpLines;
|
|
69
|
-
private vlanInterface;
|
|
70
|
-
/** A port the config does not declare is shut down. A LAG member holds only its membership. */
|
|
71
|
-
private physicalPort;
|
|
72
|
-
/**
|
|
73
|
-
* Static routes. A route watched by BFD needs a BFD template for its next hop first, from the device's own address on that network, with the device's timers.
|
|
74
|
-
*/
|
|
75
|
-
private staticRoutes;
|
|
76
|
-
/** The device's own IPv4 address on the network that holds `nextHop`. `unsupported()` refuses a watched route without one. */
|
|
77
|
-
static localAddressTo(device: Device, nextHop: string): string | undefined;
|
|
78
|
-
/** The BFD timers of `routing.bfd`, after `prefix`, or nothing for the platform's own. The platform does not print its default multiplier, 3. */
|
|
79
|
-
private bfdTimers;
|
|
80
|
-
/**
|
|
81
|
-
* OSPF for IPv4. An area announces the networks of its interfaces; a passive interface is silent. `unsupported()` refuses IPv6.
|
|
82
|
-
*/
|
|
83
|
-
private ospf;
|
|
84
|
-
private wantsBfd;
|
|
85
|
-
/** sFlow from the management address, to each collector in order. */
|
|
86
|
-
private flowExport;
|
|
87
|
-
/** The log files' level and count, then each syslog collector. A default the device does not print is not written: level `debugging`, 200 files, port 514. */
|
|
88
|
-
private logging;
|
|
89
|
-
/** Alarms raised at another severity than the platform's own, in the `alarm` view. The platform prints a severity with a capital, `Warning`. */
|
|
90
|
-
private alarms;
|
|
91
|
-
/** SNMP version 2c with one read community, version 3 with users in one read-only group, or both. */
|
|
92
|
-
private snmp;
|
|
93
|
-
private ssh;
|
|
94
|
-
/** The console logs in with the device's users unless the config gives it a password of its own. Remote logins always use the users. */
|
|
95
|
-
private userInterfaces;
|
|
96
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A value kept out of the repository and resolved only when a device is applied.
|
|
3
|
-
*
|
|
4
|
-
* `secret("NAME")` reads a variable from the environment or `.env` beside the config; a value written as `op://vault/item/field` is read from 1Password. `secretFile("path")` reads a file, relative to the config file, for a value that spans lines such as a private key in PEM. Keep that file out of git.
|
|
5
|
-
*/
|
|
6
|
-
export type Secret = {
|
|
7
|
-
/** Name of the value in the environment or in `.env`. */
|
|
8
|
-
readonly secret: string;
|
|
9
|
-
} | {
|
|
10
|
-
/** Path of the file with the value, relative to the config file. */
|
|
11
|
-
readonly secret_file: string;
|
|
12
|
-
};
|
|
13
|
-
/** An IPv4 address, four numbers with dots between them, for example `10.0.0.1`. The type checks the shape; `circuit validate` checks each number is 0 to 255. */
|
|
14
|
-
export type IPv4 = `${number}.${number}.${number}.${number}`;
|
|
15
|
-
/** An IPv6 address, groups with colons between them, for example `2001:db8::1`. The type only checks there is a colon; `circuit validate` checks the rest. */
|
|
16
|
-
export type IPv6 = `${string}:${string}`;
|
|
17
|
-
/** An address without a length, IPv4 or IPv6, for example `10.0.0.1` or `2001:db8::1`. */
|
|
18
|
-
export type IP = IPv4 | IPv6;
|
|
19
|
-
/** A network with its length, for example `10.0.0.0/24` or `2001:db8::/32`. */
|
|
20
|
-
export type Prefix = `${IP}/${number}`;
|
|
21
|
-
/** An interface address with its length, for example `10.0.0.1/24` or `2001:db8::1/64`. */
|
|
22
|
-
export type InterfaceAddress = `${IP}/${number}`;
|
|
23
|
-
/** A MAC address, six pairs of hex digits with colons between them, for example `02:00:00:00:00:01`. */
|
|
24
|
-
export type MacAddress = `${string}:${string}:${string}:${string}:${string}:${string}`;
|
|
25
|
-
/** An address family. */
|
|
26
|
-
export type Family = "ipv4" | "ipv6";
|
|
27
|
-
/** Bits per second, for example `2G`, `500M` or `64k`. */
|
|
28
|
-
export type Rate = `${number}${"k" | "M" | "G"}`;
|
|
29
|
-
/** A log severity, most severe first. A threshold includes everything above it. */
|
|
30
|
-
export type Severity = "emergency" | "alert" | "critical" | "error" | "warning" | "notice" | "info" | "debug";
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import type { IP, Secret } from "./common.js";
|
|
2
|
-
import type { AclRule, Firewall } from "./firewall.js";
|
|
3
|
-
import type { Interface, Port, Vlan } from "./interfaces.js";
|
|
4
|
-
import type { PrefixSet, RoutePolicy } from "./policy.js";
|
|
5
|
-
import type { Routing, StaticRoute } from "./routing.js";
|
|
6
|
-
import type { Certificate, DhcpRelay, DhcpServer, FlowExport, Management, System, User } from "./system.js";
|
|
7
|
-
/** How the framework reaches the device. */
|
|
8
|
-
export type Connection<U extends string> = {
|
|
9
|
-
/** Management address. Absent for a device reached only through its console, `console`. */
|
|
10
|
-
host?: IP;
|
|
11
|
-
/** One of the device's `users`. Its password is the login. */
|
|
12
|
-
user: U;
|
|
13
|
-
/** SSH port. 22 when absent. */
|
|
14
|
-
port?: number;
|
|
15
|
-
/** The device's serial console, for `--console`: the way in before the device has a management address, or when its management network is down. */
|
|
16
|
-
console?: Console;
|
|
17
|
-
};
|
|
18
|
-
/** A computer with SSH that holds the serial consoles of devices, such as a laptop beside the rack. It runs Python 3. */
|
|
19
|
-
export type Jump = {
|
|
20
|
-
/** Its address or name. */
|
|
21
|
-
host: string;
|
|
22
|
-
/** The user Circuit logs in as. It must be allowed to open the serial ports. */
|
|
23
|
-
user: string;
|
|
24
|
-
/** The user's password. */
|
|
25
|
-
password: Secret;
|
|
26
|
-
/** SSH port. 22 when absent. */
|
|
27
|
-
port?: number;
|
|
28
|
-
/** The jump host is reached through a Cloudflare Tunnel, so Circuit connects with `cloudflared access ssh`, which must be installed. */
|
|
29
|
-
cloudflared?: true;
|
|
30
|
-
};
|
|
31
|
-
/** A serial console, on a jump host or on the computer Circuit runs on. */
|
|
32
|
-
export type Console = {
|
|
33
|
-
/** The jump host the console cable is plugged into. When absent, the cable is plugged into the computer Circuit runs on. */
|
|
34
|
-
jump?: Jump;
|
|
35
|
-
/** The serial port: on Linux or macOS a path under `/dev`, where a path under `/dev/serial/by-path/` stays the same when two adapters swap names; on Windows a COM port, such as `COM3`. */
|
|
36
|
-
port: string;
|
|
37
|
-
/** Line speed in bits per second, such as 9600 or 115200. */
|
|
38
|
-
baud: number;
|
|
39
|
-
/** The console asks only for a password, with no name first. Circuit then types no name; `connection.user` still picks the password. */
|
|
40
|
-
passwordOnly?: true;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Virtual domains, on FortiOS: the device's own traffic kept apart from the traffic it routes. Everything is in `root` when absent.
|
|
44
|
-
*
|
|
45
|
-
* Multi-VDOM mode is turned on by hand, not by a plan: it moves the whole configuration into `root` and ends every session.
|
|
46
|
-
*/
|
|
47
|
-
export type Vdoms<I extends string> = {
|
|
48
|
-
/**
|
|
49
|
-
* A VDOM for the device's own traffic: FortiGuard, NTP, DNS and logging leave from it, by its own routes, so they never follow the routed traffic's default route. Everything not listed here stays in `root`.
|
|
50
|
-
*/
|
|
51
|
-
management: {
|
|
52
|
-
/** Its name, such as `mgmt`. Not `root`. */
|
|
53
|
-
name: string;
|
|
54
|
-
/** The ports and interfaces in it, by name. A LAG's member ports go with the LAG. */
|
|
55
|
-
interfaces: readonly I[];
|
|
56
|
-
/** Its static routes, such as its own default route. */
|
|
57
|
-
static?: readonly StaticRoute<I, never>[];
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
/** A separate routing table, with the interfaces that route in it. */
|
|
61
|
-
export type Vrf = {
|
|
62
|
-
/** What the VRF is for. */
|
|
63
|
-
description?: string;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Everything one device runs. What is not written here is removed from the device or returned to its default.
|
|
67
|
-
*
|
|
68
|
-
* Type parameters are the names the device declares, so a reference to a name that does not exist fails to compile: N ports, V VLANs, I interfaces, P policies, S prefix sets, G BGP groups, A ACLs, AS address sets, U users, F VRFs, C certificates, T routing tables.
|
|
69
|
-
*/
|
|
70
|
-
export type Device<Pl extends string = string, M extends string = string, N extends string = string, V extends string = string, I extends string = string, P extends string = string, S extends string = string, G extends string = string, A extends string = string, AS extends string = string, U extends string = string, F extends string = string, C extends string = string, T extends string = string> = {
|
|
71
|
-
/** Hostname. */
|
|
72
|
-
name: string;
|
|
73
|
-
/** Operating system. It decides which adapter renders and applies the device. */
|
|
74
|
-
platform: Pl;
|
|
75
|
-
/** Hardware model. Decides which port names exist. */
|
|
76
|
-
model: M;
|
|
77
|
-
/** How the framework logs in. */
|
|
78
|
-
connection: Connection<NoInfer<U>>;
|
|
79
|
-
/** Device-wide settings. */
|
|
80
|
-
system?: System;
|
|
81
|
-
/** Logins, keyed by user name. Users not listed are removed. */
|
|
82
|
-
users?: Record<U, User>;
|
|
83
|
-
/** Ways in, and who may use them. */
|
|
84
|
-
management?: Management<NoInfer<I | N>, NoInfer<C>>;
|
|
85
|
-
/** Certificates, keyed by name. */
|
|
86
|
-
certificates?: Record<C, Certificate>;
|
|
87
|
-
/** VLANs, keyed by name. */
|
|
88
|
-
vlans?: Record<V, Vlan>;
|
|
89
|
-
/** Physical ports, keyed by `<speed>-<position>`. */
|
|
90
|
-
ports?: Partial<Record<N, Port<NoInfer<V>, NoInfer<A>, NoInfer<I>, NoInfer<F>>>>;
|
|
91
|
-
/** Interfaces that are not physical ports, keyed by name. */
|
|
92
|
-
interfaces?: Record<I, Interface<NoInfer<V>, NoInfer<F>>>;
|
|
93
|
-
/** Separate routing tables, keyed by name. */
|
|
94
|
-
vrfs?: Record<F, Vrf>;
|
|
95
|
-
/** Routing tables and rules, static routes, BGP, OSPF and route validation. */
|
|
96
|
-
routing?: Routing<NoInfer<P>, G, NoInfer<I | N>, NoInfer<F>, T>;
|
|
97
|
-
/** Route policies, keyed by name. */
|
|
98
|
-
policies?: Record<P, RoutePolicy<NoInfer<P>, NoInfer<S>>>;
|
|
99
|
-
/** Prefix sets that policies match on, keyed by name. */
|
|
100
|
-
prefix_sets?: Record<S, PrefixSet>;
|
|
101
|
-
/** Packet filtering and address translation. */
|
|
102
|
-
firewall?: Firewall<NoInfer<I | N>, AS>;
|
|
103
|
-
/** Hardware ACLs, keyed by name, applied to a port with `acl`. */
|
|
104
|
-
acls?: Record<A, readonly AclRule<NoInfer<V>>[]>;
|
|
105
|
-
/** DHCP servers, keyed by name. */
|
|
106
|
-
dhcp?: Record<string, DhcpServer<NoInfer<I | N>>>;
|
|
107
|
-
/** DHCP relays, keyed by name. */
|
|
108
|
-
dhcp_relay?: Record<string, DhcpRelay<NoInfer<I | N>>>;
|
|
109
|
-
/** Flow records or packet samples sent to collectors. */
|
|
110
|
-
flow_export?: FlowExport<NoInfer<I | N>>;
|
|
111
|
-
/** Advertise and learn neighbors with LLDP on every port, or only on the interfaces listed. A port may override it. */
|
|
112
|
-
lldp?: true | {
|
|
113
|
-
interfaces: readonly NoInfer<I | N>[];
|
|
114
|
-
};
|
|
115
|
-
/** Spanning tree on every switched port. A port may override it. */
|
|
116
|
-
stp?: {
|
|
117
|
-
/** Which variant runs. RSTP when absent. */
|
|
118
|
-
mode?: "stp" | "rstp" | "mstp";
|
|
119
|
-
/** Bridge priority, 0 to 61440 in steps of 4096. Lower wins the root election. */
|
|
120
|
-
priority?: number;
|
|
121
|
-
};
|
|
122
|
-
/** Forward in hardware where the platform can. An interface may override it. */
|
|
123
|
-
hardware_offload?: boolean;
|
|
124
|
-
/** Virtual domains, on FortiOS only: a management VDOM apart from the routed traffic. */
|
|
125
|
-
vdoms?: Vdoms<NoInfer<I | N>>;
|
|
126
|
-
};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import type { Family, IP, Prefix, Rate } from "./common.js";
|
|
2
|
-
/** An IP protocol. `icmp` means ICMPv6 in an IPv6 rule. */
|
|
3
|
-
export type Protocol = "tcp" | "udp" | "icmp" | "gre" | "esp" | "ah" | "ospf" | "vrrp";
|
|
4
|
-
/** The state connection tracking assigns a packet. */
|
|
5
|
-
export type ConnectionState = "new" | "established" | "related" | "untracked" | "invalid";
|
|
6
|
-
/** Ports from `min` to `max`, both included. */
|
|
7
|
-
export type PortRange = {
|
|
8
|
-
min: number;
|
|
9
|
-
max: number;
|
|
10
|
-
};
|
|
11
|
-
/** A port, a range of ports, or any of several. */
|
|
12
|
-
export type Ports = number | PortRange | readonly (number | PortRange)[];
|
|
13
|
-
/** A TCP header flag. */
|
|
14
|
-
export type TcpFlag = "fin" | "syn" | "rst" | "psh" | "ack" | "urg";
|
|
15
|
-
/** Conditions on a packet. All must be true. A rule with addresses of one family applies to that family only. */
|
|
16
|
-
export type FilterMatch<I extends string, AS extends string> = {
|
|
17
|
-
/** Only packets of this family. */
|
|
18
|
-
family?: Family;
|
|
19
|
-
/** IP protocol. */
|
|
20
|
-
protocol?: Protocol;
|
|
21
|
-
/** Source address or prefix. */
|
|
22
|
-
src?: Prefix;
|
|
23
|
-
/** Destination address or prefix. */
|
|
24
|
-
dst?: Prefix;
|
|
25
|
-
/** Source is in this address set. */
|
|
26
|
-
src_set?: AS;
|
|
27
|
-
/** Destination is in this address set. */
|
|
28
|
-
dst_set?: AS;
|
|
29
|
-
/** Source port, or any of several. TCP and UDP only. */
|
|
30
|
-
src_port?: Ports;
|
|
31
|
-
/** Destination port, or any of several. TCP and UDP only. */
|
|
32
|
-
dst_port?: Ports;
|
|
33
|
-
/** Arrived on this interface. */
|
|
34
|
-
in_interface?: I;
|
|
35
|
-
/** Leaves through this interface. */
|
|
36
|
-
out_interface?: I;
|
|
37
|
-
/** Connection tracking state, any of these. */
|
|
38
|
-
state?: readonly ConnectionState[];
|
|
39
|
-
/** TCP flags that must be set, and flags that must not be. */
|
|
40
|
-
tcp_flags?: {
|
|
41
|
-
set?: readonly TcpFlag[];
|
|
42
|
-
unset?: readonly TcpFlag[];
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
/** One firewall rule. */
|
|
46
|
-
export type FilterRule<I extends string, AS extends string> = {
|
|
47
|
-
/** Shown beside the rule on the device. */
|
|
48
|
-
description?: string;
|
|
49
|
-
/** Which packets the rule applies to. Every packet when absent. */
|
|
50
|
-
match?: FilterMatch<I, AS>;
|
|
51
|
-
/** What happens to a matching packet. `reject` answers the sender, `drop` does not. */
|
|
52
|
-
action: "accept" | "drop" | "reject";
|
|
53
|
-
/** Send the rest of an accepted flow through the fast path, skipping the remaining rules. */
|
|
54
|
-
offload?: true;
|
|
55
|
-
};
|
|
56
|
-
/** Rules evaluated in order, first match wins, then `default`. */
|
|
57
|
-
export type Chain<I extends string, AS extends string> = {
|
|
58
|
-
/** What happens to a packet no rule matched. Accept when absent. */
|
|
59
|
-
default?: "accept" | "drop";
|
|
60
|
-
/** Evaluated in order. */
|
|
61
|
-
rules?: readonly FilterRule<I, AS>[];
|
|
62
|
-
};
|
|
63
|
-
/** One address translation. */
|
|
64
|
-
export type NatRule<I extends string, AS extends string> = {
|
|
65
|
-
/** Shown beside the rule on the device. */
|
|
66
|
-
description?: string;
|
|
67
|
-
/** Which packets are translated. Every packet when absent. */
|
|
68
|
-
match?: FilterMatch<I, AS>;
|
|
69
|
-
} & ({
|
|
70
|
-
/** Use the address of the outgoing interface. */
|
|
71
|
-
action: "masquerade";
|
|
72
|
-
} | {
|
|
73
|
-
/** `snat` rewrites the source, `dnat` the destination. */
|
|
74
|
-
action: "snat" | "dnat";
|
|
75
|
-
/** The address to rewrite to. */
|
|
76
|
-
to: IP;
|
|
77
|
-
/** The port to rewrite to. Unchanged when absent. */
|
|
78
|
-
to_port?: number;
|
|
79
|
-
});
|
|
80
|
-
/** Connection-tracking helpers that rewrite application payloads. None run unless listed. */
|
|
81
|
-
export type Helper = "ftp" | "tftp" | "sip" | "h323" | "pptp" | "rtsp" | "irc";
|
|
82
|
-
/** What the device filters and translates. */
|
|
83
|
-
export type Firewall<I extends string, AS extends string> = {
|
|
84
|
-
/** Named groups of addresses and prefixes, of either family, that rules match on. */
|
|
85
|
-
address_sets?: Record<AS, readonly (IP | Prefix)[]>;
|
|
86
|
-
/** Traffic to the device, through it, and from it. */
|
|
87
|
-
filter?: {
|
|
88
|
-
input?: Chain<I, NoInfer<AS>>;
|
|
89
|
-
forward?: Chain<I, NoInfer<AS>>;
|
|
90
|
-
output?: Chain<I, NoInfer<AS>>;
|
|
91
|
-
};
|
|
92
|
-
/** Source translation on the way out, destination translation on the way in. */
|
|
93
|
-
nat?: {
|
|
94
|
-
source?: readonly NatRule<I, NoInfer<AS>>[];
|
|
95
|
-
destination?: readonly NatRule<I, NoInfer<AS>>[];
|
|
96
|
-
};
|
|
97
|
-
/** Helpers that run. None when absent. */
|
|
98
|
-
helpers?: readonly Helper[];
|
|
99
|
-
/**
|
|
100
|
-
* Traffic to and from these prefixes passes without connection tracking. A flood toward them cannot fill the connection table, and rules see its packets in the state `untracked`. Everything is tracked when absent.
|
|
101
|
-
*
|
|
102
|
-
* Each address NAT uses inside one of these prefixes (a source translation's `to`, a destination translation's `to` or matched `dst`) stays tracked: Circuit writes two accept rules for it, one for traffic to it and one for traffic from it, before the untracked rules. Without them, a reply to that address would skip tracking and never be translated back.
|
|
103
|
-
*/
|
|
104
|
-
untracked?: readonly Prefix[];
|
|
105
|
-
};
|
|
106
|
-
/** A stateless rule evaluated in hardware where traffic arrives, before routing. */
|
|
107
|
-
export type AclRule<V extends string> = {
|
|
108
|
-
/** Shown beside the rule on the device. */
|
|
109
|
-
description?: string;
|
|
110
|
-
/** Which packets the rule applies to. Every packet when absent. */
|
|
111
|
-
match?: {
|
|
112
|
-
/** Only packets of this family. */
|
|
113
|
-
family?: Family;
|
|
114
|
-
/** IP protocol. */
|
|
115
|
-
protocol?: Protocol;
|
|
116
|
-
/** Source prefix. */
|
|
117
|
-
src?: Prefix;
|
|
118
|
-
/** Destination prefix. */
|
|
119
|
-
dst?: Prefix;
|
|
120
|
-
/** Source port, or any of several. */
|
|
121
|
-
src_port?: Ports;
|
|
122
|
-
/** Destination port, or any of several. */
|
|
123
|
-
dst_port?: Ports;
|
|
124
|
-
/** In this VLAN. */
|
|
125
|
-
vlan?: V;
|
|
126
|
-
};
|
|
127
|
-
/** What happens to a matching packet. */
|
|
128
|
-
action: "accept" | "drop";
|
|
129
|
-
/** Accepted traffic above this rate is dropped. On RouterOS it did not limit traffic the CPU routes; see its TRAPS.md. */
|
|
130
|
-
rate?: Rate;
|
|
131
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type * from "./common.js";
|
|
2
|
-
export type * from "./device.js";
|
|
3
|
-
export type * from "./firewall.js";
|
|
4
|
-
export type * from "./interfaces.js";
|
|
5
|
-
export type * from "./policy.js";
|
|
6
|
-
export type * from "./routing.js";
|
|
7
|
-
export type * from "./system.js";
|
|
8
|
-
export type * from "./time-zones.js";
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import type { InterfaceAddress, IP, MacAddress, Prefix, Secret } from "./common.js";
|
|
2
|
-
/** A VLAN. Its key in `vlans` is its name. */
|
|
3
|
-
export type Vlan = {
|
|
4
|
-
/** The VLAN's number on the wire, 1 to 4094. */
|
|
5
|
-
id: number;
|
|
6
|
-
/** What the VLAN is for. */
|
|
7
|
-
description?: string;
|
|
8
|
-
};
|
|
9
|
-
/** A storm-control threshold: packets per second, or percent of the link's speed. */
|
|
10
|
-
export type Threshold = {
|
|
11
|
-
pps: number;
|
|
12
|
-
} | {
|
|
13
|
-
percent: number;
|
|
14
|
-
};
|
|
15
|
-
/** A kind of frame, by the ethertype in its header: `ipv4` is 0x0800, `ipv6` 0x86DD, `arp` 0x0806. */
|
|
16
|
-
export type Ethertype = "ipv4" | "ipv6" | "arp";
|
|
17
|
-
/** A virtual router address shared with other devices on the same segment, RFC 5798. */
|
|
18
|
-
export type Vrrp = {
|
|
19
|
-
/** Virtual router number, 1 to 255. The same on every device sharing the address. */
|
|
20
|
-
id: number;
|
|
21
|
-
/** The shared address, without a length. */
|
|
22
|
-
address: IP;
|
|
23
|
-
/** Higher wins the master election, 1 to 254. 100 when absent. */
|
|
24
|
-
priority?: number;
|
|
25
|
-
/** Take mastership back from a lower priority device when this one returns. Off when absent. */
|
|
26
|
-
preempt?: boolean;
|
|
27
|
-
/** Seconds between advertisements. 1 when absent. */
|
|
28
|
-
interval?: number;
|
|
29
|
-
};
|
|
30
|
-
/** Layer 3 settings shared by every interface that can have an address. */
|
|
31
|
-
export type Routed<F extends string> = {
|
|
32
|
-
/** Addresses with their length. Use `{ address, peer }` for a point-to-point address whose far end is outside its own prefix. */
|
|
33
|
-
addresses?: readonly (InterfaceAddress | {
|
|
34
|
-
address: InterfaceAddress;
|
|
35
|
-
peer: IP;
|
|
36
|
-
})[];
|
|
37
|
-
/** Send IPv6 router advertisements on this interface. Off when absent. */
|
|
38
|
-
ipv6_ra?: boolean;
|
|
39
|
-
/** Overrides the device's `hardware_offload` for traffic routed through this interface. Software forwarding is what makes the firewall apply. */
|
|
40
|
-
hardware_offload?: boolean;
|
|
41
|
-
/** Virtual router addresses on this interface. */
|
|
42
|
-
vrrp?: readonly Vrrp[];
|
|
43
|
-
/** The VRF this interface routes in. The default table when absent. */
|
|
44
|
-
vrf?: F;
|
|
45
|
-
/** This interface is the network's presence at an internet exchange. Devices ignore it; `circuit peeringdb` publishes it. */
|
|
46
|
-
exchange?: Exchange;
|
|
47
|
-
};
|
|
48
|
-
/** Presence at an internet exchange, as a registry lists it. The addresses are the interface's own. */
|
|
49
|
-
export type Exchange = {
|
|
50
|
-
/** The exchange's name, for output. */
|
|
51
|
-
name: string;
|
|
52
|
-
/** Capacity toward the exchange, in Mbit/s. */
|
|
53
|
-
speed: number;
|
|
54
|
-
/** The exchange LAN's id at PeeringDB, its `ixlan_id`. */
|
|
55
|
-
peeringdb_ixlan?: number;
|
|
56
|
-
};
|
|
57
|
-
/** Spanning tree settings for one port. */
|
|
58
|
-
export type PortStp = {
|
|
59
|
-
/** The port faces a host, never a switch, so it forwards at once. */
|
|
60
|
-
edge?: boolean;
|
|
61
|
-
/** Path cost. Lower is preferred. Derived from speed when absent. */
|
|
62
|
-
cost?: number;
|
|
63
|
-
/** Port priority, 0 to 240 in steps of 16. Lower is preferred. */
|
|
64
|
-
priority?: number;
|
|
65
|
-
};
|
|
66
|
-
/** Layer 2 membership. A port or LAG with none of these is routed. */
|
|
67
|
-
export type Switched<V extends string> = {
|
|
68
|
-
/** The one VLAN this port or LAG is in, untagged. */
|
|
69
|
-
access_vlan?: V;
|
|
70
|
-
/** The VLANs this port or LAG carries, tagged. */
|
|
71
|
-
trunk_vlans?: readonly V[];
|
|
72
|
-
/** Untagged frames on a trunk are in this VLAN. Only with `trunk_vlans`. */
|
|
73
|
-
native_vlan?: V;
|
|
74
|
-
/** Overrides the device's `stp` for this port. `false` stops it sending or acting on BPDUs. */
|
|
75
|
-
stp?: boolean | PortStp;
|
|
76
|
-
/** Drop flooded traffic above these thresholds. */
|
|
77
|
-
storm_control?: {
|
|
78
|
-
broadcast?: Threshold;
|
|
79
|
-
multicast?: Threshold;
|
|
80
|
-
unknown_unicast?: Threshold;
|
|
81
|
-
};
|
|
82
|
-
/** The most MAC addresses this port or LAG learns, 1 or more. Frames from any other source address are dropped. An exchange sets 1 on a member port, so each member sends from one router only. No limit when absent. */
|
|
83
|
-
mac_limit?: number;
|
|
84
|
-
/** The only kinds of frame this port or LAG takes in; any other kind is dropped. An exchange takes `ipv4`, `ipv6` and `arp` on a member port. Every kind when absent. */
|
|
85
|
-
ethertypes?: readonly Ethertype[];
|
|
86
|
-
};
|
|
87
|
-
/** The other end of a cable: another device and its port. Both ends must agree on how they are switched. */
|
|
88
|
-
export type Link = {
|
|
89
|
-
/** Name of the device at the other end. */
|
|
90
|
-
device: string;
|
|
91
|
-
/** The port on that device. */
|
|
92
|
-
port: string;
|
|
93
|
-
/**
|
|
94
|
-
* What is between the two ends when the cable is not direct, such as a carrier's local loop or L2 transport: `"Carrier A local loop"`. LLDP then sees the carrier's switches, not the far end, so `validate` does not compare LLDP on this port. Both ends name the same carrier.
|
|
95
|
-
*/
|
|
96
|
-
through?: string;
|
|
97
|
-
};
|
|
98
|
-
/** A physical port. Ports a device does not declare are shut down. */
|
|
99
|
-
export type Port<V extends string, A extends string, L extends string, F extends string> = Routed<F> & Switched<V> & {
|
|
100
|
-
/** What is plugged in. */
|
|
101
|
-
description?: string;
|
|
102
|
-
/** Largest IP packet, in bytes. 1500 when absent. */
|
|
103
|
-
mtu?: number;
|
|
104
|
-
/** Fixed speed, for an optic slower than the cage. Negotiated when absent. */
|
|
105
|
-
speed?: "100m" | "1g" | "10g" | "25g" | "40g" | "50g" | "100g";
|
|
106
|
-
/** Overrides the device's `lldp` for this port. */
|
|
107
|
-
lldp?: boolean;
|
|
108
|
-
/** Hardware ACL applied to traffic arriving on this port. */
|
|
109
|
-
acl?: A;
|
|
110
|
-
/** The LAG this port is in. Every other setting goes on the LAG. */
|
|
111
|
-
lag?: L;
|
|
112
|
-
/** Another of our devices at the other end of the cable. */
|
|
113
|
-
link?: Link;
|
|
114
|
-
};
|
|
115
|
-
/** Settings every interface that is not a physical port shares. */
|
|
116
|
-
type Base<F extends string> = Routed<F> & {
|
|
117
|
-
/** What the interface is for. */
|
|
118
|
-
description?: string;
|
|
119
|
-
/** Largest IP packet, in bytes. */
|
|
120
|
-
mtu?: number;
|
|
121
|
-
};
|
|
122
|
-
/** A layer 3 interface on a VLAN. */
|
|
123
|
-
export type VlanInterface<V extends string, F extends string> = Base<F> & {
|
|
124
|
-
type: "vlan";
|
|
125
|
-
/** The VLAN it is on. */
|
|
126
|
-
vlan: V;
|
|
127
|
-
/**
|
|
128
|
-
* A MAC address of its own, instead of the one it shares with the device's other VLAN interfaces. A gateway in front of a transparent firewall needs one: frames to it come back on another VLAN, where the bridge would otherwise take a shared MAC for its own and keep them.
|
|
129
|
-
*/
|
|
130
|
-
mac?: MacAddress;
|
|
131
|
-
};
|
|
132
|
-
/** An interface that is always up and is on no link, for addresses that must not depend on one. */
|
|
133
|
-
export type Loopback<F extends string> = Base<F> & {
|
|
134
|
-
type: "loopback";
|
|
135
|
-
};
|
|
136
|
-
/** A link aggregation. Each member port points to it with `lag`. */
|
|
137
|
-
export type Lag<V extends string, F extends string> = Base<F> & Switched<V> & {
|
|
138
|
-
type: "lag";
|
|
139
|
-
/** LACP negotiates membership with the far end; `static` joins the ports without asking. LACP when absent. */
|
|
140
|
-
mode?: "lacp" | "static";
|
|
141
|
-
/** Number, on platforms where a LAG has a number instead of a name. Its position among the device's LAGs when absent. */
|
|
142
|
-
id?: number;
|
|
143
|
-
};
|
|
144
|
-
/** A GRE tunnel. */
|
|
145
|
-
export type Gre<F extends string> = Base<F> & {
|
|
146
|
-
type: "gre";
|
|
147
|
-
/** Our tunnel endpoint. */
|
|
148
|
-
local: IP;
|
|
149
|
-
/** The far tunnel endpoint. */
|
|
150
|
-
remote: IP;
|
|
151
|
-
};
|
|
152
|
-
/** A point-to-point VXLAN tunnel. */
|
|
153
|
-
export type Vxlan<F extends string> = Base<F> & {
|
|
154
|
-
type: "vxlan";
|
|
155
|
-
/** Segment identifier, the same on both ends. */
|
|
156
|
-
vni: number;
|
|
157
|
-
/** Our tunnel endpoint. */
|
|
158
|
-
local: IP;
|
|
159
|
-
/** The far tunnel endpoint. */
|
|
160
|
-
remote: IP;
|
|
161
|
-
/** UDP port. 4789 when absent. */
|
|
162
|
-
port?: number;
|
|
163
|
-
/** Fixed MAC address, so a rebuild keeps the one the far side learned. */
|
|
164
|
-
mac?: MacAddress;
|
|
165
|
-
};
|
|
166
|
-
/** A host and a UDP port, `host:port`, for example `203.0.113.10:51820` or `vpn.example.net:51820`. */
|
|
167
|
-
export type Endpoint = `${string}:${number}`;
|
|
168
|
-
/** One peer of a WireGuard interface. */
|
|
169
|
-
export type WireGuardPeer = {
|
|
170
|
-
/** Who or what the peer is. */
|
|
171
|
-
name: string;
|
|
172
|
-
/** The peer's public key. Public keys are not secrets. */
|
|
173
|
-
public_key: string;
|
|
174
|
-
/** Addresses the peer may send from and that are routed to it. */
|
|
175
|
-
allowed_addresses: readonly Prefix[];
|
|
176
|
-
/** `host:port`, for a peer this side dials. The peer dials in when absent. */
|
|
177
|
-
endpoint?: Endpoint;
|
|
178
|
-
/** Seconds between keepalives, for a peer behind NAT. None when absent. */
|
|
179
|
-
keepalive?: number;
|
|
180
|
-
/** What a generated client config routes into the tunnel. Affects no forwarding here. */
|
|
181
|
-
client_allowed_addresses?: readonly Prefix[];
|
|
182
|
-
};
|
|
183
|
-
/** A WireGuard interface. */
|
|
184
|
-
export type WireGuard<F extends string> = Base<F> & {
|
|
185
|
-
type: "wireguard";
|
|
186
|
-
/** UDP port peers connect to. */
|
|
187
|
-
listen_port: number;
|
|
188
|
-
/** The address clients connect to, for generated client configs. */
|
|
189
|
-
endpoint?: IP;
|
|
190
|
-
/** This interface's private key. Its public key is derived from it. */
|
|
191
|
-
private_key: Secret;
|
|
192
|
-
/** Who may connect. */
|
|
193
|
-
peers?: readonly WireGuardPeer[];
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* A layer 2 bridge between VLAN interfaces, each keeping its own VLAN: a frame that comes in on one member leaves another with that member's tag. A firewall filters what crosses it, by the rules of its forward chain between the members, without routing it.
|
|
197
|
-
*/
|
|
198
|
-
export type Bridge<F extends string> = Base<F> & {
|
|
199
|
-
type: "bridge";
|
|
200
|
-
/** The VLAN interfaces it joins, by name. Each has no address of its own. */
|
|
201
|
-
members: readonly string[];
|
|
202
|
-
};
|
|
203
|
-
/** Any interface that is not a physical port. */
|
|
204
|
-
export type Interface<V extends string, F extends string> = VlanInterface<V, F> | Loopback<F> | Lag<V, F> | Gre<F> | Vxlan<F> | WireGuard<F> | Bridge<F>;
|
|
205
|
-
export {};
|