@highstate/library 0.9.18 → 0.9.20
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/dist/highstate.library.msgpack +0 -0
- package/dist/index.js +3684 -3126
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/common/access-point.ts +105 -0
- package/src/{files.ts → common/files.ts} +10 -8
- package/src/common/index.ts +3 -0
- package/src/{common.ts → common/server.ts} +69 -38
- package/src/databases/index.ts +4 -0
- package/src/databases/mariadb.ts +37 -0
- package/src/databases/mongodb.ts +37 -0
- package/src/databases/postgresql.ts +37 -0
- package/src/databases/shared.ts +61 -0
- package/src/distributions/ubuntu.ts +6 -4
- package/src/dns.ts +110 -12
- package/src/git.ts +7 -3
- package/src/impl-ref.ts +26 -0
- package/src/index.ts +14 -15
- package/src/k3s.ts +7 -5
- package/src/k8s/apps/code-server.ts +48 -0
- package/src/k8s/apps/gitea.ts +25 -0
- package/src/k8s/apps/grocy.ts +39 -0
- package/src/k8s/apps/hubble.ts +30 -0
- package/src/{apps → k8s/apps}/index.ts +16 -13
- package/src/k8s/apps/kubernetes-dashboard.ts +28 -0
- package/src/k8s/apps/mariadb.ts +83 -0
- package/src/k8s/apps/maybe.ts +39 -0
- package/src/k8s/apps/mongodb.ts +84 -0
- package/src/k8s/apps/postgresql.ts +86 -0
- package/src/k8s/apps/shared.ts +149 -0
- package/src/{apps → k8s/apps}/syncthing.ts +27 -9
- package/src/k8s/apps/traefik.ts +40 -0
- package/src/k8s/apps/vaultwarden.ts +31 -0
- package/src/k8s/apps/workload.ts +214 -0
- package/src/k8s/apps/zitadel.ts +26 -0
- package/src/k8s/cert-manager.ts +80 -0
- package/src/k8s/cilium.ts +64 -0
- package/src/k8s/gateway.ts +70 -0
- package/src/k8s/index.ts +9 -0
- package/src/{obfuscators → k8s/obfuscators}/phantun.ts +10 -6
- package/src/{obfuscators → k8s/obfuscators}/shared.ts +11 -5
- package/src/k8s/resources.ts +111 -0
- package/src/k8s/service.ts +65 -0
- package/src/{k8s.ts → k8s/shared.ts} +35 -329
- package/src/k8s/workload.ts +77 -0
- package/src/network.ts +208 -22
- package/src/nixos.ts +23 -8
- package/src/proxmox.ts +62 -75
- package/src/restic.ts +15 -6
- package/src/sops.ts +16 -5
- package/src/ssh.ts +107 -9
- package/src/talos.ts +6 -4
- package/src/third-party/cloudflare.ts +59 -0
- package/src/third-party/index.ts +4 -0
- package/src/{mullvad.ts → third-party/mullvad.ts} +6 -4
- package/src/third-party/timeweb.ts +99 -0
- package/src/third-party/yandex.ts +211 -0
- package/src/utils.ts +24 -3
- package/src/wireguard.ts +171 -48
- package/src/apps/code-server.ts +0 -34
- package/src/apps/deployment.ts +0 -60
- package/src/apps/dns.ts +0 -107
- package/src/apps/gitea.ts +0 -18
- package/src/apps/grocy.ts +0 -20
- package/src/apps/hubble.ts +0 -20
- package/src/apps/kubernetes-dashboard.ts +0 -19
- package/src/apps/mariadb.ts +0 -81
- package/src/apps/maybe.ts +0 -25
- package/src/apps/mongodb.ts +0 -81
- package/src/apps/network.ts +0 -55
- package/src/apps/postgresql.ts +0 -81
- package/src/apps/shared.ts +0 -289
- package/src/apps/test.ts +0 -19
- package/src/apps/traefik.ts +0 -36
- package/src/apps/vaultwarden.ts +0 -23
- package/src/apps/zitadel.ts +0 -21
- package/src/cloudflare.ts +0 -26
- package/src/timeweb.ts +0 -75
- package/src/{obfuscators → k8s/obfuscators}/index.ts +1 -1
@@ -0,0 +1,99 @@
|
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
+
import { serverOutputs, vmSecrets, vmSshArgs } from "../common"
|
3
|
+
import * as ssh from "../ssh"
|
4
|
+
|
5
|
+
export const connectionEntity = defineEntity({
|
6
|
+
type: "timeweb.connection.v1",
|
7
|
+
|
8
|
+
schema: z.object({
|
9
|
+
name: z.string(),
|
10
|
+
apiToken: z.string(),
|
11
|
+
}),
|
12
|
+
})
|
13
|
+
|
14
|
+
/**
|
15
|
+
* The Timeweb connection for a single account.
|
16
|
+
*/
|
17
|
+
export const connection = defineUnit({
|
18
|
+
type: "timeweb.connection.v1",
|
19
|
+
|
20
|
+
secrets: {
|
21
|
+
/**
|
22
|
+
* The API token for the Timeweb account.
|
23
|
+
*
|
24
|
+
* Can be obtained from the Timeweb control panel.
|
25
|
+
*/
|
26
|
+
apiToken: z.string(),
|
27
|
+
},
|
28
|
+
|
29
|
+
outputs: {
|
30
|
+
connection: connectionEntity,
|
31
|
+
},
|
32
|
+
|
33
|
+
meta: {
|
34
|
+
title: "Timeweb Connection",
|
35
|
+
icon: "material-symbols:cloud",
|
36
|
+
category: "Timeweb",
|
37
|
+
},
|
38
|
+
|
39
|
+
source: {
|
40
|
+
package: "@highstate/timeweb",
|
41
|
+
path: "connection",
|
42
|
+
},
|
43
|
+
})
|
44
|
+
|
45
|
+
export const virtualMachine = defineUnit({
|
46
|
+
type: "timeweb.virtual-machine.v1",
|
47
|
+
|
48
|
+
args: {
|
49
|
+
/**
|
50
|
+
* The ID of the preset to use for the virtual machine.
|
51
|
+
*
|
52
|
+
* Can be obtained from the Timeweb control panel when creating a new virtual machine.
|
53
|
+
*/
|
54
|
+
presetId: z.number().optional(),
|
55
|
+
|
56
|
+
/**
|
57
|
+
* The ID of the operating system to use for the virtual machine.
|
58
|
+
*
|
59
|
+
* Can be obtained from the Timeweb control panel when creating a new virtual machine.
|
60
|
+
*/
|
61
|
+
osId: z.number().optional(),
|
62
|
+
|
63
|
+
/**
|
64
|
+
* The ID of the connection to use for the virtual machine.
|
65
|
+
*
|
66
|
+
* Can be obtained from the Timeweb control panel when creating a new virtual machine.
|
67
|
+
*/
|
68
|
+
availabilityZone: z.string(),
|
69
|
+
|
70
|
+
/**
|
71
|
+
* The SSH arguments to use for the virtual machine.
|
72
|
+
*/
|
73
|
+
ssh: vmSshArgs,
|
74
|
+
},
|
75
|
+
|
76
|
+
inputs: {
|
77
|
+
connection: connectionEntity,
|
78
|
+
...ssh.inputs,
|
79
|
+
},
|
80
|
+
|
81
|
+
secrets: vmSecrets,
|
82
|
+
|
83
|
+
outputs: {
|
84
|
+
...serverOutputs,
|
85
|
+
},
|
86
|
+
|
87
|
+
meta: {
|
88
|
+
title: "Timeweb Virtual Machine",
|
89
|
+
description: "Creates a new Timeweb virtual machine.",
|
90
|
+
icon: "material-symbols:cloud",
|
91
|
+
secondaryIcon: "codicon:vm",
|
92
|
+
category: "Timeweb",
|
93
|
+
},
|
94
|
+
|
95
|
+
source: {
|
96
|
+
package: "@highstate/timeweb",
|
97
|
+
path: "virtual-machine",
|
98
|
+
},
|
99
|
+
})
|
@@ -0,0 +1,211 @@
|
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
+
import { serverOutputs, vmSecrets, vmSshArgs } from "../common"
|
3
|
+
import { ipv4PrefixSchema, ipv46Schema } from "../network"
|
4
|
+
import * as ssh from "../ssh"
|
5
|
+
|
6
|
+
export const cloudEntity = defineEntity({
|
7
|
+
type: "yandex.cloud.v1",
|
8
|
+
|
9
|
+
schema: z.object({
|
10
|
+
token: z.string().optional(),
|
11
|
+
serviceAccountKeyFile: z.string().optional(),
|
12
|
+
cloudId: z.string(),
|
13
|
+
defaultFolderId: z.string(),
|
14
|
+
defaultZone: z.string(),
|
15
|
+
regionId: z.string().optional(),
|
16
|
+
}),
|
17
|
+
|
18
|
+
meta: {
|
19
|
+
color: "#0080ff",
|
20
|
+
},
|
21
|
+
})
|
22
|
+
|
23
|
+
/**
|
24
|
+
* The connection to a Yandex Cloud account.
|
25
|
+
*/
|
26
|
+
export const connection = defineUnit({
|
27
|
+
type: "yandex.connection.v1",
|
28
|
+
|
29
|
+
args: {
|
30
|
+
/**
|
31
|
+
* The availability zone for resources.
|
32
|
+
*/
|
33
|
+
defaultZone: z.string().default("ru-central1-d"),
|
34
|
+
|
35
|
+
/**
|
36
|
+
* The region ID for resources.
|
37
|
+
*/
|
38
|
+
regionId: z.string().default("ru-central1"),
|
39
|
+
},
|
40
|
+
|
41
|
+
secrets: {
|
42
|
+
/**
|
43
|
+
* The service account key file content (JSON).
|
44
|
+
*/
|
45
|
+
serviceAccountKeyFile: {
|
46
|
+
schema: z.string().meta({ language: "json" }),
|
47
|
+
meta: {
|
48
|
+
title: "Service Account Key File",
|
49
|
+
},
|
50
|
+
},
|
51
|
+
},
|
52
|
+
|
53
|
+
inputs: {
|
54
|
+
...ssh.inputs,
|
55
|
+
},
|
56
|
+
|
57
|
+
outputs: {
|
58
|
+
/**
|
59
|
+
* The Yandex Cloud connection.
|
60
|
+
*/
|
61
|
+
yandexCloud: cloudEntity,
|
62
|
+
},
|
63
|
+
|
64
|
+
meta: {
|
65
|
+
title: "Yandex Cloud Connection",
|
66
|
+
category: "Yandex Cloud",
|
67
|
+
icon: "simple-icons:yandexcloud",
|
68
|
+
iconColor: "#0080ff",
|
69
|
+
},
|
70
|
+
|
71
|
+
source: {
|
72
|
+
package: "@highstate/yandex",
|
73
|
+
path: "connection",
|
74
|
+
},
|
75
|
+
})
|
76
|
+
|
77
|
+
/**
|
78
|
+
* The virtual machine on Yandex Cloud.
|
79
|
+
*/
|
80
|
+
export const virtualMachine = defineUnit({
|
81
|
+
type: "yandex.virtual-machine.v1",
|
82
|
+
|
83
|
+
args: {
|
84
|
+
/**
|
85
|
+
* The platform ID for the instance.
|
86
|
+
*/
|
87
|
+
platformId: z.string().default("standard-v3"),
|
88
|
+
|
89
|
+
/**
|
90
|
+
* The resources to allocate to the virtual machine.
|
91
|
+
*/
|
92
|
+
resources: z
|
93
|
+
.object({
|
94
|
+
/**
|
95
|
+
* The number of CPU cores.
|
96
|
+
*/
|
97
|
+
cores: z.number().default(2),
|
98
|
+
|
99
|
+
/**
|
100
|
+
* The amount of memory in GB.
|
101
|
+
*/
|
102
|
+
memory: z.number().default(4),
|
103
|
+
|
104
|
+
/**
|
105
|
+
* The core fraction (10-100).
|
106
|
+
*/
|
107
|
+
coreFraction: z.number().min(10).max(100).optional(),
|
108
|
+
})
|
109
|
+
.prefault({}),
|
110
|
+
|
111
|
+
/**
|
112
|
+
* The boot disk configuration.
|
113
|
+
*/
|
114
|
+
disk: z
|
115
|
+
.object({
|
116
|
+
/**
|
117
|
+
* The disk size in GB.
|
118
|
+
*
|
119
|
+
* For `network-ssd-nonreplicated` must be multiple of 93.
|
120
|
+
*/
|
121
|
+
size: z.number().default(20),
|
122
|
+
|
123
|
+
/**
|
124
|
+
* The disk type.
|
125
|
+
*/
|
126
|
+
type: z.string().default("network-ssd-nonreplicated"),
|
127
|
+
|
128
|
+
/**
|
129
|
+
* The image family to use.
|
130
|
+
*/
|
131
|
+
imageFamily: z.string().default("ubuntu-2204-lts"),
|
132
|
+
})
|
133
|
+
.prefault({}),
|
134
|
+
|
135
|
+
/**
|
136
|
+
* The network configuration.
|
137
|
+
*/
|
138
|
+
network: z
|
139
|
+
.object({
|
140
|
+
/**
|
141
|
+
* The subnet ID to connect to.
|
142
|
+
* If not specified, will auto-discover the default subnet for the zone.
|
143
|
+
*/
|
144
|
+
subnetId: z.string().optional(),
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Whether to assign a public IP.
|
148
|
+
*/
|
149
|
+
assignPublicIp: z.boolean().default(true),
|
150
|
+
|
151
|
+
/**
|
152
|
+
* The list of DNS servers.
|
153
|
+
*/
|
154
|
+
dns: ipv46Schema.array().default([]),
|
155
|
+
})
|
156
|
+
.prefault({}),
|
157
|
+
|
158
|
+
/**
|
159
|
+
* The IPv4 address configuration.
|
160
|
+
*/
|
161
|
+
ipv4: z
|
162
|
+
.discriminatedUnion("type", [
|
163
|
+
z.object({
|
164
|
+
type: z.literal("dhcp"),
|
165
|
+
}),
|
166
|
+
z.object({
|
167
|
+
type: z.literal("static"),
|
168
|
+
address: z.string(),
|
169
|
+
prefix: ipv4PrefixSchema.default(24),
|
170
|
+
gateway: z.string().optional(),
|
171
|
+
}),
|
172
|
+
])
|
173
|
+
.default({ type: "dhcp" }),
|
174
|
+
|
175
|
+
/**
|
176
|
+
* The SSH configuration.
|
177
|
+
*/
|
178
|
+
ssh: vmSshArgs,
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Additional metadata for cloud-init.
|
182
|
+
*/
|
183
|
+
metadata: z.record(z.string(), z.string()).default({}),
|
184
|
+
},
|
185
|
+
|
186
|
+
secrets: {
|
187
|
+
...vmSecrets,
|
188
|
+
},
|
189
|
+
|
190
|
+
inputs: {
|
191
|
+
yandexCloud: cloudEntity,
|
192
|
+
...ssh.inputs,
|
193
|
+
},
|
194
|
+
|
195
|
+
outputs: serverOutputs,
|
196
|
+
|
197
|
+
meta: {
|
198
|
+
title: "Yandex Cloud Virtual Machine",
|
199
|
+
category: "Yandex Cloud",
|
200
|
+
icon: "simple-icons:yandexcloud",
|
201
|
+
iconColor: "#0080ff",
|
202
|
+
secondaryIcon: "codicon:vm",
|
203
|
+
},
|
204
|
+
|
205
|
+
source: {
|
206
|
+
package: "@highstate/yandex",
|
207
|
+
path: "virtual-machine",
|
208
|
+
},
|
209
|
+
})
|
210
|
+
|
211
|
+
export type Cloud = z.infer<typeof cloudEntity.schema>
|
package/src/utils.ts
CHANGED
@@ -17,6 +17,17 @@ type PrefixedKeys<T extends Record<string, unknown>, Prefix extends string> = {
|
|
17
17
|
[K in keyof T as PrefixWith<Extract<K, string>, Prefix>]: T[K]
|
18
18
|
}
|
19
19
|
|
20
|
+
/**
|
21
|
+
* The helper function to prefix the keys of an object with a given prefix.
|
22
|
+
*
|
23
|
+
* If the prefix is not provided, the keys will not be modified.
|
24
|
+
*
|
25
|
+
* All keys after prefixing will be capitalized.
|
26
|
+
*
|
27
|
+
* @param prefix The prefix to use. If not provided, the keys will not be modified.
|
28
|
+
* @param obj The object to prefix the keys of.
|
29
|
+
* @returns The object with prefixed keys.
|
30
|
+
*/
|
20
31
|
export function prefixKeysWith<T extends Record<string, unknown>, Prefix extends string>(
|
21
32
|
prefix: Prefix | undefined,
|
22
33
|
obj: T,
|
@@ -27,11 +38,21 @@ export function prefixKeysWith<T extends Record<string, unknown>, Prefix extends
|
|
27
38
|
}
|
28
39
|
|
29
40
|
export const arrayPatchModeSchema = z.enum(["prepend", "replace"])
|
41
|
+
export const booleanPatchSchema = z.enum(["keep", "true", "false"])
|
30
42
|
|
31
43
|
/**
|
32
|
-
* The mode to use when patching some array
|
44
|
+
* The mode to use when patching some array:
|
33
45
|
*
|
34
|
-
* - `prepend`:
|
35
|
-
* - `replace`:
|
46
|
+
* - `prepend`: prepend the values of the new array to the existing array;
|
47
|
+
* - `replace`: replace the existing array with the new array.
|
36
48
|
*/
|
37
49
|
export type ArrayPatchMode = z.infer<typeof arrayPatchModeSchema>
|
50
|
+
|
51
|
+
/**
|
52
|
+
* The boolean patch:
|
53
|
+
*
|
54
|
+
* - `keep`: keep the existing value;
|
55
|
+
* - `true`: set the value to `true`;
|
56
|
+
* - `false`: set the value to `false`.
|
57
|
+
*/
|
58
|
+
export type BooleanPatch = z.infer<typeof booleanPatchSchema>
|
package/src/wireguard.ts
CHANGED
@@ -1,26 +1,55 @@
|
|
1
1
|
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { omit } from "remeda"
|
3
|
-
import {
|
3
|
+
import { serverEntity } from "./common/server"
|
4
|
+
import { exposableWorkloadEntity, networkInterfaceEntity } from "./k8s"
|
4
5
|
import { l3EndpointEntity, l4EndpointEntity } from "./network"
|
6
|
+
import { clusterEntity } from "./k8s"
|
5
7
|
import { arrayPatchModeSchema } from "./utils"
|
6
8
|
|
7
9
|
export const backendSchema = z.enum(["wireguard", "amneziawg"])
|
8
10
|
|
9
11
|
export type Backend = z.infer<typeof backendSchema>
|
10
12
|
|
13
|
+
const networkArgs = {
|
14
|
+
/**
|
15
|
+
* The backend to use for the WireGuard network.
|
16
|
+
*
|
17
|
+
* Possible values are:
|
18
|
+
* - `wireguard` - the default backend;
|
19
|
+
* - `amneziawg` - the censorship-resistant fork of WireGuard.
|
20
|
+
*/
|
21
|
+
backend: backendSchema.default("wireguard"),
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Whether to enable IPv4 support in the network.
|
25
|
+
*
|
26
|
+
* By default, IPv4 support is enabled.
|
27
|
+
*/
|
28
|
+
ipv4: z.boolean().default(true),
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Whether to enable IPv6 support in the network.
|
32
|
+
*
|
33
|
+
* By default, IPv6 support is disabled.
|
34
|
+
*/
|
35
|
+
ipv6: z.boolean().default(false),
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* The entity representing the WireGuard network configuration.
|
40
|
+
*
|
41
|
+
* It holds shared configuration for WireGuard identities, peers, and nodes.
|
42
|
+
*/
|
11
43
|
export const networkEntity = defineEntity({
|
12
|
-
type: "wireguard.network",
|
44
|
+
type: "wireguard.network.v1",
|
13
45
|
|
14
|
-
schema: z.object(
|
15
|
-
backend: backendSchema,
|
16
|
-
ipv6: z.boolean(),
|
17
|
-
}),
|
46
|
+
schema: z.object(networkArgs),
|
18
47
|
})
|
19
48
|
|
20
49
|
export const nodeExposePolicySchema = z.enum(["always", "when-has-endpoint", "never"])
|
21
50
|
|
22
51
|
export const peerEntity = defineEntity({
|
23
|
-
type: "wireguard.peer",
|
52
|
+
type: "wireguard.peer.v1",
|
24
53
|
|
25
54
|
schema: z.object({
|
26
55
|
name: z.string(),
|
@@ -58,7 +87,7 @@ export const peerEntity = defineEntity({
|
|
58
87
|
})
|
59
88
|
|
60
89
|
export const identityEntity = defineEntity({
|
61
|
-
type: "wireguard.identity",
|
90
|
+
type: "wireguard.identity.v1",
|
62
91
|
|
63
92
|
schema: z.object({
|
64
93
|
peer: peerEntity.schema,
|
@@ -76,37 +105,18 @@ export type Peer = z.infer<typeof peerEntity.schema>
|
|
76
105
|
export type NodeExposePolicy = z.infer<typeof nodeExposePolicySchema>
|
77
106
|
|
78
107
|
/**
|
79
|
-
*
|
108
|
+
* Holds the shared configuration for WireGuard identities, peers, and nodes.
|
80
109
|
*/
|
81
110
|
export const network = defineUnit({
|
82
|
-
type: "wireguard.network",
|
83
|
-
|
84
|
-
args: {
|
85
|
-
/**
|
86
|
-
* The backend to use for the WireGuard network.
|
87
|
-
*
|
88
|
-
* Possible values are:
|
89
|
-
* 1. `wireguard` - The default backend.
|
90
|
-
* 2. `amneziawg` - The censorship-resistant fork of WireGuard.
|
91
|
-
*
|
92
|
-
* By default, the `wireguard` backend is used.
|
93
|
-
*/
|
94
|
-
backend: backendSchema.default("wireguard"),
|
111
|
+
type: "wireguard.network.v1",
|
95
112
|
|
96
|
-
|
97
|
-
* The option to enable IPv6 support in the network.
|
98
|
-
*
|
99
|
-
* By default, IPv6 support is disabled.
|
100
|
-
*/
|
101
|
-
ipv6: z.boolean().default(false),
|
102
|
-
},
|
113
|
+
args: networkArgs,
|
103
114
|
|
104
115
|
outputs: {
|
105
116
|
network: networkEntity,
|
106
117
|
},
|
107
118
|
|
108
119
|
meta: {
|
109
|
-
description: "The WireGuard network with some shared configuration.",
|
110
120
|
icon: "simple-icons:wireguard",
|
111
121
|
iconColor: "#88171a",
|
112
122
|
secondaryIcon: "mdi:local-area-network-connect",
|
@@ -146,9 +156,9 @@ const sharedPeerArgs = {
|
|
146
156
|
*
|
147
157
|
* Implementation notes:
|
148
158
|
*
|
149
|
-
* -
|
150
|
-
* -
|
151
|
-
* -
|
159
|
+
* - this list will not be used to generate the allowed IPs for the peer;
|
160
|
+
* - instead, the node will setup extra direct routes to these IPs via default gateway;
|
161
|
+
* - this allows to use `0.0.0.0/0, ::/0` in the `allowedIps` (and corresponding fwmark magic) and still have some IPs excluded from the tunnel.
|
152
162
|
*/
|
153
163
|
excludedIps: z.string().array().default([]),
|
154
164
|
|
@@ -285,8 +295,11 @@ export type SharedPeerArgs = {
|
|
285
295
|
listenPort?: number
|
286
296
|
}
|
287
297
|
|
298
|
+
/**
|
299
|
+
* The WireGuard peer with the public key.
|
300
|
+
*/
|
288
301
|
export const peer = defineUnit({
|
289
|
-
type: "wireguard.peer",
|
302
|
+
type: "wireguard.peer.v1",
|
290
303
|
|
291
304
|
args: {
|
292
305
|
...sharedPeerArgs,
|
@@ -308,7 +321,6 @@ export const peer = defineUnit({
|
|
308
321
|
outputs: sharedPeerOutputs,
|
309
322
|
|
310
323
|
meta: {
|
311
|
-
description: "The WireGuard peer with the public key.",
|
312
324
|
icon: "simple-icons:wireguard",
|
313
325
|
iconColor: "#88171a",
|
314
326
|
secondaryIcon: "mdi:badge-account-horizontal",
|
@@ -321,8 +333,11 @@ export const peer = defineUnit({
|
|
321
333
|
},
|
322
334
|
})
|
323
335
|
|
336
|
+
/**
|
337
|
+
* Patches some properties of the WireGuard peer.
|
338
|
+
*/
|
324
339
|
export const peerPatch = defineUnit({
|
325
|
-
type: "wireguard.peer-patch",
|
340
|
+
type: "wireguard.peer-patch.v1",
|
326
341
|
|
327
342
|
args: {
|
328
343
|
/**
|
@@ -373,7 +388,6 @@ export const peerPatch = defineUnit({
|
|
373
388
|
|
374
389
|
meta: {
|
375
390
|
title: "WireGuard Peer Patch",
|
376
|
-
description: "Patches some properties of the WireGuard peer.",
|
377
391
|
icon: "simple-icons:wireguard",
|
378
392
|
iconColor: "#88171a",
|
379
393
|
secondaryIcon: "mdi:badge-account-horizontal",
|
@@ -386,8 +400,11 @@ export const peerPatch = defineUnit({
|
|
386
400
|
},
|
387
401
|
})
|
388
402
|
|
403
|
+
/**
|
404
|
+
* The WireGuard identity with the public key.
|
405
|
+
*/
|
389
406
|
export const identity = defineUnit({
|
390
|
-
type: "wireguard.identity",
|
407
|
+
type: "wireguard.identity.v1",
|
391
408
|
|
392
409
|
args: {
|
393
410
|
...sharedPeerArgs,
|
@@ -433,7 +450,6 @@ export const identity = defineUnit({
|
|
433
450
|
},
|
434
451
|
|
435
452
|
meta: {
|
436
|
-
description: "The WireGuard identity with the public key.",
|
437
453
|
icon: "simple-icons:wireguard",
|
438
454
|
iconColor: "#88171a",
|
439
455
|
secondaryIcon: "mdi:account",
|
@@ -446,8 +462,11 @@ export const identity = defineUnit({
|
|
446
462
|
},
|
447
463
|
})
|
448
464
|
|
449
|
-
|
450
|
-
|
465
|
+
/**
|
466
|
+
* The WireGuard node deployed in the Kubernetes cluster.
|
467
|
+
*/
|
468
|
+
export const nodeK8s = defineUnit({
|
469
|
+
type: "wireguard.node.k8s.v1",
|
451
470
|
|
452
471
|
args: {
|
453
472
|
/**
|
@@ -501,7 +520,7 @@ export const node = defineUnit({
|
|
501
520
|
},
|
502
521
|
|
503
522
|
interface: {
|
504
|
-
entity:
|
523
|
+
entity: networkInterfaceEntity,
|
505
524
|
required: false,
|
506
525
|
},
|
507
526
|
|
@@ -514,7 +533,7 @@ export const node = defineUnit({
|
|
514
533
|
|
515
534
|
outputs: {
|
516
535
|
interface: {
|
517
|
-
entity:
|
536
|
+
entity: networkInterfaceEntity,
|
518
537
|
required: false,
|
519
538
|
},
|
520
539
|
|
@@ -531,7 +550,107 @@ export const node = defineUnit({
|
|
531
550
|
},
|
532
551
|
|
533
552
|
meta: {
|
534
|
-
|
553
|
+
title: "WireGuard Kubernetes Node",
|
554
|
+
icon: "simple-icons:wireguard",
|
555
|
+
iconColor: "#88171a",
|
556
|
+
secondaryIcon: "devicon:kubernetes",
|
557
|
+
category: "VPN",
|
558
|
+
},
|
559
|
+
|
560
|
+
source: {
|
561
|
+
package: "@highstate/wireguard",
|
562
|
+
path: "node.k8s",
|
563
|
+
},
|
564
|
+
})
|
565
|
+
|
566
|
+
/**
|
567
|
+
* The WireGuard node deployed on a server using wg-quick systemd service.
|
568
|
+
*/
|
569
|
+
export const node = defineUnit({
|
570
|
+
type: "wireguard.node.v1",
|
571
|
+
|
572
|
+
args: {
|
573
|
+
/**
|
574
|
+
* The name of the WireGuard interface.
|
575
|
+
*
|
576
|
+
* By default, the name is `wg-${identity.name}` (truncated to 15 characters).
|
577
|
+
*/
|
578
|
+
interfaceName: z.string().optional(),
|
579
|
+
|
580
|
+
/**
|
581
|
+
* The name of the default interface for excluded routes.
|
582
|
+
*
|
583
|
+
* This is used to route excluded IPs through the default interface instead of the WireGuard tunnel.
|
584
|
+
*/
|
585
|
+
defaultInterface: z.string().default("eth0"),
|
586
|
+
|
587
|
+
/**
|
588
|
+
* List of CIDR blocks that should be blocked from forwarding through this WireGuard node.
|
589
|
+
*
|
590
|
+
* This prevents other peers from reaching these destination CIDRs while still allowing
|
591
|
+
* the peers in those CIDRs to access the internet and other allowed endpoints.
|
592
|
+
*
|
593
|
+
* Useful for peer isolation where you want to prevent cross-peer communication.
|
594
|
+
*/
|
595
|
+
forwardRestrictedIps: z.string().array().default([]),
|
596
|
+
|
597
|
+
/**
|
598
|
+
* Whether to enable IP masquerading (NAT) for outgoing traffic.
|
599
|
+
*
|
600
|
+
* By default, IP masquerading is enabled.
|
601
|
+
*/
|
602
|
+
enableMasquerade: z.boolean().default(true),
|
603
|
+
|
604
|
+
/**
|
605
|
+
* Script to run before bringing up the interface.
|
606
|
+
*/
|
607
|
+
preUpScript: z.string().optional().meta({ language: "shell" }),
|
608
|
+
|
609
|
+
/**
|
610
|
+
* Script to run after bringing up the interface.
|
611
|
+
*/
|
612
|
+
postUpScript: z.string().optional().meta({ language: "shell" }),
|
613
|
+
|
614
|
+
/**
|
615
|
+
* Script to run before bringing down the interface.
|
616
|
+
*/
|
617
|
+
preDownScript: z.string().optional().meta({ language: "shell" }),
|
618
|
+
|
619
|
+
/**
|
620
|
+
* Script to run after bringing down the interface.
|
621
|
+
*/
|
622
|
+
postDownScript: z.string().optional().meta({ language: "shell" }),
|
623
|
+
},
|
624
|
+
|
625
|
+
inputs: {
|
626
|
+
identity: identityEntity,
|
627
|
+
server: {
|
628
|
+
entity: serverEntity,
|
629
|
+
required: true,
|
630
|
+
},
|
631
|
+
|
632
|
+
peers: {
|
633
|
+
entity: peerEntity,
|
634
|
+
multiple: true,
|
635
|
+
required: false,
|
636
|
+
},
|
637
|
+
},
|
638
|
+
|
639
|
+
outputs: {
|
640
|
+
peer: {
|
641
|
+
entity: peerEntity,
|
642
|
+
required: false,
|
643
|
+
},
|
644
|
+
|
645
|
+
endpoints: {
|
646
|
+
entity: l4EndpointEntity,
|
647
|
+
required: false,
|
648
|
+
multiple: true,
|
649
|
+
},
|
650
|
+
},
|
651
|
+
|
652
|
+
meta: {
|
653
|
+
title: "WireGuard Server Node",
|
535
654
|
icon: "simple-icons:wireguard",
|
536
655
|
iconColor: "#88171a",
|
537
656
|
secondaryIcon: "mdi:server",
|
@@ -544,8 +663,11 @@ export const node = defineUnit({
|
|
544
663
|
},
|
545
664
|
})
|
546
665
|
|
666
|
+
/**
|
667
|
+
* Just the WireGuard configuration for the identity and peers.
|
668
|
+
*/
|
547
669
|
export const config = defineUnit({
|
548
|
-
type: "wireguard.config",
|
670
|
+
type: "wireguard.config.v1",
|
549
671
|
|
550
672
|
args: {
|
551
673
|
/**
|
@@ -567,7 +689,6 @@ export const config = defineUnit({
|
|
567
689
|
|
568
690
|
meta: {
|
569
691
|
title: "WireGuard Config",
|
570
|
-
description: "Just the WireGuard configuration for the identity and peers.",
|
571
692
|
icon: "simple-icons:wireguard",
|
572
693
|
iconColor: "#88171a",
|
573
694
|
secondaryIcon: "mdi:settings",
|
@@ -580,8 +701,11 @@ export const config = defineUnit({
|
|
580
701
|
},
|
581
702
|
})
|
582
703
|
|
704
|
+
/**
|
705
|
+
* The WireGuard configuration bundle for the identity and peers.
|
706
|
+
*/
|
583
707
|
export const configBundle = defineUnit({
|
584
|
-
type: "wireguard.config-bundle",
|
708
|
+
type: "wireguard.config-bundle.v1",
|
585
709
|
|
586
710
|
inputs: {
|
587
711
|
identity: identityEntity,
|
@@ -598,7 +722,6 @@ export const configBundle = defineUnit({
|
|
598
722
|
|
599
723
|
meta: {
|
600
724
|
title: "WireGuard Config Bundle",
|
601
|
-
description: "The WireGuard configuration bundle for the identity and peers.",
|
602
725
|
icon: "simple-icons:wireguard",
|
603
726
|
iconColor: "#88171a",
|
604
727
|
secondaryIcon: "mdi:folder-settings-variant",
|