@viaalink/caddy-api-client 0.0.0-stage → 0.10.1
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/LICENSE +21 -0
- package/README.md +675 -2
- package/dist/caddy/index.d.ts +5 -0
- package/dist/caddy/index.js +5 -0
- package/dist/caddy-http-jhg7B7CZ.d.ts +2735 -0
- package/dist/caddy-http.zod-T9FvybMd.d.ts +2243 -0
- package/dist/caddy-types.d.ts +941 -0
- package/dist/caddy-types.js +1 -0
- package/dist/client-ZQl_qNE7.d.ts +6712 -0
- package/dist/generated/extension-assets.d.ts +92 -0
- package/dist/generated/extension-assets.js +302 -0
- package/dist/index-BPmcxCVk.d.ts +1920 -0
- package/dist/index-CwQ-g5nn.d.ts +336 -0
- package/dist/index-P1KJwTOK.d.ts +3025 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +6 -0
- package/dist/mitm/index.d.ts +218 -0
- package/dist/mitm/index.js +2 -0
- package/dist/plugins/caddy-dns/index.d.ts +2 -0
- package/dist/plugins/caddy-dns/index.js +1 -0
- package/dist/plugins/caddy-security/index.d.ts +3 -0
- package/dist/plugins/caddy-security/index.js +2 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +2 -0
- package/dist/types-CccPerBC.d.ts +1041 -0
- package/package.json +168 -4
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* caddy-security plugin types
|
|
3
|
+
*
|
|
4
|
+
* This module provides TypeScript types for the caddy-security plugin handlers.
|
|
5
|
+
* These types enable strict type checking for authentication and authorization
|
|
6
|
+
* middleware configurations.
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/greenpau/caddy-security
|
|
9
|
+
* @see https://docs.authcrunch.com
|
|
10
|
+
* @see local/plugins/caddy-security/README.md
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import type {
|
|
15
|
+
* SecurityAuthenticatorHandler,
|
|
16
|
+
* SecurityAuthorizationHandler
|
|
17
|
+
* } from "@viaalink/caddy-api-client/plugins/caddy-security";
|
|
18
|
+
*
|
|
19
|
+
* // Portal handler (serves login UI)
|
|
20
|
+
* const portalHandler: SecurityAuthenticatorHandler = {
|
|
21
|
+
* handler: "authenticator",
|
|
22
|
+
* portal_name: "myportal",
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* // Authorization handler (validates tokens)
|
|
26
|
+
* const authzHandler: SecurityAuthorizationHandler = {
|
|
27
|
+
* handler: "authentication",
|
|
28
|
+
* providers: {
|
|
29
|
+
* authorizer: {
|
|
30
|
+
* gatekeeper_name: "mygatekeeper",
|
|
31
|
+
* },
|
|
32
|
+
* },
|
|
33
|
+
* };
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Authentication portal middleware handler
|
|
38
|
+
*
|
|
39
|
+
* Serves the authentication portal UI and handles credential validation.
|
|
40
|
+
* Issues JWT tokens upon successful authentication.
|
|
41
|
+
*
|
|
42
|
+
* **Module ID:** `http.handlers.authenticator`
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const handler: SecurityAuthenticatorHandler = {
|
|
47
|
+
* handler: "authenticator",
|
|
48
|
+
* portal_name: "myportal",
|
|
49
|
+
* route_matcher: "example.com",
|
|
50
|
+
* };
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
interface SecurityAuthenticatorHandler {
|
|
54
|
+
handler: "authenticator";
|
|
55
|
+
/**
|
|
56
|
+
* Name of the authentication portal defined in the security app config.
|
|
57
|
+
* References a portal in `/config/apps/security/config/authentication_portals`
|
|
58
|
+
*/
|
|
59
|
+
portal_name?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Route matcher pattern for this handler.
|
|
62
|
+
* Typically matches the domain serving the portal.
|
|
63
|
+
*/
|
|
64
|
+
route_matcher?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Authorizer provider configuration
|
|
68
|
+
*
|
|
69
|
+
* This is the configuration for the `authorizer` provider within Caddy's
|
|
70
|
+
* `authentication` handler. It validates JWT/PASETO tokens and enforces
|
|
71
|
+
* access control policies.
|
|
72
|
+
*
|
|
73
|
+
* **Module ID:** `http.authentication.providers.authorizer`
|
|
74
|
+
*
|
|
75
|
+
* Note: This is NOT a standalone handler - it's used as a provider within
|
|
76
|
+
* the `authentication` handler via the `providers.authorizer` field.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const provider: SecurityAuthorizerProvider = {
|
|
81
|
+
* gatekeeper_name: "mygatekeeper",
|
|
82
|
+
* route_matcher: "*",
|
|
83
|
+
* };
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
interface SecurityAuthorizerProvider {
|
|
87
|
+
/**
|
|
88
|
+
* Name of the gatekeeper/policy defined in the security app config.
|
|
89
|
+
* References a policy in `/config/apps/security/config/authorization_policies`
|
|
90
|
+
*/
|
|
91
|
+
gatekeeper_name?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Route matcher pattern for this provider.
|
|
94
|
+
*/
|
|
95
|
+
route_matcher?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Authorization handler using Caddy's authentication handler with the authorizer provider
|
|
99
|
+
*
|
|
100
|
+
* The `authorize` directive in Caddyfile creates a standard Caddy `authentication` handler
|
|
101
|
+
* with the caddy-security `authorizer` provider configured.
|
|
102
|
+
*
|
|
103
|
+
* **Module ID:** `http.handlers.authentication` (Caddy core)
|
|
104
|
+
* **Provider Module ID:** `http.authentication.providers.authorizer` (caddy-security)
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const handler: SecurityAuthorizationHandler = {
|
|
109
|
+
* handler: "authentication",
|
|
110
|
+
* providers: {
|
|
111
|
+
* authorizer: {
|
|
112
|
+
* gatekeeper_name: "mygatekeeper",
|
|
113
|
+
* route_matcher: "*",
|
|
114
|
+
* },
|
|
115
|
+
* },
|
|
116
|
+
* };
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
interface SecurityAuthorizationHandler {
|
|
120
|
+
handler: "authentication";
|
|
121
|
+
/**
|
|
122
|
+
* Authentication providers - for authorization, use the `authorizer` provider
|
|
123
|
+
*/
|
|
124
|
+
providers: {
|
|
125
|
+
authorizer: SecurityAuthorizerProvider;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Local identity store configuration
|
|
130
|
+
*
|
|
131
|
+
* Stores user credentials in a local JSON file.
|
|
132
|
+
*/
|
|
133
|
+
interface LocalIdentityStore {
|
|
134
|
+
/** Store driver type */
|
|
135
|
+
driver: "local";
|
|
136
|
+
/** Realm name for this identity store */
|
|
137
|
+
realm?: string;
|
|
138
|
+
/** Path to the JSON file containing user credentials */
|
|
139
|
+
path: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* LDAP identity store configuration
|
|
143
|
+
*/
|
|
144
|
+
interface LdapIdentityStore {
|
|
145
|
+
driver: "ldap";
|
|
146
|
+
realm?: string;
|
|
147
|
+
/** LDAP server addresses */
|
|
148
|
+
servers?: {
|
|
149
|
+
address: string;
|
|
150
|
+
port?: number;
|
|
151
|
+
}[];
|
|
152
|
+
/** Bind DN for LDAP queries */
|
|
153
|
+
bind_dn?: string;
|
|
154
|
+
/** Bind password */
|
|
155
|
+
bind_password?: string;
|
|
156
|
+
/** Base DN for user searches */
|
|
157
|
+
search_base_dn?: string;
|
|
158
|
+
/** Search filter template */
|
|
159
|
+
search_filter?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* OAuth 2.0 identity provider configuration
|
|
163
|
+
*/
|
|
164
|
+
interface OAuth2IdentityProvider {
|
|
165
|
+
driver: "oauth2";
|
|
166
|
+
realm?: string;
|
|
167
|
+
/** Provider name (github, google, facebook, etc.) */
|
|
168
|
+
provider?: string;
|
|
169
|
+
/** OAuth client ID */
|
|
170
|
+
client_id?: string;
|
|
171
|
+
/** OAuth client secret */
|
|
172
|
+
client_secret?: string;
|
|
173
|
+
/** OAuth scopes to request */
|
|
174
|
+
scopes?: string[];
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* OpenID Connect identity provider configuration
|
|
178
|
+
*/
|
|
179
|
+
interface OidcIdentityProvider {
|
|
180
|
+
driver: "oidc";
|
|
181
|
+
realm?: string;
|
|
182
|
+
/** OIDC provider name */
|
|
183
|
+
provider?: string;
|
|
184
|
+
/** Client ID */
|
|
185
|
+
client_id?: string;
|
|
186
|
+
/** Client secret */
|
|
187
|
+
client_secret?: string;
|
|
188
|
+
/** Discovery URL (.well-known/openid-configuration) */
|
|
189
|
+
discovery_url?: string;
|
|
190
|
+
/** Scopes to request */
|
|
191
|
+
scopes?: string[];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Union of all identity store/provider types
|
|
195
|
+
*/
|
|
196
|
+
type IdentityStore = LocalIdentityStore | LdapIdentityStore | OAuth2IdentityProvider | OidcIdentityProvider;
|
|
197
|
+
/**
|
|
198
|
+
* Authentication portal configuration
|
|
199
|
+
*/
|
|
200
|
+
interface AuthenticationPortal {
|
|
201
|
+
/** Portal name (referenced by portal_name in handlers) */
|
|
202
|
+
name: string;
|
|
203
|
+
/** UI customization settings */
|
|
204
|
+
ui?: {
|
|
205
|
+
/** Theme name */
|
|
206
|
+
theme?: string;
|
|
207
|
+
/** Logo URL */
|
|
208
|
+
logo_url?: string;
|
|
209
|
+
/** Custom CSS */
|
|
210
|
+
custom_css?: string;
|
|
211
|
+
};
|
|
212
|
+
/** Cookie settings */
|
|
213
|
+
cookie?: {
|
|
214
|
+
/** Cookie domain */
|
|
215
|
+
domain?: string;
|
|
216
|
+
/** Cookie path */
|
|
217
|
+
path?: string;
|
|
218
|
+
/** Cookie lifetime */
|
|
219
|
+
lifetime?: string;
|
|
220
|
+
};
|
|
221
|
+
/** Identity stores enabled for this portal */
|
|
222
|
+
identity_stores?: string[];
|
|
223
|
+
/** Identity providers enabled for this portal */
|
|
224
|
+
identity_providers?: string[];
|
|
225
|
+
/** Transform rules for user claims */
|
|
226
|
+
transform_user?: Record<string, unknown>;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Authorization policy (gatekeeper) configuration
|
|
230
|
+
*/
|
|
231
|
+
interface AuthorizationPolicy {
|
|
232
|
+
/** Policy name (referenced by gatekeeper_name in handlers) */
|
|
233
|
+
name: string;
|
|
234
|
+
/** Access control lists */
|
|
235
|
+
access_lists?: {
|
|
236
|
+
/** Action: allow or deny */
|
|
237
|
+
action?: "allow" | "deny";
|
|
238
|
+
/** Required claims for this rule */
|
|
239
|
+
claim?: string;
|
|
240
|
+
/** Required values for the claim */
|
|
241
|
+
values?: string[];
|
|
242
|
+
}[];
|
|
243
|
+
/** Crypto key configuration for JWT validation */
|
|
244
|
+
crypto_key?: {
|
|
245
|
+
/** Token name */
|
|
246
|
+
token_name?: string;
|
|
247
|
+
/** Token source (header, cookie, query) */
|
|
248
|
+
source?: string;
|
|
249
|
+
};
|
|
250
|
+
/** Bypass paths (no auth required) */
|
|
251
|
+
bypass?: string[];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Credentials configuration
|
|
255
|
+
*/
|
|
256
|
+
interface Credentials {
|
|
257
|
+
/** Generic credentials store */
|
|
258
|
+
generic?: Record<string, unknown>;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Security app configuration
|
|
262
|
+
*
|
|
263
|
+
* This is the main configuration object at `/config/apps/security/config`
|
|
264
|
+
*/
|
|
265
|
+
interface SecurityConfig {
|
|
266
|
+
/** Authentication portals */
|
|
267
|
+
authentication_portals?: AuthenticationPortal[];
|
|
268
|
+
/** Authorization policies (gatekeepers) */
|
|
269
|
+
authorization_policies?: AuthorizationPolicy[];
|
|
270
|
+
/** Credentials for external services */
|
|
271
|
+
credentials?: Credentials;
|
|
272
|
+
/** Identity stores */
|
|
273
|
+
identity_stores?: IdentityStore[];
|
|
274
|
+
/** Identity providers */
|
|
275
|
+
identity_providers?: IdentityStore[];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Secrets manager interface
|
|
279
|
+
*/
|
|
280
|
+
interface SecretsManager {
|
|
281
|
+
/** Driver type (aws_secrets_manager, hashicorp_vault, etc.) */
|
|
282
|
+
driver: string;
|
|
283
|
+
[key: string]: unknown;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Security app configuration
|
|
287
|
+
*
|
|
288
|
+
* Top-level configuration at `/config/apps/security`
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* const securityApp: SecurityApp = {
|
|
293
|
+
* config: {
|
|
294
|
+
* authentication_portals: [{
|
|
295
|
+
* name: "myportal",
|
|
296
|
+
* identity_stores: ["localdb"],
|
|
297
|
+
* }],
|
|
298
|
+
* identity_stores: [{
|
|
299
|
+
* driver: "local",
|
|
300
|
+
* realm: "local",
|
|
301
|
+
* path: "/path/to/users.json",
|
|
302
|
+
* }],
|
|
303
|
+
* },
|
|
304
|
+
* };
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
interface SecurityApp {
|
|
308
|
+
/** Security configuration */
|
|
309
|
+
config?: SecurityConfig;
|
|
310
|
+
/** Secrets managers for external secret storage */
|
|
311
|
+
secrets_managers?: SecretsManager[];
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Union of all caddy-security handler types
|
|
315
|
+
*/
|
|
316
|
+
type SecurityHandler = SecurityAuthenticatorHandler | SecurityAuthorizationHandler;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Core type definitions for Caddy API client
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Domain name (e.g., "example.com")
|
|
324
|
+
*/
|
|
325
|
+
type Domain = string;
|
|
326
|
+
/**
|
|
327
|
+
* Dial address in host:port format (e.g., "127.0.0.1:3000")
|
|
328
|
+
*/
|
|
329
|
+
type DialAddress = string;
|
|
330
|
+
/**
|
|
331
|
+
* HTTP method for Caddy's method matcher. Not a closed set -- real Caddy's
|
|
332
|
+
* MatchMethod accepts any string (see HttpMethodSchema in schemas.ts for
|
|
333
|
+
* the caddy-validate verification) -- so this keeps IDE autocomplete for
|
|
334
|
+
* the common methods via `(string & {})` while still accepting any string.
|
|
335
|
+
*/
|
|
336
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "CONNECT" | "TRACE" | (string & {});
|
|
337
|
+
/**
|
|
338
|
+
* Frame options for X-Frame-Options header
|
|
339
|
+
*/
|
|
340
|
+
type FrameOptions = "DENY" | "SAMEORIGIN";
|
|
341
|
+
/**
|
|
342
|
+
* Redirect mode for domain redirects
|
|
343
|
+
* - "none": No redirect
|
|
344
|
+
* - "www_to_domain": Redirect www.example.com to example.com
|
|
345
|
+
* - "domain_to_www": Redirect example.com to www.example.com
|
|
346
|
+
*/
|
|
347
|
+
type RedirectMode = "none" | "www_to_domain" | "domain_to_www";
|
|
348
|
+
/**
|
|
349
|
+
* HTTP redirect status code
|
|
350
|
+
* - 301: Moved Permanently (may change POST to GET)
|
|
351
|
+
* - 308: Permanent Redirect (preserves HTTP method) - Recommended
|
|
352
|
+
* - 302: Found (temporary, may change POST to GET)
|
|
353
|
+
* - 307: Temporary Redirect (preserves HTTP method)
|
|
354
|
+
*/
|
|
355
|
+
type RedirectStatusCode = 301 | 302 | 307 | 308;
|
|
356
|
+
/**
|
|
357
|
+
* Caddy route matcher
|
|
358
|
+
*/
|
|
359
|
+
interface CaddyRouteMatcher {
|
|
360
|
+
host?: string[];
|
|
361
|
+
path?: string[];
|
|
362
|
+
method?: HttpMethod[];
|
|
363
|
+
header?: Record<string, string[]>;
|
|
364
|
+
query?: Record<string, string[]>;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Reverse proxy handler - forward requests to upstream servers
|
|
368
|
+
*/
|
|
369
|
+
interface ReverseProxyHandler {
|
|
370
|
+
handler: "reverse_proxy";
|
|
371
|
+
upstreams?: {
|
|
372
|
+
dial: string;
|
|
373
|
+
max_requests?: number;
|
|
374
|
+
}[];
|
|
375
|
+
transport?: {
|
|
376
|
+
protocol?: string;
|
|
377
|
+
tls?: {
|
|
378
|
+
server_name?: string;
|
|
379
|
+
insecure_skip_verify?: boolean;
|
|
380
|
+
ca?: string;
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
load_balancing?: {
|
|
384
|
+
policy?: string;
|
|
385
|
+
selection_policy?: {
|
|
386
|
+
policy?: string;
|
|
387
|
+
};
|
|
388
|
+
retries?: number;
|
|
389
|
+
try_duration?: string;
|
|
390
|
+
try_interval?: string;
|
|
391
|
+
};
|
|
392
|
+
health_checks?: {
|
|
393
|
+
active?: {
|
|
394
|
+
path?: string;
|
|
395
|
+
uri?: string;
|
|
396
|
+
interval?: string;
|
|
397
|
+
timeout?: string;
|
|
398
|
+
expect_status?: number;
|
|
399
|
+
passes?: number;
|
|
400
|
+
fails?: number;
|
|
401
|
+
};
|
|
402
|
+
passive?: {
|
|
403
|
+
fail_duration?: string;
|
|
404
|
+
max_fails?: number;
|
|
405
|
+
unhealthy_status?: number[];
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
headers?: {
|
|
409
|
+
request?: {
|
|
410
|
+
set?: Record<string, string[]>;
|
|
411
|
+
add?: Record<string, string[]>;
|
|
412
|
+
delete?: string[];
|
|
413
|
+
};
|
|
414
|
+
response?: {
|
|
415
|
+
set?: Record<string, string[]>;
|
|
416
|
+
add?: Record<string, string[]>;
|
|
417
|
+
delete?: string[];
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
flush_interval?: string | number;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Headers handler - modify request/response headers
|
|
424
|
+
*/
|
|
425
|
+
interface HeadersHandler {
|
|
426
|
+
handler: "headers";
|
|
427
|
+
request?: {
|
|
428
|
+
set?: Record<string, string[]>;
|
|
429
|
+
add?: Record<string, string[]>;
|
|
430
|
+
delete?: string[];
|
|
431
|
+
};
|
|
432
|
+
response?: {
|
|
433
|
+
deferred?: boolean;
|
|
434
|
+
set?: Record<string, string[]>;
|
|
435
|
+
add?: Record<string, string[]>;
|
|
436
|
+
delete?: string[];
|
|
437
|
+
require?: {
|
|
438
|
+
status_code?: number[];
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Static response handler - return static content
|
|
444
|
+
*/
|
|
445
|
+
interface StaticResponseHandler {
|
|
446
|
+
handler: "static_response";
|
|
447
|
+
status_code?: number | string;
|
|
448
|
+
body?: string;
|
|
449
|
+
headers?: Record<string, string[]>;
|
|
450
|
+
close?: boolean;
|
|
451
|
+
abort?: boolean;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Authentication handler - HTTP basic auth
|
|
455
|
+
*/
|
|
456
|
+
interface AuthenticationHandler {
|
|
457
|
+
handler: "authentication";
|
|
458
|
+
providers?: {
|
|
459
|
+
http_basic?: {
|
|
460
|
+
accounts?: {
|
|
461
|
+
username: string;
|
|
462
|
+
password: string;
|
|
463
|
+
}[];
|
|
464
|
+
realm?: string;
|
|
465
|
+
hash?: {
|
|
466
|
+
algorithm?: string;
|
|
467
|
+
};
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Rewrite handler - URI rewriting
|
|
473
|
+
*/
|
|
474
|
+
interface RewriteHandler {
|
|
475
|
+
handler: "rewrite";
|
|
476
|
+
uri?: string;
|
|
477
|
+
strip_path_prefix?: string;
|
|
478
|
+
strip_path_suffix?: string;
|
|
479
|
+
uri_substring?: {
|
|
480
|
+
find: string;
|
|
481
|
+
replace: string;
|
|
482
|
+
limit?: number;
|
|
483
|
+
}[];
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Encode handler - response compression
|
|
487
|
+
*/
|
|
488
|
+
interface EncodeHandler {
|
|
489
|
+
handler: "encode";
|
|
490
|
+
encodings?: {
|
|
491
|
+
gzip?: Record<string, unknown>;
|
|
492
|
+
zstd?: Record<string, unknown>;
|
|
493
|
+
br?: Record<string, unknown>;
|
|
494
|
+
};
|
|
495
|
+
prefer?: string[];
|
|
496
|
+
minimum_length?: number;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Subroute handler - nested routes
|
|
500
|
+
*/
|
|
501
|
+
interface SubrouteHandler {
|
|
502
|
+
handler: "subroute";
|
|
503
|
+
routes?: CaddyRoute[];
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Generic handler - extensibility fallback for unknown handlers
|
|
507
|
+
*/
|
|
508
|
+
interface GenericHandler {
|
|
509
|
+
handler: string;
|
|
510
|
+
[key: string]: unknown;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Caddy route handler - discriminated union of all known handlers with generic fallback
|
|
514
|
+
*
|
|
515
|
+
* Known handlers get strict type checking. Unknown handlers (custom plugins)
|
|
516
|
+
* use GenericHandler which allows any properties for extensibility.
|
|
517
|
+
*
|
|
518
|
+
* ## Core Handlers (20)
|
|
519
|
+
* Built-in Caddy HTTP handlers generated from Go source.
|
|
520
|
+
*
|
|
521
|
+
* ## Plugin Handlers
|
|
522
|
+
* - **caddy-security**: SecurityAuthenticatorHandler (portal), SecurityAuthorizationHandler (uses core authentication handler)
|
|
523
|
+
*
|
|
524
|
+
* Note: SecurityAuthorizationHandler uses Caddy's built-in `authentication` handler with the
|
|
525
|
+
* caddy-security `authorizer` provider. It's a type alias, not in the union (same discriminator).
|
|
526
|
+
*/
|
|
527
|
+
type CaddyRouteHandler = ReverseProxyHandler | HeadersHandler | StaticResponseHandler | AuthenticationHandler | RewriteHandler | EncodeHandler | SubrouteHandler | FileServerHandler | TemplatesHandler | MapHandler | PushHandler | RequestBodyHandler | VarsHandler | InterceptHandler | InvokeHandler | TracingHandler | LogAppendHandler | ErrorHandler | CopyResponseHandler | CopyResponseHeadersHandler | SecurityAuthenticatorHandler | GenericHandler;
|
|
528
|
+
interface FileServerHandler {
|
|
529
|
+
handler: "file_server";
|
|
530
|
+
root?: string;
|
|
531
|
+
index_names?: string[];
|
|
532
|
+
browse?: Record<string, unknown>;
|
|
533
|
+
hide?: string[];
|
|
534
|
+
[key: string]: unknown;
|
|
535
|
+
}
|
|
536
|
+
interface TemplatesHandler {
|
|
537
|
+
handler: "templates";
|
|
538
|
+
file_root?: string;
|
|
539
|
+
mime_types?: string[];
|
|
540
|
+
delimiters?: string[];
|
|
541
|
+
[key: string]: unknown;
|
|
542
|
+
}
|
|
543
|
+
interface MapHandler {
|
|
544
|
+
handler: "map";
|
|
545
|
+
source?: string;
|
|
546
|
+
destinations?: string[];
|
|
547
|
+
mappings?: {
|
|
548
|
+
input?: string;
|
|
549
|
+
outputs?: unknown[];
|
|
550
|
+
}[];
|
|
551
|
+
defaults?: string[];
|
|
552
|
+
[key: string]: unknown;
|
|
553
|
+
}
|
|
554
|
+
interface PushHandler {
|
|
555
|
+
handler: "push";
|
|
556
|
+
resources?: {
|
|
557
|
+
target?: string;
|
|
558
|
+
method?: string;
|
|
559
|
+
}[];
|
|
560
|
+
headers?: Record<string, unknown>;
|
|
561
|
+
[key: string]: unknown;
|
|
562
|
+
}
|
|
563
|
+
interface RequestBodyHandler {
|
|
564
|
+
handler: "request_body";
|
|
565
|
+
max_size?: number;
|
|
566
|
+
[key: string]: unknown;
|
|
567
|
+
}
|
|
568
|
+
interface VarsHandler {
|
|
569
|
+
handler: "vars";
|
|
570
|
+
[key: string]: unknown;
|
|
571
|
+
}
|
|
572
|
+
interface InterceptHandler {
|
|
573
|
+
handler: "intercept";
|
|
574
|
+
handle_response?: unknown[];
|
|
575
|
+
[key: string]: unknown;
|
|
576
|
+
}
|
|
577
|
+
interface InvokeHandler {
|
|
578
|
+
handler: "invoke";
|
|
579
|
+
name?: string;
|
|
580
|
+
[key: string]: unknown;
|
|
581
|
+
}
|
|
582
|
+
interface TracingHandler {
|
|
583
|
+
handler: "tracing";
|
|
584
|
+
span?: string;
|
|
585
|
+
[key: string]: unknown;
|
|
586
|
+
}
|
|
587
|
+
interface LogAppendHandler {
|
|
588
|
+
handler: "log_append";
|
|
589
|
+
key?: string;
|
|
590
|
+
value?: string;
|
|
591
|
+
[key: string]: unknown;
|
|
592
|
+
}
|
|
593
|
+
interface ErrorHandler {
|
|
594
|
+
handler: "error";
|
|
595
|
+
error?: string;
|
|
596
|
+
status_code?: string | number;
|
|
597
|
+
[key: string]: unknown;
|
|
598
|
+
}
|
|
599
|
+
interface CopyResponseHandler {
|
|
600
|
+
handler: "copy_response";
|
|
601
|
+
status_code?: number;
|
|
602
|
+
[key: string]: unknown;
|
|
603
|
+
}
|
|
604
|
+
interface CopyResponseHeadersHandler {
|
|
605
|
+
handler: "copy_response_headers";
|
|
606
|
+
include?: string[];
|
|
607
|
+
exclude?: string[];
|
|
608
|
+
[key: string]: unknown;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Caddy route definition
|
|
612
|
+
*/
|
|
613
|
+
interface CaddyRoute {
|
|
614
|
+
"@id"?: string;
|
|
615
|
+
match?: CaddyRouteMatcher[];
|
|
616
|
+
handle?: CaddyRouteHandler[];
|
|
617
|
+
terminal?: boolean;
|
|
618
|
+
priority?: number;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* TLS connection policy configuration
|
|
622
|
+
*/
|
|
623
|
+
interface TlsConnectionPolicy {
|
|
624
|
+
/** SNI hostnames to match */
|
|
625
|
+
match?: {
|
|
626
|
+
sni?: string[];
|
|
627
|
+
};
|
|
628
|
+
/** Certificate selection criteria */
|
|
629
|
+
certificate_selection?: {
|
|
630
|
+
any_tag?: string[];
|
|
631
|
+
all_tags?: string[];
|
|
632
|
+
serial_number?: string;
|
|
633
|
+
subject_organization?: string;
|
|
634
|
+
};
|
|
635
|
+
/** Minimum TLS protocol version (e.g., "1.2", "1.3") */
|
|
636
|
+
protocol_min?: string;
|
|
637
|
+
/** Maximum TLS protocol version (e.g., "1.2", "1.3") */
|
|
638
|
+
protocol_max?: string;
|
|
639
|
+
/** Cipher suites to allow */
|
|
640
|
+
cipher_suites?: string[];
|
|
641
|
+
/** Elliptic curves to allow */
|
|
642
|
+
curves?: string[];
|
|
643
|
+
/** ALPN protocols (e.g., ["h3", "h2", "http/1.1"]) */
|
|
644
|
+
alpn?: string[];
|
|
645
|
+
/** Client authentication settings */
|
|
646
|
+
client_authentication?: {
|
|
647
|
+
mode?: "request" | "require" | "verify_if_given";
|
|
648
|
+
trusted_ca_certs?: string[];
|
|
649
|
+
trusted_ca_certs_pem_files?: string[];
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Options for CaddyClient constructor
|
|
654
|
+
*/
|
|
655
|
+
interface CaddyClientOptions {
|
|
656
|
+
/**
|
|
657
|
+
* Caddy Admin API base URL
|
|
658
|
+
* @default "http://127.0.0.1:2019"
|
|
659
|
+
*/
|
|
660
|
+
adminUrl?: string;
|
|
661
|
+
/**
|
|
662
|
+
* Request timeout in milliseconds
|
|
663
|
+
* @default 5000
|
|
664
|
+
*/
|
|
665
|
+
timeout?: number;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Security headers configuration
|
|
669
|
+
*/
|
|
670
|
+
interface SecurityHeaders {
|
|
671
|
+
/**
|
|
672
|
+
* Enable HSTS (HTTP Strict Transport Security)
|
|
673
|
+
* @default false
|
|
674
|
+
*/
|
|
675
|
+
enableHsts?: boolean;
|
|
676
|
+
/**
|
|
677
|
+
* HSTS max-age in seconds
|
|
678
|
+
* @default 31536000 (1 year)
|
|
679
|
+
*/
|
|
680
|
+
hstsMaxAge?: number;
|
|
681
|
+
/**
|
|
682
|
+
* X-Frame-Options header value
|
|
683
|
+
* @default "DENY"
|
|
684
|
+
*/
|
|
685
|
+
frameOptions?: FrameOptions;
|
|
686
|
+
/**
|
|
687
|
+
* Enable gzip/brotli compression
|
|
688
|
+
* @default true
|
|
689
|
+
*/
|
|
690
|
+
enableCompression?: boolean;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Options for adding a domain with automatic TLS
|
|
694
|
+
*/
|
|
695
|
+
interface AddDomainWithAutoTlsOptions {
|
|
696
|
+
/**
|
|
697
|
+
* Domain name (e.g., "example.com")
|
|
698
|
+
*/
|
|
699
|
+
domain: Domain;
|
|
700
|
+
/**
|
|
701
|
+
* Target upstream address (e.g., "127.0.0.1:3000")
|
|
702
|
+
*/
|
|
703
|
+
target: string;
|
|
704
|
+
/**
|
|
705
|
+
* Target upstream port
|
|
706
|
+
*/
|
|
707
|
+
targetPort: number;
|
|
708
|
+
/**
|
|
709
|
+
* Enable security headers (HSTS, X-Frame-Options, etc.)
|
|
710
|
+
* @default true
|
|
711
|
+
*/
|
|
712
|
+
enableSecurityHeaders?: boolean;
|
|
713
|
+
/**
|
|
714
|
+
* Enable HSTS
|
|
715
|
+
* @default false
|
|
716
|
+
*/
|
|
717
|
+
enableHsts?: boolean;
|
|
718
|
+
/**
|
|
719
|
+
* HSTS max-age in seconds
|
|
720
|
+
* @default 31536000
|
|
721
|
+
*/
|
|
722
|
+
hstsMaxAge?: number;
|
|
723
|
+
/**
|
|
724
|
+
* X-Frame-Options value
|
|
725
|
+
* @default "DENY"
|
|
726
|
+
*/
|
|
727
|
+
frameOptions?: FrameOptions;
|
|
728
|
+
/**
|
|
729
|
+
* Enable compression
|
|
730
|
+
* @default true
|
|
731
|
+
*/
|
|
732
|
+
enableCompression?: boolean;
|
|
733
|
+
/**
|
|
734
|
+
* HTTP to HTTPS redirect mode
|
|
735
|
+
* @default "none"
|
|
736
|
+
*/
|
|
737
|
+
redirectMode?: RedirectMode;
|
|
738
|
+
/**
|
|
739
|
+
* HTTP redirect status code
|
|
740
|
+
* @default 308 (Permanent Redirect - preserves HTTP method)
|
|
741
|
+
*/
|
|
742
|
+
redirectStatusCode?: RedirectStatusCode;
|
|
743
|
+
/**
|
|
744
|
+
* Caddy Admin API URL (overrides client default)
|
|
745
|
+
*/
|
|
746
|
+
adminUrl?: string;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Options for adding a domain with custom TLS certificate
|
|
750
|
+
*/
|
|
751
|
+
interface AddDomainWithTlsOptions extends Omit<AddDomainWithAutoTlsOptions, "domain"> {
|
|
752
|
+
domain: Domain;
|
|
753
|
+
certFile: string;
|
|
754
|
+
keyFile: string;
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Options for updating a domain
|
|
758
|
+
*/
|
|
759
|
+
interface UpdateDomainOptions {
|
|
760
|
+
domain: Domain;
|
|
761
|
+
target?: string;
|
|
762
|
+
targetPort?: number;
|
|
763
|
+
enableSecurityHeaders?: boolean;
|
|
764
|
+
enableHsts?: boolean;
|
|
765
|
+
hstsMaxAge?: number;
|
|
766
|
+
frameOptions?: FrameOptions;
|
|
767
|
+
enableCompression?: boolean;
|
|
768
|
+
redirectMode?: RedirectMode;
|
|
769
|
+
redirectStatusCode?: RedirectStatusCode;
|
|
770
|
+
adminUrl?: string;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Options for deleting a domain
|
|
774
|
+
*/
|
|
775
|
+
interface DeleteDomainOptions {
|
|
776
|
+
domain: Domain;
|
|
777
|
+
adminUrl?: string;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Domain configuration
|
|
781
|
+
*/
|
|
782
|
+
interface DomainConfig {
|
|
783
|
+
domain: Domain;
|
|
784
|
+
target: string;
|
|
785
|
+
targetPort: number;
|
|
786
|
+
tlsEnabled: boolean;
|
|
787
|
+
autoTls: boolean;
|
|
788
|
+
certFile?: string;
|
|
789
|
+
keyFile?: string;
|
|
790
|
+
securityHeaders: SecurityHeaders;
|
|
791
|
+
redirectMode: RedirectMode;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Options for building service routes
|
|
795
|
+
*/
|
|
796
|
+
interface ServiceRouteOptions {
|
|
797
|
+
/**
|
|
798
|
+
* Host for host-based route
|
|
799
|
+
*/
|
|
800
|
+
host?: string;
|
|
801
|
+
/**
|
|
802
|
+
* Path for path-based route
|
|
803
|
+
*/
|
|
804
|
+
path?: string;
|
|
805
|
+
/**
|
|
806
|
+
* Host for path-based route
|
|
807
|
+
* @default "asd.localhost"
|
|
808
|
+
*/
|
|
809
|
+
pathRouteHost?: string;
|
|
810
|
+
/**
|
|
811
|
+
* Dial address (host:port)
|
|
812
|
+
*/
|
|
813
|
+
dial: DialAddress;
|
|
814
|
+
/**
|
|
815
|
+
* Service identifier for health checks
|
|
816
|
+
*/
|
|
817
|
+
serviceId?: string;
|
|
818
|
+
/**
|
|
819
|
+
* Enable host-based route
|
|
820
|
+
* @default true
|
|
821
|
+
*/
|
|
822
|
+
enableHostRoute?: boolean;
|
|
823
|
+
/**
|
|
824
|
+
* Enable path-based route
|
|
825
|
+
* @default true
|
|
826
|
+
*/
|
|
827
|
+
enablePathRoute?: boolean;
|
|
828
|
+
/**
|
|
829
|
+
* Strip path prefix
|
|
830
|
+
* @default true
|
|
831
|
+
*/
|
|
832
|
+
stripPrefix?: boolean;
|
|
833
|
+
/**
|
|
834
|
+
* Route priority (higher = matches first)
|
|
835
|
+
* @default 50
|
|
836
|
+
*/
|
|
837
|
+
priority?: number;
|
|
838
|
+
/**
|
|
839
|
+
* Security headers configuration
|
|
840
|
+
*/
|
|
841
|
+
securityHeaders?: SecurityHeaders;
|
|
842
|
+
/**
|
|
843
|
+
* Basic authentication configuration
|
|
844
|
+
*/
|
|
845
|
+
basicAuth?: BasicAuthOptions;
|
|
846
|
+
/**
|
|
847
|
+
* Ingress tag value for X-ASD-Ingress header
|
|
848
|
+
* Set to null to explicitly disable
|
|
849
|
+
*/
|
|
850
|
+
ingressTag?: string | null;
|
|
851
|
+
/**
|
|
852
|
+
* Origin for iframe embedding headers (CORS + CSP)
|
|
853
|
+
* Set to null to explicitly disable
|
|
854
|
+
*/
|
|
855
|
+
iframeOrigin?: string | null;
|
|
856
|
+
/**
|
|
857
|
+
* Response headers to delete from reverse proxy response
|
|
858
|
+
* (e.g., ["Content-Security-Policy"] for iframe support)
|
|
859
|
+
*/
|
|
860
|
+
deleteResponseHeaders?: string[];
|
|
861
|
+
/**
|
|
862
|
+
* Service type for X-ASD-Service-Type header
|
|
863
|
+
*/
|
|
864
|
+
serviceType?: string;
|
|
865
|
+
/**
|
|
866
|
+
* Whether this is a tunnel domain route
|
|
867
|
+
* Used for selective auth (tunnel vs host route type)
|
|
868
|
+
*/
|
|
869
|
+
isTunnelDomain?: boolean;
|
|
870
|
+
/**
|
|
871
|
+
* Flush interval for reverse proxy streaming support.
|
|
872
|
+
* Set to -1 to disable buffering (required for WebSocket/SSE).
|
|
873
|
+
*/
|
|
874
|
+
flushInterval?: number;
|
|
875
|
+
/**
|
|
876
|
+
* Project identifier for X-ASD-Project header.
|
|
877
|
+
* Used to identify which project's Caddy handled the request.
|
|
878
|
+
*/
|
|
879
|
+
projectId?: string | null;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Basic authentication account
|
|
883
|
+
*/
|
|
884
|
+
interface BasicAuthAccount {
|
|
885
|
+
username: string;
|
|
886
|
+
password: string;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Basic authentication options
|
|
890
|
+
* Supports single account (legacy) or multiple accounts
|
|
891
|
+
*/
|
|
892
|
+
interface BasicAuthOptions {
|
|
893
|
+
enabled: boolean;
|
|
894
|
+
/** Single username (legacy - use accounts instead) */
|
|
895
|
+
username?: string;
|
|
896
|
+
/** Single password hash (legacy - use accounts instead) */
|
|
897
|
+
passwordHash?: string;
|
|
898
|
+
/** Multiple accounts (recommended) */
|
|
899
|
+
accounts?: BasicAuthAccount[];
|
|
900
|
+
/** Authentication realm */
|
|
901
|
+
realm?: string;
|
|
902
|
+
/** Hash algorithm (default: bcrypt) */
|
|
903
|
+
hash?: {
|
|
904
|
+
algorithm?: "bcrypt";
|
|
905
|
+
cost?: number;
|
|
906
|
+
};
|
|
907
|
+
/** Which route types should have auth applied (default: all) */
|
|
908
|
+
routes?: ("host" | "path" | "tunnel")[];
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Options for building health check route
|
|
912
|
+
*/
|
|
913
|
+
interface HealthCheckRouteOptions {
|
|
914
|
+
host: string;
|
|
915
|
+
serviceId: string;
|
|
916
|
+
priority?: number;
|
|
917
|
+
/** Ingress tag value for X-ASD-Ingress header */
|
|
918
|
+
ingressTag?: string | null;
|
|
919
|
+
/** Upstream dial address. When set, health check uses reverse_proxy instead of static_response */
|
|
920
|
+
dial?: string;
|
|
921
|
+
/** Project identifier for X-ASD-Project header */
|
|
922
|
+
projectId?: string | null;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* Options for building host route
|
|
926
|
+
*/
|
|
927
|
+
interface HostRouteOptions {
|
|
928
|
+
host: string;
|
|
929
|
+
dial: DialAddress;
|
|
930
|
+
securityHeaders?: SecurityHeaders;
|
|
931
|
+
basicAuth?: BasicAuthOptions;
|
|
932
|
+
priority?: number;
|
|
933
|
+
/** Ingress tag value for X-ASD-Ingress header */
|
|
934
|
+
ingressTag?: string | null;
|
|
935
|
+
/** Origin for iframe embedding headers */
|
|
936
|
+
iframeOrigin?: string | null;
|
|
937
|
+
/** Response headers to delete from reverse proxy */
|
|
938
|
+
deleteResponseHeaders?: string[];
|
|
939
|
+
/** Service ID for X-ASD-Service-ID header */
|
|
940
|
+
serviceId?: string;
|
|
941
|
+
/** Service type for X-ASD-Service-Type header */
|
|
942
|
+
serviceType?: string;
|
|
943
|
+
/** Flush interval for reverse proxy streaming (-1 disables buffering) */
|
|
944
|
+
flushInterval?: number;
|
|
945
|
+
/** Project identifier for X-ASD-Project header */
|
|
946
|
+
projectId?: string | null;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Options for building path route
|
|
950
|
+
*/
|
|
951
|
+
interface PathRouteOptions {
|
|
952
|
+
path: string;
|
|
953
|
+
host: string;
|
|
954
|
+
dial: DialAddress;
|
|
955
|
+
stripPrefix?: boolean;
|
|
956
|
+
securityHeaders?: SecurityHeaders;
|
|
957
|
+
basicAuth?: BasicAuthOptions;
|
|
958
|
+
priority?: number;
|
|
959
|
+
/** Ingress tag value for X-ASD-Ingress header */
|
|
960
|
+
ingressTag?: string | null;
|
|
961
|
+
/** Origin for iframe embedding headers */
|
|
962
|
+
iframeOrigin?: string | null;
|
|
963
|
+
/** Response headers to delete from reverse proxy */
|
|
964
|
+
deleteResponseHeaders?: string[];
|
|
965
|
+
/** Service ID for X-ASD-Service-ID header */
|
|
966
|
+
serviceId?: string;
|
|
967
|
+
/** Service type for X-ASD-Service-Type header */
|
|
968
|
+
serviceType?: string;
|
|
969
|
+
/** Flush interval for reverse proxy streaming (-1 disables buffering) */
|
|
970
|
+
flushInterval?: number;
|
|
971
|
+
/** Project identifier for X-ASD-Project header */
|
|
972
|
+
projectId?: string | null;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Options for building load balancer route
|
|
976
|
+
*/
|
|
977
|
+
interface LoadBalancerRouteOptions {
|
|
978
|
+
host: string;
|
|
979
|
+
upstreams: DialAddress[];
|
|
980
|
+
healthCheckPath?: string;
|
|
981
|
+
healthCheckInterval?: string;
|
|
982
|
+
policy?: "first" | "random" | "least_conn" | "round_robin";
|
|
983
|
+
priority?: number;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Options for starting mitmweb
|
|
987
|
+
*/
|
|
988
|
+
interface MitmwebOptions {
|
|
989
|
+
/**
|
|
990
|
+
* Port for mitmweb UI
|
|
991
|
+
* @default 8081
|
|
992
|
+
*/
|
|
993
|
+
webPort?: number;
|
|
994
|
+
/**
|
|
995
|
+
* Port for proxy
|
|
996
|
+
* @default 8080
|
|
997
|
+
*/
|
|
998
|
+
proxyPort?: number;
|
|
999
|
+
/**
|
|
1000
|
+
* Listen address
|
|
1001
|
+
* @default "127.0.0.1"
|
|
1002
|
+
*/
|
|
1003
|
+
listenAddress?: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* Auto-open browser
|
|
1006
|
+
* @default true
|
|
1007
|
+
*/
|
|
1008
|
+
openBrowser?: boolean;
|
|
1009
|
+
/**
|
|
1010
|
+
* Custom Python addon scripts
|
|
1011
|
+
*/
|
|
1012
|
+
scripts?: string[];
|
|
1013
|
+
/**
|
|
1014
|
+
* Working directory for mitmproxy
|
|
1015
|
+
*/
|
|
1016
|
+
workingDir?: string;
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Mitmweb status
|
|
1020
|
+
*/
|
|
1021
|
+
interface MitmwebStatus {
|
|
1022
|
+
running: boolean;
|
|
1023
|
+
pid?: number;
|
|
1024
|
+
webUrl?: string;
|
|
1025
|
+
proxyUrl?: string;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Upstream server status from /reverse_proxy/upstreams endpoint
|
|
1029
|
+
*/
|
|
1030
|
+
interface UpstreamStatus {
|
|
1031
|
+
/** Upstream address (host:port) */
|
|
1032
|
+
address: string;
|
|
1033
|
+
/** Number of active requests */
|
|
1034
|
+
num_requests: number;
|
|
1035
|
+
/** Number of failed health checks */
|
|
1036
|
+
fails: number;
|
|
1037
|
+
/** Whether the upstream is currently healthy */
|
|
1038
|
+
healthy: boolean;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
export type { TlsConnectionPolicy as $, AddDomainWithAutoTlsOptions as A, BasicAuthOptions as B, CaddyClientOptions as C, DeleteDomainOptions as D, EncodeHandler as E, FileServerHandler as F, GenericHandler as G, HeadersHandler as H, IdentityStore as I, ReverseProxyHandler as J, RewriteHandler as K, LdapIdentityStore as L, MapHandler as M, SecurityAuthenticatorHandler as N, OAuth2IdentityProvider as O, PathRouteOptions as P, SecurityAuthorizationHandler as Q, RedirectStatusCode as R, SecurityApp as S, SecurityAuthorizerProvider as T, SecurityConfig as U, SecurityHandler as V, SecurityHeaders as W, ServiceRouteOptions as X, StaticResponseHandler as Y, SubrouteHandler as Z, TemplatesHandler as _, AddDomainWithTlsOptions as a, TracingHandler as a0, UpdateDomainOptions as a1, UpstreamStatus as a2, VarsHandler as a3, AuthenticationHandler as b, AuthenticationPortal as c, AuthorizationPolicy as d, CaddyRoute as e, CaddyRouteHandler as f, CaddyRouteMatcher as g, CopyResponseHandler as h, CopyResponseHeadersHandler as i, DialAddress as j, Domain as k, DomainConfig as l, ErrorHandler as m, HealthCheckRouteOptions as n, HostRouteOptions as o, HttpMethod as p, InterceptHandler as q, InvokeHandler as r, LoadBalancerRouteOptions as s, LocalIdentityStore as t, LogAppendHandler as u, MitmwebOptions as v, MitmwebStatus as w, OidcIdentityProvider as x, PushHandler as y, RequestBodyHandler as z };
|