mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-04 02:42:34 +02:00
fix schemas
This commit is contained in:
parent
1a83c739d4
commit
fe2437a691
18 changed files with 2562 additions and 1966 deletions
23
Makefile
23
Makefile
|
@ -72,11 +72,26 @@ build-docker:
|
||||||
docker build -t godoxy-nightly \
|
docker build -t godoxy-nightly \
|
||||||
--build-arg VERSION="${VERSION}-nightly-${BUILD_DATE}" .
|
--build-arg VERSION="${VERSION}-nightly-${BUILD_DATE}" .
|
||||||
|
|
||||||
|
gen-schema-single:
|
||||||
|
typescript-json-schema --noExtraProps --required --skipLibCheck --tsNodeRegister=true -o schemas/${OUT} schemas/${IN} ${CLASS}
|
||||||
|
|
||||||
gen-schema:
|
gen-schema:
|
||||||
typescript-json-schema --required --constAsEnum --tsNodeRegister=true -o schemas/config.schema.json schemas/config/config.ts Config
|
make IN=config/config.ts \
|
||||||
typescript-json-schema --required --constAsEnum --tsNodeRegister=true -o schemas/routes.schema.json schemas/providers/routes.ts Routes
|
CLASS=Config \
|
||||||
typescript-json-schema --required --constAsEnum --tsNodeRegister=true -o schemas/middleware_compose.schema.json schemas/middlewares/middleware_compose.ts MiddlewareComposeConfig
|
OUT=config.schema.json \
|
||||||
# typescript-json-schema --required --constAsEnum --tsNodeRegister=true -o schemas/docker_routes.schema.json schemas/docker.ts DockerRoutes
|
gen-schema-single
|
||||||
|
make IN=providers/routes.ts \
|
||||||
|
CLASS=Routes \
|
||||||
|
OUT=routes.schema.json \
|
||||||
|
gen-schema-single
|
||||||
|
make IN=middlewares/middleware_compose.ts \
|
||||||
|
CLASS=MiddlewareCompose \
|
||||||
|
OUT=middleware_compose.schema.json \
|
||||||
|
gen-schema-single
|
||||||
|
make IN=docker.ts \
|
||||||
|
CLASS=DockerRoutes \
|
||||||
|
OUT=docker_routes.schema.json \
|
||||||
|
gen-schema-single
|
||||||
|
|
||||||
push-github:
|
push-github:
|
||||||
git push origin $(shell git rev-parse --abbrev-ref HEAD)
|
git push origin $(shell git rev-parse --abbrev-ref HEAD)
|
File diff suppressed because it is too large
Load diff
|
@ -4,9 +4,6 @@ export const ACCESS_LOG_FORMATS = ["combined", "common", "json"] as const;
|
||||||
|
|
||||||
export type AccessLogFormat = (typeof ACCESS_LOG_FORMATS)[number];
|
export type AccessLogFormat = (typeof ACCESS_LOG_FORMATS)[number];
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type AccessLogConfig = {
|
export type AccessLogConfig = {
|
||||||
/**
|
/**
|
||||||
* The size of the buffer.
|
* The size of the buffer.
|
||||||
|
|
|
@ -11,6 +11,7 @@ export const AUTOCERT_PROVIDERS = [
|
||||||
export type AutocertProvider = (typeof AUTOCERT_PROVIDERS)[number];
|
export type AutocertProvider = (typeof AUTOCERT_PROVIDERS)[number];
|
||||||
|
|
||||||
export type AutocertConfig =
|
export type AutocertConfig =
|
||||||
|
| LocalOptions
|
||||||
| CloudflareOptions
|
| CloudflareOptions
|
||||||
| CloudDNSOptions
|
| CloudDNSOptions
|
||||||
| DuckDNSOptions
|
| DuckDNSOptions
|
||||||
|
@ -28,32 +29,25 @@ export interface AutocertConfigBase {
|
||||||
key_path?: string;
|
key_path?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
export interface LocalOptions extends AutocertConfigBase {
|
||||||
* @additionalProperties false
|
provider: "local";
|
||||||
*/
|
}
|
||||||
|
|
||||||
export interface CloudflareOptions extends AutocertConfigBase {
|
export interface CloudflareOptions extends AutocertConfigBase {
|
||||||
provider: "cloudflare";
|
provider: "cloudflare";
|
||||||
options: { auth_token: string };
|
options: { auth_token: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export interface CloudDNSOptions extends AutocertConfigBase {
|
export interface CloudDNSOptions extends AutocertConfigBase {
|
||||||
provider: "clouddns";
|
provider: "clouddns";
|
||||||
options: {
|
options: {
|
||||||
client_id: string;
|
client_id: string;
|
||||||
/**
|
|
||||||
* @format email
|
|
||||||
*/
|
|
||||||
email: Email;
|
email: Email;
|
||||||
password: string;
|
password: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export interface DuckDNSOptions extends AutocertConfigBase {
|
export interface DuckDNSOptions extends AutocertConfigBase {
|
||||||
provider: "duckdns";
|
provider: "duckdns";
|
||||||
options: {
|
options: {
|
||||||
|
@ -73,9 +67,6 @@ export const OVH_ENDPOINTS = [
|
||||||
|
|
||||||
export type OVHEndpoint = (typeof OVH_ENDPOINTS)[number];
|
export type OVHEndpoint = (typeof OVH_ENDPOINTS)[number];
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export interface OVHOptionsWithAppKey extends AutocertConfigBase {
|
export interface OVHOptionsWithAppKey extends AutocertConfigBase {
|
||||||
provider: "ovh";
|
provider: "ovh";
|
||||||
options: {
|
options: {
|
||||||
|
@ -86,9 +77,6 @@ export interface OVHOptionsWithAppKey extends AutocertConfigBase {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export interface OVHOptionsWithOAuth2Config extends AutocertConfigBase {
|
export interface OVHOptionsWithOAuth2Config extends AutocertConfigBase {
|
||||||
provider: "ovh";
|
provider: "ovh";
|
||||||
options: {
|
options: {
|
||||||
|
|
|
@ -4,9 +4,6 @@ import { EntrypointConfig } from "./entrypoint";
|
||||||
import { HomepageConfig } from "./homepage";
|
import { HomepageConfig } from "./homepage";
|
||||||
import { Providers } from "./providers";
|
import { Providers } from "./providers";
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type Config = {
|
export type Config = {
|
||||||
/** Optional autocert configuration
|
/** Optional autocert configuration
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
import { MiddlewareComposeConfig } from "../middlewares/middleware_compose";
|
import { MiddlewareCompose } from "../middlewares/middleware_compose";
|
||||||
import { AccessLogConfig } from "./access_log";
|
import { AccessLogConfig } from "./access_log";
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type EntrypointConfig = {
|
export type EntrypointConfig = {
|
||||||
/** Entrypoint middleware configuration
|
/** Entrypoint middleware configuration
|
||||||
*
|
*
|
||||||
* @examples require(".").middlewaresExamples
|
* @examples require(".").middlewaresExamples
|
||||||
*/
|
*/
|
||||||
middlewares: MiddlewareComposeConfig;
|
middlewares: MiddlewareCompose;
|
||||||
/** Entrypoint access log configuration
|
/** Entrypoint access log configuration
|
||||||
*
|
*
|
||||||
* @examples require(".").accessLogExamples
|
* @examples require(".").accessLogExamples
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type HomepageConfig = {
|
export type HomepageConfig = {
|
||||||
/**
|
/**
|
||||||
* Use default app categories (uses docker image name)
|
* Use default app categories (uses docker image name)
|
||||||
|
|
|
@ -5,19 +5,12 @@ export const NOTIFICATION_PROVIDERS = ["webhook", "gotify"] as const;
|
||||||
export type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];
|
export type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];
|
||||||
|
|
||||||
export type NotificationConfig = {
|
export type NotificationConfig = {
|
||||||
/**
|
/* Name of the notification provider */
|
||||||
* Name of the notification provider
|
|
||||||
*/
|
|
||||||
name: string;
|
name: string;
|
||||||
/**
|
/* URL of the notification provider */
|
||||||
* URL of the notification provider
|
|
||||||
*/
|
|
||||||
url: URL;
|
url: URL;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export interface GotifyConfig extends NotificationConfig {
|
export interface GotifyConfig extends NotificationConfig {
|
||||||
provider: "gotify";
|
provider: "gotify";
|
||||||
/* Gotify token */
|
/* Gotify token */
|
||||||
|
@ -38,9 +31,6 @@ export type WebhookMethod = (typeof WEBHOOK_METHODS)[number];
|
||||||
export type WebhookMimeType = (typeof WEBHOOK_MIME_TYPES)[number];
|
export type WebhookMimeType = (typeof WEBHOOK_MIME_TYPES)[number];
|
||||||
export type WebhookColorMode = (typeof WEBHOOK_COLOR_MODES)[number];
|
export type WebhookColorMode = (typeof WEBHOOK_COLOR_MODES)[number];
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export interface WebhookConfig extends NotificationConfig {
|
export interface WebhookConfig extends NotificationConfig {
|
||||||
provider: "webhook";
|
provider: "webhook";
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import { URI, URL } from "../types";
|
import { URI, URL } from "../types";
|
||||||
import { GotifyConfig, WebhookConfig } from "./notification";
|
import { GotifyConfig, WebhookConfig } from "./notification";
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type Providers = {
|
export type Providers = {
|
||||||
/** List of route definition files to include
|
/** List of route definition files to include
|
||||||
*
|
*
|
||||||
|
|
1198
schemas/docker_routes.schema.json
Normal file
1198
schemas/docker_routes.schema.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
"additionalProperties": false,
|
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"CIDR": {
|
"CIDR": {
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
|
@ -30,126 +29,320 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Partial<CIDRWhitelist>": {
|
"MiddlewareComposeMap": {
|
||||||
"properties": {
|
"anyOf": [
|
||||||
"allow": {
|
{
|
||||||
"items": {
|
"additionalProperties": false,
|
||||||
"$ref": "#/definitions/CIDR"
|
"properties": {
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"CustomErrorPage",
|
||||||
|
"ErrorPage",
|
||||||
|
"customErrorPage",
|
||||||
|
"custom_error_page",
|
||||||
|
"errorPage",
|
||||||
|
"error_page"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"type": "array"
|
"required": [
|
||||||
},
|
"use"
|
||||||
"message": {
|
],
|
||||||
"default": "IP not allowed",
|
|
||||||
"description": "Error message when blocked",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status_code": {
|
|
||||||
"$ref": "#/definitions/StatusCode",
|
|
||||||
"default": 403,
|
|
||||||
"description": "HTTP status code when blocked"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"Partial<CloudflareRealIP>": {
|
|
||||||
"properties": {
|
|
||||||
"recursive": {
|
|
||||||
"default": false,
|
|
||||||
"description": "Recursively resolve the IP",
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"Partial<ModifyRequest>": {
|
|
||||||
"properties": {
|
|
||||||
"add_headers": {
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"description": "Add HTTP headers",
|
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"hide_headers": {
|
{
|
||||||
"description": "Hide HTTP headers",
|
"additionalProperties": false,
|
||||||
"items": {
|
"properties": {
|
||||||
"type": "string"
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"RedirectHTTP",
|
||||||
|
"redirectHTTP",
|
||||||
|
"redirect_http"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"type": "array"
|
"required": [
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
},
|
},
|
||||||
"set_headers": {
|
{
|
||||||
"additionalProperties": {
|
"additionalProperties": false,
|
||||||
"type": "string"
|
"properties": {
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"SetXForwarded",
|
||||||
|
"setXForwarded",
|
||||||
|
"set_x_forwarded"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"description": "Set HTTP headers",
|
"required": [
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"HideXForwarded",
|
||||||
|
"hideXForwarded",
|
||||||
|
"hide_x_forwarded"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"allow": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/CIDR"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"default": "IP not allowed",
|
||||||
|
"description": "Error message when blocked",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"$ref": "#/definitions/StatusCode",
|
||||||
|
"default": 403,
|
||||||
|
"description": "HTTP status code when blocked (alias of status_code)"
|
||||||
|
},
|
||||||
|
"status_code": {
|
||||||
|
"$ref": "#/definitions/StatusCode",
|
||||||
|
"default": 403,
|
||||||
|
"description": "HTTP status code when blocked"
|
||||||
|
},
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"CIDRWhitelist",
|
||||||
|
"cidrWhitelist",
|
||||||
|
"cidr_whitelist"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"allow",
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"recursive": {
|
||||||
|
"default": false,
|
||||||
|
"description": "Recursively resolve the IP",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"cloudflareRealIp",
|
||||||
|
"cloudflare_real_ip"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"add_headers": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "Add HTTP headers",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"hide_headers": {
|
||||||
|
"description": "Hide HTTP headers",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"set_headers": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "Set HTTP headers",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"ModifyRequest",
|
||||||
|
"Request",
|
||||||
|
"modifyRequest",
|
||||||
|
"modify_request",
|
||||||
|
"request"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"add_headers": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "Add HTTP headers",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"hide_headers": {
|
||||||
|
"description": "Hide HTTP headers",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"set_headers": {
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "Set HTTP headers",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"ModifyResponse",
|
||||||
|
"Response",
|
||||||
|
"modifyResponse",
|
||||||
|
"modify_response",
|
||||||
|
"response"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"allowed_groups": {
|
||||||
|
"description": "Allowed groups",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"minItems": 1,
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"allowed_users": {
|
||||||
|
"description": "Allowed users",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"minItems": 1,
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"OIDC",
|
||||||
|
"oidc"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"average": {
|
||||||
|
"description": "Average number of requests allowed in a period",
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"burst": {
|
||||||
|
"description": "Maximum number of requests allowed in a period",
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"period": {
|
||||||
|
"default": "1s",
|
||||||
|
"description": "Duration of the rate limit",
|
||||||
|
"pattern": "^([0-9]+(ms|s|m|h))+$",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"RateLimit",
|
||||||
|
"rateLimit",
|
||||||
|
"rate_limit"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"average",
|
||||||
|
"burst",
|
||||||
|
"use"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"from": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/CIDR"
|
||||||
|
},
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"header": {
|
||||||
|
"default": "X-Real-IP",
|
||||||
|
"description": "Header to get the client IP from",
|
||||||
|
"pattern": "^[a-zA-Z0-9\\-]+$",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"recursive": {
|
||||||
|
"default": false,
|
||||||
|
"description": "Recursive resolve the IP",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"use": {
|
||||||
|
"enum": [
|
||||||
|
"RealIP",
|
||||||
|
"realIP",
|
||||||
|
"real_ip"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"from",
|
||||||
|
"use"
|
||||||
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
}
|
}
|
||||||
},
|
]
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"Partial<Null>": {
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"Partial<OIDC>": {
|
|
||||||
"properties": {
|
|
||||||
"allowed_groups": {
|
|
||||||
"description": "Allowed groups",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"minItems": 1,
|
|
||||||
"type": "array"
|
|
||||||
},
|
|
||||||
"allowed_users": {
|
|
||||||
"description": "Allowed users",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"minItems": 1,
|
|
||||||
"type": "array"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"Partial<RateLimit>": {
|
|
||||||
"properties": {
|
|
||||||
"average": {
|
|
||||||
"description": "Average number of requests allowed in a period",
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"burst": {
|
|
||||||
"description": "Maximum number of requests allowed in a period",
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"period": {
|
|
||||||
"default": "1s",
|
|
||||||
"description": "Duration of the rate limit",
|
|
||||||
"pattern": "^([0-9]+(ms|s|m|h))+$",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"Partial<RealIP>": {
|
|
||||||
"properties": {
|
|
||||||
"from": {
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/CIDR"
|
|
||||||
},
|
|
||||||
"type": "array"
|
|
||||||
},
|
|
||||||
"header": {
|
|
||||||
"description": "Header to get the client IP from",
|
|
||||||
"pattern": "^[a-zA-Z0-9\\-]+$",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"recursive": {
|
|
||||||
"default": false,
|
|
||||||
"description": "Recursive resolve the IP",
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
},
|
||||||
"StatusCode": {
|
"StatusCode": {
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
|
@ -164,414 +357,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"items": {
|
"items": {
|
||||||
"anyOf": [
|
"$ref": "#/definitions/MiddlewareComposeMap"
|
||||||
{
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"properties": {
|
|
||||||
"use": {
|
|
||||||
"enum": [
|
|
||||||
"CIDRWhitelist",
|
|
||||||
"CloudflareRealIP",
|
|
||||||
"CustomErrorPage",
|
|
||||||
"HideXForwarded",
|
|
||||||
"ModifyRequest",
|
|
||||||
"ModifyResponse",
|
|
||||||
"OIDC",
|
|
||||||
"RateLimit",
|
|
||||||
"RealIP",
|
|
||||||
"RedirectHTTP",
|
|
||||||
"Request",
|
|
||||||
"Response",
|
|
||||||
"SetXForwarded",
|
|
||||||
"cidrWhitelist",
|
|
||||||
"cidr_whitelist",
|
|
||||||
"cloudflareRealIP",
|
|
||||||
"cloudflare_real_ip",
|
|
||||||
"customErrorPage",
|
|
||||||
"custom_error_page",
|
|
||||||
"errorPage",
|
|
||||||
"error_page",
|
|
||||||
"hideXForwarded",
|
|
||||||
"hide_x_forwarded",
|
|
||||||
"modifyRequest",
|
|
||||||
"modifyResponse",
|
|
||||||
"modify_request",
|
|
||||||
"modify_response",
|
|
||||||
"oidc",
|
|
||||||
"rateLimit",
|
|
||||||
"rate_limit",
|
|
||||||
"realIP",
|
|
||||||
"real_ip",
|
|
||||||
"redirectHTTP",
|
|
||||||
"redirect_http",
|
|
||||||
"request",
|
|
||||||
"response",
|
|
||||||
"setXForwarded",
|
|
||||||
"set_x_forwarded"
|
|
||||||
],
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"use"
|
|
||||||
],
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/Partial<Null>"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"properties": {
|
|
||||||
"use": {
|
|
||||||
"enum": [
|
|
||||||
"CIDRWhitelist",
|
|
||||||
"CloudflareRealIP",
|
|
||||||
"CustomErrorPage",
|
|
||||||
"HideXForwarded",
|
|
||||||
"ModifyRequest",
|
|
||||||
"ModifyResponse",
|
|
||||||
"OIDC",
|
|
||||||
"RateLimit",
|
|
||||||
"RealIP",
|
|
||||||
"RedirectHTTP",
|
|
||||||
"Request",
|
|
||||||
"Response",
|
|
||||||
"SetXForwarded",
|
|
||||||
"cidrWhitelist",
|
|
||||||
"cidr_whitelist",
|
|
||||||
"cloudflareRealIP",
|
|
||||||
"cloudflare_real_ip",
|
|
||||||
"customErrorPage",
|
|
||||||
"custom_error_page",
|
|
||||||
"errorPage",
|
|
||||||
"error_page",
|
|
||||||
"hideXForwarded",
|
|
||||||
"hide_x_forwarded",
|
|
||||||
"modifyRequest",
|
|
||||||
"modifyResponse",
|
|
||||||
"modify_request",
|
|
||||||
"modify_response",
|
|
||||||
"oidc",
|
|
||||||
"rateLimit",
|
|
||||||
"rate_limit",
|
|
||||||
"realIP",
|
|
||||||
"real_ip",
|
|
||||||
"redirectHTTP",
|
|
||||||
"redirect_http",
|
|
||||||
"request",
|
|
||||||
"response",
|
|
||||||
"setXForwarded",
|
|
||||||
"set_x_forwarded"
|
|
||||||
],
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"use"
|
|
||||||
],
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/Partial<OIDC>"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"properties": {
|
|
||||||
"use": {
|
|
||||||
"enum": [
|
|
||||||
"CIDRWhitelist",
|
|
||||||
"CloudflareRealIP",
|
|
||||||
"CustomErrorPage",
|
|
||||||
"HideXForwarded",
|
|
||||||
"ModifyRequest",
|
|
||||||
"ModifyResponse",
|
|
||||||
"OIDC",
|
|
||||||
"RateLimit",
|
|
||||||
"RealIP",
|
|
||||||
"RedirectHTTP",
|
|
||||||
"Request",
|
|
||||||
"Response",
|
|
||||||
"SetXForwarded",
|
|
||||||
"cidrWhitelist",
|
|
||||||
"cidr_whitelist",
|
|
||||||
"cloudflareRealIP",
|
|
||||||
"cloudflare_real_ip",
|
|
||||||
"customErrorPage",
|
|
||||||
"custom_error_page",
|
|
||||||
"errorPage",
|
|
||||||
"error_page",
|
|
||||||
"hideXForwarded",
|
|
||||||
"hide_x_forwarded",
|
|
||||||
"modifyRequest",
|
|
||||||
"modifyResponse",
|
|
||||||
"modify_request",
|
|
||||||
"modify_response",
|
|
||||||
"oidc",
|
|
||||||
"rateLimit",
|
|
||||||
"rate_limit",
|
|
||||||
"realIP",
|
|
||||||
"real_ip",
|
|
||||||
"redirectHTTP",
|
|
||||||
"redirect_http",
|
|
||||||
"request",
|
|
||||||
"response",
|
|
||||||
"setXForwarded",
|
|
||||||
"set_x_forwarded"
|
|
||||||
],
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"use"
|
|
||||||
],
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/Partial<ModifyRequest>"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"properties": {
|
|
||||||
"use": {
|
|
||||||
"enum": [
|
|
||||||
"CIDRWhitelist",
|
|
||||||
"CloudflareRealIP",
|
|
||||||
"CustomErrorPage",
|
|
||||||
"HideXForwarded",
|
|
||||||
"ModifyRequest",
|
|
||||||
"ModifyResponse",
|
|
||||||
"OIDC",
|
|
||||||
"RateLimit",
|
|
||||||
"RealIP",
|
|
||||||
"RedirectHTTP",
|
|
||||||
"Request",
|
|
||||||
"Response",
|
|
||||||
"SetXForwarded",
|
|
||||||
"cidrWhitelist",
|
|
||||||
"cidr_whitelist",
|
|
||||||
"cloudflareRealIP",
|
|
||||||
"cloudflare_real_ip",
|
|
||||||
"customErrorPage",
|
|
||||||
"custom_error_page",
|
|
||||||
"errorPage",
|
|
||||||
"error_page",
|
|
||||||
"hideXForwarded",
|
|
||||||
"hide_x_forwarded",
|
|
||||||
"modifyRequest",
|
|
||||||
"modifyResponse",
|
|
||||||
"modify_request",
|
|
||||||
"modify_response",
|
|
||||||
"oidc",
|
|
||||||
"rateLimit",
|
|
||||||
"rate_limit",
|
|
||||||
"realIP",
|
|
||||||
"real_ip",
|
|
||||||
"redirectHTTP",
|
|
||||||
"redirect_http",
|
|
||||||
"request",
|
|
||||||
"response",
|
|
||||||
"setXForwarded",
|
|
||||||
"set_x_forwarded"
|
|
||||||
],
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"use"
|
|
||||||
],
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/Partial<RealIP>"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"properties": {
|
|
||||||
"use": {
|
|
||||||
"enum": [
|
|
||||||
"CIDRWhitelist",
|
|
||||||
"CloudflareRealIP",
|
|
||||||
"CustomErrorPage",
|
|
||||||
"HideXForwarded",
|
|
||||||
"ModifyRequest",
|
|
||||||
"ModifyResponse",
|
|
||||||
"OIDC",
|
|
||||||
"RateLimit",
|
|
||||||
"RealIP",
|
|
||||||
"RedirectHTTP",
|
|
||||||
"Request",
|
|
||||||
"Response",
|
|
||||||
"SetXForwarded",
|
|
||||||
"cidrWhitelist",
|
|
||||||
"cidr_whitelist",
|
|
||||||
"cloudflareRealIP",
|
|
||||||
"cloudflare_real_ip",
|
|
||||||
"customErrorPage",
|
|
||||||
"custom_error_page",
|
|
||||||
"errorPage",
|
|
||||||
"error_page",
|
|
||||||
"hideXForwarded",
|
|
||||||
"hide_x_forwarded",
|
|
||||||
"modifyRequest",
|
|
||||||
"modifyResponse",
|
|
||||||
"modify_request",
|
|
||||||
"modify_response",
|
|
||||||
"oidc",
|
|
||||||
"rateLimit",
|
|
||||||
"rate_limit",
|
|
||||||
"realIP",
|
|
||||||
"real_ip",
|
|
||||||
"redirectHTTP",
|
|
||||||
"redirect_http",
|
|
||||||
"request",
|
|
||||||
"response",
|
|
||||||
"setXForwarded",
|
|
||||||
"set_x_forwarded"
|
|
||||||
],
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"use"
|
|
||||||
],
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/Partial<CloudflareRealIP>"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"properties": {
|
|
||||||
"use": {
|
|
||||||
"enum": [
|
|
||||||
"CIDRWhitelist",
|
|
||||||
"CloudflareRealIP",
|
|
||||||
"CustomErrorPage",
|
|
||||||
"HideXForwarded",
|
|
||||||
"ModifyRequest",
|
|
||||||
"ModifyResponse",
|
|
||||||
"OIDC",
|
|
||||||
"RateLimit",
|
|
||||||
"RealIP",
|
|
||||||
"RedirectHTTP",
|
|
||||||
"Request",
|
|
||||||
"Response",
|
|
||||||
"SetXForwarded",
|
|
||||||
"cidrWhitelist",
|
|
||||||
"cidr_whitelist",
|
|
||||||
"cloudflareRealIP",
|
|
||||||
"cloudflare_real_ip",
|
|
||||||
"customErrorPage",
|
|
||||||
"custom_error_page",
|
|
||||||
"errorPage",
|
|
||||||
"error_page",
|
|
||||||
"hideXForwarded",
|
|
||||||
"hide_x_forwarded",
|
|
||||||
"modifyRequest",
|
|
||||||
"modifyResponse",
|
|
||||||
"modify_request",
|
|
||||||
"modify_response",
|
|
||||||
"oidc",
|
|
||||||
"rateLimit",
|
|
||||||
"rate_limit",
|
|
||||||
"realIP",
|
|
||||||
"real_ip",
|
|
||||||
"redirectHTTP",
|
|
||||||
"redirect_http",
|
|
||||||
"request",
|
|
||||||
"response",
|
|
||||||
"setXForwarded",
|
|
||||||
"set_x_forwarded"
|
|
||||||
],
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"use"
|
|
||||||
],
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/Partial<RateLimit>"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"allOf": [
|
|
||||||
{
|
|
||||||
"properties": {
|
|
||||||
"use": {
|
|
||||||
"enum": [
|
|
||||||
"CIDRWhitelist",
|
|
||||||
"CloudflareRealIP",
|
|
||||||
"CustomErrorPage",
|
|
||||||
"HideXForwarded",
|
|
||||||
"ModifyRequest",
|
|
||||||
"ModifyResponse",
|
|
||||||
"OIDC",
|
|
||||||
"RateLimit",
|
|
||||||
"RealIP",
|
|
||||||
"RedirectHTTP",
|
|
||||||
"Request",
|
|
||||||
"Response",
|
|
||||||
"SetXForwarded",
|
|
||||||
"cidrWhitelist",
|
|
||||||
"cidr_whitelist",
|
|
||||||
"cloudflareRealIP",
|
|
||||||
"cloudflare_real_ip",
|
|
||||||
"customErrorPage",
|
|
||||||
"custom_error_page",
|
|
||||||
"errorPage",
|
|
||||||
"error_page",
|
|
||||||
"hideXForwarded",
|
|
||||||
"hide_x_forwarded",
|
|
||||||
"modifyRequest",
|
|
||||||
"modifyResponse",
|
|
||||||
"modify_request",
|
|
||||||
"modify_response",
|
|
||||||
"oidc",
|
|
||||||
"rateLimit",
|
|
||||||
"rate_limit",
|
|
||||||
"realIP",
|
|
||||||
"real_ip",
|
|
||||||
"redirectHTTP",
|
|
||||||
"redirect_http",
|
|
||||||
"request",
|
|
||||||
"response",
|
|
||||||
"setXForwarded",
|
|
||||||
"set_x_forwarded"
|
|
||||||
],
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"use"
|
|
||||||
],
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "#/definitions/Partial<CIDRWhitelist>"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"type": "array"
|
"type": "array"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
import { MiddlewaresMap } from "./middlewares";
|
import { MiddlewareComposeMap } from "./middlewares";
|
||||||
|
|
||||||
export type MiddlewareComposeConfigBase = {
|
export type MiddlewareCompose = MiddlewareComposeMap[];
|
||||||
use: keyof MiddlewaresMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type MiddlewareComposeConfig = (MiddlewareComposeConfigBase &
|
|
||||||
Partial<MiddlewaresMap[keyof MiddlewaresMap]>)[];
|
|
|
@ -1,58 +1,57 @@
|
||||||
import * as types from "../types";
|
import * as types from "../types";
|
||||||
|
|
||||||
/**
|
export type MiddlewareComposeObjectRef = `${string}@file`;
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
export type KeyOptMapping<T extends { use: string }> = {
|
||||||
export type MiddlewaresMap = {
|
[key in T["use"]]: Omit<T, "use">;
|
||||||
redirect_http?: RedirectHTTP;
|
} | { use: MiddlewareComposeObjectRef };
|
||||||
redirectHTTP?: RedirectHTTP;
|
|
||||||
RedirectHTTP?: RedirectHTTP;
|
export type MiddlewaresMap = (
|
||||||
oidc?: types.Nullable<OIDC>;
|
| KeyOptMapping<CustomErrorPage>
|
||||||
OIDC?: types.Nullable<OIDC>;
|
| KeyOptMapping<RedirectHTTP>
|
||||||
request?: ModifyRequest;
|
| KeyOptMapping<SetXForwarded>
|
||||||
Request?: ModifyRequest;
|
| KeyOptMapping<HideXForwarded>
|
||||||
modify_request?: ModifyRequest;
|
| KeyOptMapping<CIDRWhitelist>
|
||||||
modifyRequest?: ModifyRequest;
|
| KeyOptMapping<CloudflareRealIP>
|
||||||
ModifyRequest?: ModifyRequest;
|
| KeyOptMapping<ModifyRequest>
|
||||||
response?: ModifyResponse;
|
| KeyOptMapping<ModifyResponse>
|
||||||
Response?: ModifyResponse;
|
| KeyOptMapping<OIDC>
|
||||||
modify_response?: ModifyResponse;
|
| KeyOptMapping<RateLimit>
|
||||||
modifyResponse?: ModifyResponse;
|
| KeyOptMapping<RealIP>
|
||||||
ModifyResponse?: ModifyResponse;
|
| { [key in MiddlewareComposeObjectRef]: types.NullOrEmptyMap }
|
||||||
set_x_forwarded?: SetXForwarded;
|
);
|
||||||
setXForwarded?: SetXForwarded;
|
|
||||||
SetXForwarded?: SetXForwarded;
|
export type MiddlewareComposeMap = (
|
||||||
hide_x_forwarded?: HideXForwarded;
|
| CustomErrorPage
|
||||||
hideXForwarded?: HideXForwarded;
|
| RedirectHTTP
|
||||||
HideXForwarded?: HideXForwarded;
|
| SetXForwarded
|
||||||
error_page?: CustomErrorPage;
|
| HideXForwarded
|
||||||
errorPage?: CustomErrorPage;
|
| CIDRWhitelist
|
||||||
custom_error_page?: CustomErrorPage;
|
| CloudflareRealIP
|
||||||
customErrorPage?: CustomErrorPage;
|
| ModifyRequest
|
||||||
CustomErrorPage?: CustomErrorPage;
|
| ModifyResponse
|
||||||
real_ip?: RealIP;
|
| OIDC
|
||||||
realIP?: RealIP;
|
| RateLimit
|
||||||
RealIP?: RealIP;
|
| RealIP
|
||||||
cloudflare_real_ip?: types.Nullable<CloudflareRealIP>;
|
);
|
||||||
cloudflareRealIP?: types.Nullable<CloudflareRealIP>;
|
|
||||||
CloudflareRealIP?: types.Nullable<CloudflareRealIP>;
|
export type CustomErrorPage = {
|
||||||
rate_limit?: RateLimit;
|
use: "error_page" | "errorPage" | "ErrorPage" | "custom_error_page" | "customErrorPage" | "CustomErrorPage";
|
||||||
rateLimit?: RateLimit;
|
|
||||||
RateLimit?: RateLimit;
|
|
||||||
cidr_whitelist?: CIDRWhitelist;
|
|
||||||
cidrWhitelist?: CIDRWhitelist;
|
|
||||||
CIDRWhitelist?: CIDRWhitelist;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CustomErrorPage = types.Null;
|
export type RedirectHTTP = {
|
||||||
export type RedirectHTTP = types.Null;
|
use: "redirect_http" | "redirectHTTP" | "RedirectHTTP";
|
||||||
export type SetXForwarded = types.Null;
|
};
|
||||||
export type HideXForwarded = types.Null;
|
|
||||||
|
export type SetXForwarded = {
|
||||||
|
use: "set_x_forwarded" | "setXForwarded" | "SetXForwarded";
|
||||||
|
};
|
||||||
|
export type HideXForwarded = {
|
||||||
|
use: "hide_x_forwarded" | "hideXForwarded" | "HideXForwarded";
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type CIDRWhitelist = {
|
export type CIDRWhitelist = {
|
||||||
|
use: "cidr_whitelist" | "cidrWhitelist" | "CIDRWhitelist";
|
||||||
/* Allowed CIDRs/IPs */
|
/* Allowed CIDRs/IPs */
|
||||||
allow: types.CIDR[];
|
allow: types.CIDR[];
|
||||||
/** HTTP status code when blocked
|
/** HTTP status code when blocked
|
||||||
|
@ -60,6 +59,11 @@ export type CIDRWhitelist = {
|
||||||
* @default 403
|
* @default 403
|
||||||
*/
|
*/
|
||||||
status_code?: types.StatusCode;
|
status_code?: types.StatusCode;
|
||||||
|
/** HTTP status code when blocked (alias of status_code)
|
||||||
|
*
|
||||||
|
* @default 403
|
||||||
|
*/
|
||||||
|
status?: types.StatusCode;
|
||||||
/** Error message when blocked
|
/** Error message when blocked
|
||||||
*
|
*
|
||||||
* @default "IP not allowed"
|
* @default "IP not allowed"
|
||||||
|
@ -67,10 +71,8 @@ export type CIDRWhitelist = {
|
||||||
message?: string;
|
message?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type CloudflareRealIP = {
|
export type CloudflareRealIP = {
|
||||||
|
use: "cloudflare_real_ip" | "cloudflareRealIp" | "cloudflare_real_ip";
|
||||||
/** Recursively resolve the IP
|
/** Recursively resolve the IP
|
||||||
*
|
*
|
||||||
* @default false
|
* @default false
|
||||||
|
@ -78,10 +80,8 @@ export type CloudflareRealIP = {
|
||||||
recursive?: boolean;
|
recursive?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type ModifyRequest = {
|
export type ModifyRequest = {
|
||||||
|
use: "request" | "Request" | "modify_request" | "modifyRequest" | "ModifyRequest";
|
||||||
/** Set HTTP headers */
|
/** Set HTTP headers */
|
||||||
set_headers?: { [key: types.HTTPHeader]: string };
|
set_headers?: { [key: types.HTTPHeader]: string };
|
||||||
/** Add HTTP headers */
|
/** Add HTTP headers */
|
||||||
|
@ -90,15 +90,18 @@ export type ModifyRequest = {
|
||||||
hide_headers?: types.HTTPHeader[];
|
hide_headers?: types.HTTPHeader[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
export type ModifyResponse = {
|
||||||
* @additionalProperties false
|
use: "response" | "Response" | "modify_response" | "modifyResponse" | "ModifyResponse";
|
||||||
*/
|
/** Set HTTP headers */
|
||||||
export type ModifyResponse = ModifyRequest;
|
set_headers?: { [key: types.HTTPHeader]: string };
|
||||||
|
/** Add HTTP headers */
|
||||||
|
add_headers?: { [key: types.HTTPHeader]: string };
|
||||||
|
/** Hide HTTP headers */
|
||||||
|
hide_headers?: types.HTTPHeader[];
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type OIDC = {
|
export type OIDC = {
|
||||||
|
use: "oidc" | "OIDC";
|
||||||
/** Allowed users
|
/** Allowed users
|
||||||
*
|
*
|
||||||
* @minItems 1
|
* @minItems 1
|
||||||
|
@ -111,10 +114,8 @@ export type OIDC = {
|
||||||
allowed_groups?: string[];
|
allowed_groups?: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type RateLimit = {
|
export type RateLimit = {
|
||||||
|
use: "rate_limit" | "rateLimit" | "RateLimit";
|
||||||
/** Average number of requests allowed in a period
|
/** Average number of requests allowed in a period
|
||||||
*
|
*
|
||||||
* @min 1
|
* @min 1
|
||||||
|
@ -132,18 +133,17 @@ export type RateLimit = {
|
||||||
period?: types.Duration;
|
period?: types.Duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type RealIP = {
|
export type RealIP = {
|
||||||
|
use: "real_ip" | "realIP" | "RealIP";
|
||||||
/** Header to get the client IP from
|
/** Header to get the client IP from
|
||||||
*
|
*
|
||||||
|
* @default "X-Real-IP"
|
||||||
*/
|
*/
|
||||||
header: types.HTTPHeader;
|
header?: types.HTTPHeader;
|
||||||
from: types.CIDR[];
|
from: types.CIDR[];
|
||||||
/** Recursive resolve the IP
|
/** Recursive resolve the IP
|
||||||
*
|
*
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
recursive: boolean;
|
recursive?: boolean;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,12 +14,8 @@ export const STOP_SIGNALS = [
|
||||||
"HUP",
|
"HUP",
|
||||||
"QUIT",
|
"QUIT",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type Signal = (typeof STOP_SIGNALS)[number];
|
export type Signal = (typeof STOP_SIGNALS)[number];
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type IdleWatcherConfig = {
|
export type IdleWatcherConfig = {
|
||||||
/* Idle timeout */
|
/* Idle timeout */
|
||||||
idle_timeout?: Duration;
|
idle_timeout?: Duration;
|
||||||
|
|
|
@ -5,12 +5,8 @@ export const LOAD_BALANCE_MODES = [
|
||||||
"least_conn",
|
"least_conn",
|
||||||
"ip_hash",
|
"ip_hash",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type LoadBalanceMode = (typeof LOAD_BALANCE_MODES)[number];
|
export type LoadBalanceMode = (typeof LOAD_BALANCE_MODES)[number];
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type LoadBalanceConfigBase = {
|
export type LoadBalanceConfigBase = {
|
||||||
/** Alias (subdomain or FDN) of load-balancer
|
/** Alias (subdomain or FDN) of load-balancer
|
||||||
*
|
*
|
||||||
|
@ -25,33 +21,24 @@ export type LoadBalanceConfigBase = {
|
||||||
weight?: number;
|
weight?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type LoadBalanceConfig = LoadBalanceConfigBase &
|
export type LoadBalanceConfig = LoadBalanceConfigBase &
|
||||||
(
|
(
|
||||||
|
| {} // linking other routes
|
||||||
| RoundRobinLoadBalanceConfig
|
| RoundRobinLoadBalanceConfig
|
||||||
| LeastConnLoadBalanceConfig
|
| LeastConnLoadBalanceConfig
|
||||||
| IPHashLoadBalanceConfig
|
| IPHashLoadBalanceConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type IPHashLoadBalanceConfig = {
|
export type IPHashLoadBalanceConfig = {
|
||||||
mode: "ip_hash";
|
mode: "ip_hash";
|
||||||
/** Real IP config, header to get client IP from */
|
/** Real IP config, header to get client IP from */
|
||||||
config: RealIP;
|
config: RealIP;
|
||||||
};
|
};
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type LeastConnLoadBalanceConfig = {
|
export type LeastConnLoadBalanceConfig = {
|
||||||
mode: "least_conn";
|
mode: "least_conn";
|
||||||
};
|
};
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type RoundRobinLoadBalanceConfig = {
|
export type RoundRobinLoadBalanceConfig = {
|
||||||
mode: "round_robin";
|
mode: "round_robin";
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,9 +16,6 @@ export type Routes = {
|
||||||
[key: string]: Route;
|
[key: string]: Route;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type ReverseProxyRoute = {
|
export type ReverseProxyRoute = {
|
||||||
/** Alias (subdomain or FDN)
|
/** Alias (subdomain or FDN)
|
||||||
* @minLength 1
|
* @minLength 1
|
||||||
|
@ -67,9 +64,6 @@ export type ReverseProxyRoute = {
|
||||||
access_log?: AccessLogConfig;
|
access_log?: AccessLogConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @additionalProperties false
|
|
||||||
*/
|
|
||||||
export type StreamRoute = {
|
export type StreamRoute = {
|
||||||
/** Alias (subdomain or FDN)
|
/** Alias (subdomain or FDN)
|
||||||
* @minLength 1
|
* @minLength 1
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
export interface Null {}
|
export interface Null {}
|
||||||
export type Nullable<T> = T | Null;
|
export type Nullable<T> = T | Null;
|
||||||
|
export type NullOrEmptyMap = {} | Null;
|
||||||
|
|
||||||
export const HTTP_METHODS = [
|
export const HTTP_METHODS = [
|
||||||
"GET",
|
"GET",
|
||||||
|
|
Loading…
Add table
Reference in a new issue