mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 04:52:35 +02:00
docs: move schema to frontend
This commit is contained in:
parent
7aa1215491
commit
978d82060e
59 changed files with 0 additions and 2504 deletions
|
@ -1,33 +0,0 @@
|
|||
# To generate schema
|
||||
# comment out this part from typescript-json-schema.js#L884
|
||||
#
|
||||
# if (indexType.flags !== ts.TypeFlags.Number && !isIndexedObject) {
|
||||
# throw new Error("Not supported: IndexSignatureDeclaration with index symbol other than a number or a string");
|
||||
# }
|
||||
|
||||
gen-schema-single:
|
||||
bun -bun typescript-json-schema --noExtraProps --required --skipLibCheck --tsNodeRegister=true -o "${OUT}" "${IN}" ${CLASS}
|
||||
# minify
|
||||
python3 -c "import json; f=open('${OUT}', 'r'); j=json.load(f); f.close(); f=open('${OUT}', 'w'); json.dump(j, f, separators=(',', ':'));"
|
||||
|
||||
gen-schema:
|
||||
bun -bun tsc
|
||||
sed -i 's#"type": "module"#"type": "commonjs"#' package.json
|
||||
make IN=config/config.ts \
|
||||
CLASS=Config \
|
||||
OUT=config.schema.json \
|
||||
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
|
||||
sed -i 's#"type": "commonjs"#"type": "module"#' package.json
|
||||
bun format:write
|
120
schemas/bun.lock
120
schemas/bun.lock
|
@ -1,120 +0,0 @@
|
|||
{
|
||||
"lockfileVersion": 1,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "godoxy-schemas",
|
||||
"devDependencies": {
|
||||
"prettier": "^3.5.3",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-json-schema": "^0.65.1",
|
||||
},
|
||||
},
|
||||
},
|
||||
"packages": {
|
||||
"@cspotcode/source-map-support": ["@cspotcode/source-map-support@0.8.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="],
|
||||
|
||||
"@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
|
||||
|
||||
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="],
|
||||
|
||||
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="],
|
||||
|
||||
"@tsconfig/node10": ["@tsconfig/node10@1.0.11", "", {}, "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw=="],
|
||||
|
||||
"@tsconfig/node12": ["@tsconfig/node12@1.0.11", "", {}, "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag=="],
|
||||
|
||||
"@tsconfig/node14": ["@tsconfig/node14@1.0.3", "", {}, "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="],
|
||||
|
||||
"@tsconfig/node16": ["@tsconfig/node16@1.0.4", "", {}, "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA=="],
|
||||
|
||||
"@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
|
||||
|
||||
"@types/node": ["@types/node@18.19.86", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-fifKayi175wLyKyc5qUfyENhQ1dCNI1UNjp653d8kuYcPQN5JhX3dGuP/XmvPTg/xRBn1VTLpbmi+H/Mr7tLfQ=="],
|
||||
|
||||
"acorn": ["acorn@8.14.1", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg=="],
|
||||
|
||||
"acorn-walk": ["acorn-walk@8.3.4", "", { "dependencies": { "acorn": "^8.11.0" } }, "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g=="],
|
||||
|
||||
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
||||
|
||||
"ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"arg": ["arg@4.1.3", "", {}, "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="],
|
||||
|
||||
"balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
|
||||
|
||||
"brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="],
|
||||
|
||||
"cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
|
||||
|
||||
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
|
||||
|
||||
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
||||
|
||||
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
|
||||
|
||||
"create-require": ["create-require@1.1.1", "", {}, "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="],
|
||||
|
||||
"diff": ["diff@4.0.2", "", {}, "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="],
|
||||
|
||||
"emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
||||
|
||||
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
|
||||
|
||||
"fs.realpath": ["fs.realpath@1.0.0", "", {}, "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="],
|
||||
|
||||
"get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="],
|
||||
|
||||
"glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
|
||||
|
||||
"inflight": ["inflight@1.0.6", "", { "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA=="],
|
||||
|
||||
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
||||
|
||||
"is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
|
||||
|
||||
"make-error": ["make-error@1.3.6", "", {}, "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="],
|
||||
|
||||
"minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
|
||||
|
||||
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
|
||||
|
||||
"path-equal": ["path-equal@1.2.5", "", {}, "sha512-i73IctDr3F2W+bsOWDyyVm/lqsXO47aY9nsFZUjTT/aljSbkxHxxCoyZ9UUrM8jK0JVod+An+rl48RCsvWM+9g=="],
|
||||
|
||||
"path-is-absolute": ["path-is-absolute@1.0.1", "", {}, "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="],
|
||||
|
||||
"prettier": ["prettier@3.5.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw=="],
|
||||
|
||||
"require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="],
|
||||
|
||||
"safe-stable-stringify": ["safe-stable-stringify@2.5.0", "", {}, "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA=="],
|
||||
|
||||
"string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
||||
|
||||
"strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
||||
|
||||
"ts-node": ["ts-node@10.9.2", "", { "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", "@tsconfig/node16": "^1.0.2", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", "@types/node": "*", "typescript": ">=2.7" }, "optionalPeers": ["@swc/core", "@swc/wasm"], "bin": { "ts-node": "dist/bin.js", "ts-script": "dist/bin-script-deprecated.js", "ts-node-cwd": "dist/bin-cwd.js", "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js" } }, "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ=="],
|
||||
|
||||
"typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
|
||||
|
||||
"typescript-json-schema": ["typescript-json-schema@0.65.1", "", { "dependencies": { "@types/json-schema": "^7.0.9", "@types/node": "^18.11.9", "glob": "^7.1.7", "path-equal": "^1.2.5", "safe-stable-stringify": "^2.2.0", "ts-node": "^10.9.1", "typescript": "~5.5.0", "yargs": "^17.1.1" }, "bin": { "typescript-json-schema": "bin/typescript-json-schema" } }, "sha512-tuGH7ff2jPaUYi6as3lHyHcKpSmXIqN7/mu50x3HlYn0EHzLpmt3nplZ7EuhUkO0eqDRc9GqWNkfjgBPIS9kxg=="],
|
||||
|
||||
"undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="],
|
||||
|
||||
"v8-compile-cache-lib": ["v8-compile-cache-lib@3.0.1", "", {}, "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="],
|
||||
|
||||
"wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
|
||||
|
||||
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
|
||||
|
||||
"y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="],
|
||||
|
||||
"yargs": ["yargs@17.7.2", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="],
|
||||
|
||||
"yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="],
|
||||
|
||||
"yn": ["yn@3.1.1", "", {}, "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="],
|
||||
|
||||
"typescript-json-schema/typescript": ["typescript@5.5.4", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q=="],
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
57
schemas/config/access_log.d.ts
vendored
57
schemas/config/access_log.d.ts
vendored
|
@ -1,57 +0,0 @@
|
|||
import { CIDR, HTTPHeader, HTTPMethod, StatusCodeRange, URI } from "../types";
|
||||
export declare const ACCESS_LOG_FORMATS: readonly [
|
||||
"combined",
|
||||
"common",
|
||||
"json",
|
||||
];
|
||||
export type AccessLogFormat = (typeof ACCESS_LOG_FORMATS)[number];
|
||||
export type AccessLogConfig = {
|
||||
/**
|
||||
* The size of the buffer.
|
||||
*
|
||||
* @minimum 0
|
||||
* @default 65536
|
||||
* @TJS-type integer
|
||||
*/
|
||||
buffer_size?: number;
|
||||
/** The format of the access log.
|
||||
*
|
||||
* @default "combined"
|
||||
*/
|
||||
format?: AccessLogFormat;
|
||||
path: URI;
|
||||
filters?: AccessLogFilters;
|
||||
fields?: AccessLogFields;
|
||||
};
|
||||
export type AccessLogFilter<T> = {
|
||||
/** Whether the filter is negative.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
negative?: boolean;
|
||||
values: T[];
|
||||
};
|
||||
export type AccessLogFilters = {
|
||||
status_code?: AccessLogFilter<StatusCodeRange>;
|
||||
method?: AccessLogFilter<HTTPMethod>;
|
||||
host?: AccessLogFilter<string>;
|
||||
headers?: AccessLogFilter<HTTPHeader>;
|
||||
cidr?: AccessLogFilter<CIDR>;
|
||||
};
|
||||
export declare const ACCESS_LOG_FIELD_MODES: readonly [
|
||||
"keep",
|
||||
"drop",
|
||||
"redact",
|
||||
];
|
||||
export type AccessLogFieldMode = (typeof ACCESS_LOG_FIELD_MODES)[number];
|
||||
export type AccessLogField = {
|
||||
default?: AccessLogFieldMode;
|
||||
config: {
|
||||
[key: string]: AccessLogFieldMode;
|
||||
};
|
||||
};
|
||||
export type AccessLogFields = {
|
||||
header?: AccessLogField;
|
||||
query?: AccessLogField;
|
||||
cookie?: AccessLogField;
|
||||
};
|
|
@ -1,2 +0,0 @@
|
|||
export const ACCESS_LOG_FORMATS = ["combined", "common", "json"];
|
||||
export const ACCESS_LOG_FIELD_MODES = ["keep", "drop", "redact"];
|
|
@ -1,66 +0,0 @@
|
|||
import { CIDR, HTTPHeader, HTTPMethod, StatusCodeRange, URI } from "../types";
|
||||
|
||||
export const ACCESS_LOG_FORMATS = ["combined", "common", "json"] as const;
|
||||
|
||||
export type AccessLogFormat = (typeof ACCESS_LOG_FORMATS)[number];
|
||||
|
||||
export type AccessLogConfig = {
|
||||
/**
|
||||
* The size of the buffer.
|
||||
*
|
||||
* @minimum 0
|
||||
* @default 65536
|
||||
* @TJS-type integer
|
||||
*/
|
||||
buffer_size?: number;
|
||||
/** The format of the access log.
|
||||
*
|
||||
* @default "combined"
|
||||
*/
|
||||
format?: AccessLogFormat;
|
||||
/* The path to the access log file. */
|
||||
path: URI;
|
||||
/* The access log filters. */
|
||||
filters?: AccessLogFilters;
|
||||
/* The access log fields. */
|
||||
fields?: AccessLogFields;
|
||||
};
|
||||
|
||||
export type AccessLogFilter<T> = {
|
||||
/** Whether the filter is negative.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
negative?: boolean;
|
||||
/* The values to filter. */
|
||||
values: T[];
|
||||
};
|
||||
|
||||
export type AccessLogFilters = {
|
||||
/* Status code filter. */
|
||||
status_code?: AccessLogFilter<StatusCodeRange>;
|
||||
/* Method filter. */
|
||||
method?: AccessLogFilter<HTTPMethod>;
|
||||
/* Host filter. */
|
||||
host?: AccessLogFilter<string>;
|
||||
/* Header filter. */
|
||||
headers?: AccessLogFilter<HTTPHeader>;
|
||||
/* CIDR filter. */
|
||||
cidr?: AccessLogFilter<CIDR>;
|
||||
};
|
||||
|
||||
export const ACCESS_LOG_FIELD_MODES = ["keep", "drop", "redact"] as const;
|
||||
export type AccessLogFieldMode = (typeof ACCESS_LOG_FIELD_MODES)[number];
|
||||
|
||||
export type AccessLogField = {
|
||||
default?: AccessLogFieldMode;
|
||||
config: {
|
||||
[key: string]: AccessLogFieldMode;
|
||||
};
|
||||
};
|
||||
|
||||
export type AccessLogFields = {
|
||||
header?: AccessLogField;
|
||||
query?: AccessLogField;
|
||||
cookie?: AccessLogField;
|
||||
};
|
88
schemas/config/autocert.d.ts
vendored
88
schemas/config/autocert.d.ts
vendored
|
@ -1,88 +0,0 @@
|
|||
import { DomainOrWildcard, Email } from "../types";
|
||||
export declare const AUTOCERT_PROVIDERS: readonly [
|
||||
"local",
|
||||
"cloudflare",
|
||||
"clouddns",
|
||||
"duckdns",
|
||||
"ovh",
|
||||
"porkbun",
|
||||
];
|
||||
export type AutocertProvider = (typeof AUTOCERT_PROVIDERS)[number];
|
||||
export type AutocertConfig =
|
||||
| LocalOptions
|
||||
| CloudflareOptions
|
||||
| CloudDNSOptions
|
||||
| DuckDNSOptions
|
||||
| OVHOptionsWithAppKey
|
||||
| OVHOptionsWithOAuth2Config
|
||||
| PorkbunOptions;
|
||||
export interface AutocertConfigBase {
|
||||
email: Email;
|
||||
domains: DomainOrWildcard[];
|
||||
cert_path?: string;
|
||||
key_path?: string;
|
||||
}
|
||||
export interface LocalOptions {
|
||||
provider: "local";
|
||||
cert_path?: string;
|
||||
key_path?: string;
|
||||
options?: {} | null;
|
||||
}
|
||||
export interface CloudflareOptions extends AutocertConfigBase {
|
||||
provider: "cloudflare";
|
||||
options: {
|
||||
auth_token: string;
|
||||
};
|
||||
}
|
||||
export interface CloudDNSOptions extends AutocertConfigBase {
|
||||
provider: "clouddns";
|
||||
options: {
|
||||
client_id: string;
|
||||
email: Email;
|
||||
password: string;
|
||||
};
|
||||
}
|
||||
export interface DuckDNSOptions extends AutocertConfigBase {
|
||||
provider: "duckdns";
|
||||
options: {
|
||||
token: string;
|
||||
};
|
||||
}
|
||||
export interface PorkbunOptions extends AutocertConfigBase {
|
||||
provider: "porkbun";
|
||||
options: {
|
||||
api_key: string;
|
||||
secret_api_key: string;
|
||||
};
|
||||
}
|
||||
export declare const OVH_ENDPOINTS: readonly [
|
||||
"ovh-eu",
|
||||
"ovh-ca",
|
||||
"ovh-us",
|
||||
"kimsufi-eu",
|
||||
"kimsufi-ca",
|
||||
"soyoustart-eu",
|
||||
"soyoustart-ca",
|
||||
];
|
||||
export type OVHEndpoint = (typeof OVH_ENDPOINTS)[number];
|
||||
export interface OVHOptionsWithAppKey extends AutocertConfigBase {
|
||||
provider: "ovh";
|
||||
options: {
|
||||
application_secret: string;
|
||||
consumer_key: string;
|
||||
api_endpoint?: OVHEndpoint;
|
||||
application_key: string;
|
||||
};
|
||||
}
|
||||
export interface OVHOptionsWithOAuth2Config extends AutocertConfigBase {
|
||||
provider: "ovh";
|
||||
options: {
|
||||
application_secret: string;
|
||||
consumer_key: string;
|
||||
api_endpoint?: OVHEndpoint;
|
||||
oauth2_config: {
|
||||
client_id: string;
|
||||
client_secret: string;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
export const AUTOCERT_PROVIDERS = [
|
||||
"local",
|
||||
"cloudflare",
|
||||
"clouddns",
|
||||
"duckdns",
|
||||
"ovh",
|
||||
"porkbun",
|
||||
];
|
||||
export const OVH_ENDPOINTS = [
|
||||
"ovh-eu",
|
||||
"ovh-ca",
|
||||
"ovh-us",
|
||||
"kimsufi-eu",
|
||||
"kimsufi-ca",
|
||||
"soyoustart-eu",
|
||||
"soyoustart-ca",
|
||||
];
|
|
@ -1,104 +0,0 @@
|
|||
import { DomainOrWildcard, Email } from "../types";
|
||||
|
||||
export const AUTOCERT_PROVIDERS = [
|
||||
"local",
|
||||
"cloudflare",
|
||||
"clouddns",
|
||||
"duckdns",
|
||||
"ovh",
|
||||
"porkbun",
|
||||
] as const;
|
||||
|
||||
export type AutocertProvider = (typeof AUTOCERT_PROVIDERS)[number];
|
||||
|
||||
export type AutocertConfig =
|
||||
| LocalOptions
|
||||
| CloudflareOptions
|
||||
| CloudDNSOptions
|
||||
| DuckDNSOptions
|
||||
| OVHOptionsWithAppKey
|
||||
| OVHOptionsWithOAuth2Config
|
||||
| PorkbunOptions;
|
||||
|
||||
export interface AutocertConfigBase {
|
||||
/* ACME email */
|
||||
email: Email;
|
||||
/* ACME domains */
|
||||
domains: DomainOrWildcard[];
|
||||
/* ACME certificate path */
|
||||
cert_path?: string;
|
||||
/* ACME key path */
|
||||
key_path?: string;
|
||||
}
|
||||
|
||||
export interface LocalOptions {
|
||||
provider: "local";
|
||||
/* ACME certificate path */
|
||||
cert_path?: string;
|
||||
/* ACME key path */
|
||||
key_path?: string;
|
||||
options?: {} | null;
|
||||
}
|
||||
|
||||
export interface CloudflareOptions extends AutocertConfigBase {
|
||||
provider: "cloudflare";
|
||||
options: { auth_token: string };
|
||||
}
|
||||
|
||||
export interface CloudDNSOptions extends AutocertConfigBase {
|
||||
provider: "clouddns";
|
||||
options: {
|
||||
client_id: string;
|
||||
email: Email;
|
||||
password: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface DuckDNSOptions extends AutocertConfigBase {
|
||||
provider: "duckdns";
|
||||
options: {
|
||||
token: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PorkbunOptions extends AutocertConfigBase {
|
||||
provider: "porkbun";
|
||||
options: {
|
||||
api_key: string;
|
||||
secret_api_key: string;
|
||||
};
|
||||
}
|
||||
export const OVH_ENDPOINTS = [
|
||||
"ovh-eu",
|
||||
"ovh-ca",
|
||||
"ovh-us",
|
||||
"kimsufi-eu",
|
||||
"kimsufi-ca",
|
||||
"soyoustart-eu",
|
||||
"soyoustart-ca",
|
||||
] as const;
|
||||
|
||||
export type OVHEndpoint = (typeof OVH_ENDPOINTS)[number];
|
||||
|
||||
export interface OVHOptionsWithAppKey extends AutocertConfigBase {
|
||||
provider: "ovh";
|
||||
options: {
|
||||
application_secret: string;
|
||||
consumer_key: string;
|
||||
api_endpoint?: OVHEndpoint;
|
||||
application_key: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface OVHOptionsWithOAuth2Config extends AutocertConfigBase {
|
||||
provider: "ovh";
|
||||
options: {
|
||||
application_secret: string;
|
||||
consumer_key: string;
|
||||
api_endpoint?: OVHEndpoint;
|
||||
oauth2_config: {
|
||||
client_id: string;
|
||||
client_secret: string;
|
||||
};
|
||||
};
|
||||
}
|
61
schemas/config/config.d.ts
vendored
61
schemas/config/config.d.ts
vendored
|
@ -1,61 +0,0 @@
|
|||
import { DomainName } from "../types";
|
||||
import { AutocertConfig } from "./autocert";
|
||||
import { EntrypointConfig } from "./entrypoint";
|
||||
import { HomepageConfig } from "./homepage";
|
||||
import { Providers } from "./providers";
|
||||
export type Config = {
|
||||
/** Optional autocert configuration
|
||||
*
|
||||
* @examples require(".").autocertExamples
|
||||
*/
|
||||
autocert?: AutocertConfig;
|
||||
entrypoint?: EntrypointConfig;
|
||||
providers: Providers;
|
||||
/** Optional list of domains to match
|
||||
*
|
||||
* @minItems 1
|
||||
* @examples require(".").matchDomainsExamples
|
||||
*/
|
||||
match_domains?: DomainName[];
|
||||
homepage?: HomepageConfig;
|
||||
/**
|
||||
* Optional timeout before shutdown
|
||||
* @default 3
|
||||
* @minimum 1
|
||||
*/
|
||||
timeout_shutdown?: number;
|
||||
};
|
||||
export declare const autocertExamples: (
|
||||
| {
|
||||
provider: string;
|
||||
email?: undefined;
|
||||
domains?: undefined;
|
||||
options?: undefined;
|
||||
}
|
||||
| {
|
||||
provider: string;
|
||||
email: string;
|
||||
domains: string[];
|
||||
options: {
|
||||
auth_token: string;
|
||||
client_id?: undefined;
|
||||
email?: undefined;
|
||||
password?: undefined;
|
||||
};
|
||||
}
|
||||
| {
|
||||
provider: string;
|
||||
email: string;
|
||||
domains: string[];
|
||||
options: {
|
||||
client_id: string;
|
||||
email: string;
|
||||
password: string;
|
||||
auth_token?: undefined;
|
||||
};
|
||||
}
|
||||
)[];
|
||||
export declare const matchDomainsExamples: readonly [
|
||||
"example.com",
|
||||
"*.example.com",
|
||||
];
|
|
@ -1,20 +0,0 @@
|
|||
export const autocertExamples = [
|
||||
{ provider: "local" },
|
||||
{
|
||||
provider: "cloudflare",
|
||||
email: "abc@gmail",
|
||||
domains: ["example.com"],
|
||||
options: { auth_token: "c1234565789-abcdefghijklmnopqrst" },
|
||||
},
|
||||
{
|
||||
provider: "clouddns",
|
||||
email: "abc@gmail",
|
||||
domains: ["example.com"],
|
||||
options: {
|
||||
client_id: "c1234565789",
|
||||
email: "abc@gmail",
|
||||
password: "password",
|
||||
},
|
||||
},
|
||||
];
|
||||
export const matchDomainsExamples = ["example.com", "*.example.com"];
|
|
@ -1,52 +0,0 @@
|
|||
import { DomainName } from "../types";
|
||||
import { AutocertConfig } from "./autocert";
|
||||
import { EntrypointConfig } from "./entrypoint";
|
||||
import { HomepageConfig } from "./homepage";
|
||||
import { Providers } from "./providers";
|
||||
|
||||
export type Config = {
|
||||
/** Optional autocert configuration
|
||||
*
|
||||
* @examples require(".").autocertExamples
|
||||
*/
|
||||
autocert?: AutocertConfig;
|
||||
/* Optional entrypoint configuration */
|
||||
entrypoint?: EntrypointConfig;
|
||||
/* Providers configuration (include file, docker, notification) */
|
||||
providers: Providers;
|
||||
/** Optional list of domains to match
|
||||
*
|
||||
* @minItems 1
|
||||
* @examples require(".").matchDomainsExamples
|
||||
*/
|
||||
match_domains?: DomainName[];
|
||||
/* Optional homepage configuration */
|
||||
homepage?: HomepageConfig;
|
||||
/**
|
||||
* Optional timeout before shutdown
|
||||
* @default 3
|
||||
* @minimum 1
|
||||
*/
|
||||
timeout_shutdown?: number;
|
||||
};
|
||||
|
||||
export const autocertExamples = [
|
||||
{ provider: "local" },
|
||||
{
|
||||
provider: "cloudflare",
|
||||
email: "abc@gmail",
|
||||
domains: ["example.com"],
|
||||
options: { auth_token: "c1234565789-abcdefghijklmnopqrst" },
|
||||
},
|
||||
{
|
||||
provider: "clouddns",
|
||||
email: "abc@gmail",
|
||||
domains: ["example.com"],
|
||||
options: {
|
||||
client_id: "c1234565789",
|
||||
email: "abc@gmail",
|
||||
password: "password",
|
||||
},
|
||||
},
|
||||
];
|
||||
export const matchDomainsExamples = ["example.com", "*.example.com"] as const;
|
49
schemas/config/entrypoint.d.ts
vendored
49
schemas/config/entrypoint.d.ts
vendored
|
@ -1,49 +0,0 @@
|
|||
import { MiddlewareCompose } from "../middlewares/middleware_compose";
|
||||
import { AccessLogConfig } from "./access_log";
|
||||
export type EntrypointConfig = {
|
||||
/** Entrypoint middleware configuration
|
||||
*
|
||||
* @examples require(".").middlewaresExamples
|
||||
*/
|
||||
middlewares?: MiddlewareCompose;
|
||||
/** Entrypoint access log configuration
|
||||
*
|
||||
* @examples require(".").accessLogExamples
|
||||
*/
|
||||
access_log?: AccessLogConfig;
|
||||
};
|
||||
export declare const accessLogExamples: readonly [
|
||||
{
|
||||
readonly path: "/var/log/access.log";
|
||||
readonly format: "combined";
|
||||
readonly filters: {
|
||||
readonly status_codes: {
|
||||
readonly values: readonly ["200-299"];
|
||||
};
|
||||
};
|
||||
readonly fields: {
|
||||
readonly headers: {
|
||||
readonly default: "keep";
|
||||
readonly config: {
|
||||
readonly foo: "redact";
|
||||
};
|
||||
};
|
||||
};
|
||||
},
|
||||
];
|
||||
export declare const middlewaresExamples: readonly [
|
||||
{
|
||||
readonly use: "RedirectHTTP";
|
||||
},
|
||||
{
|
||||
readonly use: "CIDRWhitelist";
|
||||
readonly allow: readonly [
|
||||
"127.0.0.1",
|
||||
"10.0.0.0/8",
|
||||
"172.16.0.0/12",
|
||||
"192.168.0.0/16",
|
||||
];
|
||||
readonly status: 403;
|
||||
readonly message: "Forbidden";
|
||||
},
|
||||
];
|
|
@ -1,30 +0,0 @@
|
|||
export const accessLogExamples = [
|
||||
{
|
||||
path: "/var/log/access.log",
|
||||
format: "combined",
|
||||
filters: {
|
||||
status_codes: {
|
||||
values: ["200-299"],
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
headers: {
|
||||
default: "keep",
|
||||
config: {
|
||||
foo: "redact",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
export const middlewaresExamples = [
|
||||
{
|
||||
use: "RedirectHTTP",
|
||||
},
|
||||
{
|
||||
use: "CIDRWhitelist",
|
||||
allow: ["127.0.0.1", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
|
||||
status: 403,
|
||||
message: "Forbidden",
|
||||
},
|
||||
];
|
|
@ -1,47 +0,0 @@
|
|||
import { MiddlewareCompose } from "../middlewares/middleware_compose";
|
||||
import { AccessLogConfig } from "./access_log";
|
||||
|
||||
export type EntrypointConfig = {
|
||||
/** Entrypoint middleware configuration
|
||||
*
|
||||
* @examples require(".").middlewaresExamples
|
||||
*/
|
||||
middlewares?: MiddlewareCompose;
|
||||
/** Entrypoint access log configuration
|
||||
*
|
||||
* @examples require(".").accessLogExamples
|
||||
*/
|
||||
access_log?: AccessLogConfig;
|
||||
};
|
||||
|
||||
export const accessLogExamples = [
|
||||
{
|
||||
path: "/var/log/access.log",
|
||||
format: "combined",
|
||||
filters: {
|
||||
status_codes: {
|
||||
values: ["200-299"],
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
headers: {
|
||||
default: "keep",
|
||||
config: {
|
||||
foo: "redact",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const middlewaresExamples = [
|
||||
{
|
||||
use: "RedirectHTTP",
|
||||
},
|
||||
{
|
||||
use: "CIDRWhitelist",
|
||||
allow: ["127.0.0.1", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
|
||||
status: 403,
|
||||
message: "Forbidden",
|
||||
},
|
||||
] as const;
|
7
schemas/config/homepage.d.ts
vendored
7
schemas/config/homepage.d.ts
vendored
|
@ -1,7 +0,0 @@
|
|||
export type HomepageConfig = {
|
||||
/**
|
||||
* Use default app categories (uses docker image name)
|
||||
* @default true
|
||||
*/
|
||||
use_default_categories: boolean;
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
export {};
|
|
@ -1,7 +0,0 @@
|
|||
export type HomepageConfig = {
|
||||
/**
|
||||
* Use default app categories (uses docker image name)
|
||||
* @default true
|
||||
*/
|
||||
use_default_categories: boolean;
|
||||
};
|
69
schemas/config/notification.d.ts
vendored
69
schemas/config/notification.d.ts
vendored
|
@ -1,69 +0,0 @@
|
|||
import { URL } from "../types";
|
||||
export declare const NOTIFICATION_PROVIDERS: readonly [
|
||||
"webhook",
|
||||
"gotify",
|
||||
"ntfy",
|
||||
];
|
||||
export type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];
|
||||
export type NotificationConfig = {
|
||||
name: string;
|
||||
url: URL;
|
||||
};
|
||||
export interface GotifyConfig extends NotificationConfig {
|
||||
provider: "gotify";
|
||||
token: string;
|
||||
}
|
||||
export declare const NTFY_MSG_STYLES: string[];
|
||||
export type NtfyStyle = (typeof NTFY_MSG_STYLES)[number];
|
||||
export interface NtfyConfig extends NotificationConfig {
|
||||
provider: "ntfy";
|
||||
topic: string;
|
||||
token?: string;
|
||||
style?: NtfyStyle;
|
||||
}
|
||||
export declare const WEBHOOK_TEMPLATES: readonly ["", "discord"];
|
||||
export declare const WEBHOOK_METHODS: readonly ["POST", "GET", "PUT"];
|
||||
export declare const WEBHOOK_MIME_TYPES: readonly [
|
||||
"application/json",
|
||||
"application/x-www-form-urlencoded",
|
||||
"text/plain",
|
||||
"text/markdown",
|
||||
];
|
||||
export declare const WEBHOOK_COLOR_MODES: readonly ["hex", "dec"];
|
||||
export type WebhookTemplate = (typeof WEBHOOK_TEMPLATES)[number];
|
||||
export type WebhookMethod = (typeof WEBHOOK_METHODS)[number];
|
||||
export type WebhookMimeType = (typeof WEBHOOK_MIME_TYPES)[number];
|
||||
export type WebhookColorMode = (typeof WEBHOOK_COLOR_MODES)[number];
|
||||
export interface WebhookConfig extends NotificationConfig {
|
||||
provider: "webhook";
|
||||
/**
|
||||
* Webhook template
|
||||
*
|
||||
* @default "discord"
|
||||
*/
|
||||
template?: WebhookTemplate;
|
||||
token?: string;
|
||||
/**
|
||||
* Webhook message (usally JSON),
|
||||
* required when template is not defined
|
||||
*/
|
||||
payload?: string;
|
||||
/**
|
||||
* Webhook method
|
||||
*
|
||||
* @default "POST"
|
||||
*/
|
||||
method?: WebhookMethod;
|
||||
/**
|
||||
* Webhook mime type
|
||||
*
|
||||
* @default "application/json"
|
||||
*/
|
||||
mime_type?: WebhookMimeType;
|
||||
/**
|
||||
* Webhook color mode
|
||||
*
|
||||
* @default "hex"
|
||||
*/
|
||||
color_mode?: WebhookColorMode;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
export const NOTIFICATION_PROVIDERS = ["webhook", "gotify", "ntfy"];
|
||||
export const NTFY_MSG_STYLES = ["markdown", "plain"];
|
||||
export const WEBHOOK_TEMPLATES = ["", "discord"];
|
||||
export const WEBHOOK_METHODS = ["POST", "GET", "PUT"];
|
||||
export const WEBHOOK_MIME_TYPES = [
|
||||
"application/json",
|
||||
"application/x-www-form-urlencoded",
|
||||
"text/plain",
|
||||
"text/markdown",
|
||||
];
|
||||
export const WEBHOOK_COLOR_MODES = ["hex", "dec"];
|
|
@ -1,78 +0,0 @@
|
|||
import { URL } from "../types";
|
||||
|
||||
export const NOTIFICATION_PROVIDERS = ["webhook", "gotify", "ntfy"] as const;
|
||||
|
||||
export type NotificationProvider = (typeof NOTIFICATION_PROVIDERS)[number];
|
||||
|
||||
export type NotificationConfig = {
|
||||
/* Name of the notification provider */
|
||||
name: string;
|
||||
/* URL of the notification provider */
|
||||
url: URL;
|
||||
};
|
||||
|
||||
export interface GotifyConfig extends NotificationConfig {
|
||||
provider: "gotify";
|
||||
/* Gotify token */
|
||||
token: string;
|
||||
}
|
||||
|
||||
export const NTFY_MSG_STYLES = ["markdown", "plain"];
|
||||
export type NtfyStyle = (typeof NTFY_MSG_STYLES)[number];
|
||||
|
||||
export interface NtfyConfig extends NotificationConfig {
|
||||
provider: "ntfy";
|
||||
topic: string;
|
||||
token?: string;
|
||||
style?: NtfyStyle;
|
||||
}
|
||||
|
||||
export const WEBHOOK_TEMPLATES = ["", "discord"] as const;
|
||||
export const WEBHOOK_METHODS = ["POST", "GET", "PUT"] as const;
|
||||
export const WEBHOOK_MIME_TYPES = [
|
||||
"application/json",
|
||||
"application/x-www-form-urlencoded",
|
||||
"text/plain",
|
||||
"text/markdown",
|
||||
] as const;
|
||||
export const WEBHOOK_COLOR_MODES = ["hex", "dec"] as const;
|
||||
|
||||
export type WebhookTemplate = (typeof WEBHOOK_TEMPLATES)[number];
|
||||
export type WebhookMethod = (typeof WEBHOOK_METHODS)[number];
|
||||
export type WebhookMimeType = (typeof WEBHOOK_MIME_TYPES)[number];
|
||||
export type WebhookColorMode = (typeof WEBHOOK_COLOR_MODES)[number];
|
||||
|
||||
export interface WebhookConfig extends NotificationConfig {
|
||||
provider: "webhook";
|
||||
/**
|
||||
* Webhook template
|
||||
*
|
||||
* @default "discord"
|
||||
*/
|
||||
template?: WebhookTemplate;
|
||||
/* Webhook token */
|
||||
token?: string;
|
||||
/**
|
||||
* Webhook message (usally JSON),
|
||||
* required when template is not defined
|
||||
*/
|
||||
payload?: string;
|
||||
/**
|
||||
* Webhook method
|
||||
*
|
||||
* @default "POST"
|
||||
*/
|
||||
method?: WebhookMethod;
|
||||
/**
|
||||
* Webhook mime type
|
||||
*
|
||||
* @default "application/json"
|
||||
*/
|
||||
mime_type?: WebhookMimeType;
|
||||
/**
|
||||
* Webhook color mode
|
||||
*
|
||||
* @default "hex"
|
||||
*/
|
||||
color_mode?: WebhookColorMode;
|
||||
}
|
58
schemas/config/providers.d.ts
vendored
58
schemas/config/providers.d.ts
vendored
|
@ -1,58 +0,0 @@
|
|||
import { URI, URL } from "../types";
|
||||
import { GotifyConfig, NtfyConfig, WebhookConfig } from "./notification";
|
||||
export type Providers = {
|
||||
/** List of route definition files to include
|
||||
*
|
||||
* @minItems 1
|
||||
* @examples require(".").includeExamples
|
||||
* @items.pattern ^[\w\d\-_]+\.(yaml|yml)$
|
||||
*/
|
||||
include?: URI[];
|
||||
/** Name-value mapping of docker hosts to retrieve routes from
|
||||
*
|
||||
* @minProperties 1
|
||||
* @examples require(".").dockerExamples
|
||||
*/
|
||||
docker?: {
|
||||
[name: string]: URL | "$DOCKER_HOST";
|
||||
};
|
||||
/** List of GoDoxy agents
|
||||
*
|
||||
* @minItems 1
|
||||
* @examples require(".").agentExamples
|
||||
*/
|
||||
agents?: `${string}:${number}`[];
|
||||
/** List of notification providers
|
||||
*
|
||||
* @minItems 1
|
||||
* @examples require(".").notificationExamples
|
||||
*/
|
||||
notification?: (WebhookConfig | GotifyConfig | NtfyConfig)[];
|
||||
};
|
||||
export declare const includeExamples: readonly ["file1.yml", "file2.yml"];
|
||||
export declare const dockerExamples: readonly [
|
||||
{
|
||||
readonly local: "$DOCKER_HOST";
|
||||
},
|
||||
{
|
||||
readonly remote: "tcp://10.0.2.1:2375";
|
||||
},
|
||||
{
|
||||
readonly remote2: "ssh://root:1234@10.0.2.2";
|
||||
},
|
||||
];
|
||||
export declare const notificationExamples: readonly [
|
||||
{
|
||||
readonly name: "gotify";
|
||||
readonly provider: "gotify";
|
||||
readonly url: "https://gotify.domain.tld";
|
||||
readonly token: "abcd";
|
||||
},
|
||||
{
|
||||
readonly name: "discord";
|
||||
readonly provider: "webhook";
|
||||
readonly template: "discord";
|
||||
readonly url: "https://discord.com/api/webhooks/1234/abcd";
|
||||
},
|
||||
];
|
||||
export declare const agentExamples: readonly ["10.0.2.3:8890", "10.0.2.4:8890"];
|
|
@ -1,21 +0,0 @@
|
|||
export const includeExamples = ["file1.yml", "file2.yml"];
|
||||
export const dockerExamples = [
|
||||
{ local: "$DOCKER_HOST" },
|
||||
{ remote: "tcp://10.0.2.1:2375" },
|
||||
{ remote2: "ssh://root:1234@10.0.2.2" },
|
||||
];
|
||||
export const notificationExamples = [
|
||||
{
|
||||
name: "gotify",
|
||||
provider: "gotify",
|
||||
url: "https://gotify.domain.tld",
|
||||
token: "abcd",
|
||||
},
|
||||
{
|
||||
name: "discord",
|
||||
provider: "webhook",
|
||||
template: "discord",
|
||||
url: "https://discord.com/api/webhooks/1234/abcd",
|
||||
},
|
||||
];
|
||||
export const agentExamples = ["10.0.2.3:8890", "10.0.2.4:8890"];
|
|
@ -1,52 +0,0 @@
|
|||
import { URI, URL } from "../types";
|
||||
import { GotifyConfig, NtfyConfig, WebhookConfig } from "./notification";
|
||||
|
||||
export type Providers = {
|
||||
/** List of route definition files to include
|
||||
*
|
||||
* @minItems 1
|
||||
* @examples require(".").includeExamples
|
||||
* @items.pattern ^[\w\d\-_]+\.(yaml|yml)$
|
||||
*/
|
||||
include?: URI[];
|
||||
/** Name-value mapping of docker hosts to retrieve routes from
|
||||
*
|
||||
* @minProperties 1
|
||||
* @examples require(".").dockerExamples
|
||||
*/
|
||||
docker?: { [name: string]: URL | "$DOCKER_HOST" };
|
||||
/** List of GoDoxy agents
|
||||
*
|
||||
* @minItems 1
|
||||
* @examples require(".").agentExamples
|
||||
*/
|
||||
agents?: `${string}:${number}`[];
|
||||
/** List of notification providers
|
||||
*
|
||||
* @minItems 1
|
||||
* @examples require(".").notificationExamples
|
||||
*/
|
||||
notification?: (WebhookConfig | GotifyConfig | NtfyConfig)[];
|
||||
};
|
||||
|
||||
export const includeExamples = ["file1.yml", "file2.yml"] as const;
|
||||
export const dockerExamples = [
|
||||
{ local: "$DOCKER_HOST" },
|
||||
{ remote: "tcp://10.0.2.1:2375" },
|
||||
{ remote2: "ssh://root:1234@10.0.2.2" },
|
||||
] as const;
|
||||
export const notificationExamples = [
|
||||
{
|
||||
name: "gotify",
|
||||
provider: "gotify",
|
||||
url: "https://gotify.domain.tld",
|
||||
token: "abcd",
|
||||
},
|
||||
{
|
||||
name: "discord",
|
||||
provider: "webhook",
|
||||
template: "discord",
|
||||
url: "https://discord.com/api/webhooks/1234/abcd",
|
||||
},
|
||||
] as const;
|
||||
export const agentExamples = ["10.0.2.3:8890", "10.0.2.4:8890"] as const;
|
5
schemas/docker.d.ts
vendored
5
schemas/docker.d.ts
vendored
|
@ -1,5 +0,0 @@
|
|||
import { IdleWatcherConfig } from "./providers/idlewatcher";
|
||||
import { Route } from "./providers/routes";
|
||||
export type DockerRoutes = {
|
||||
[key: string]: Route & IdleWatcherConfig;
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
export {};
|
|
@ -1,7 +0,0 @@
|
|||
import { IdleWatcherConfig } from "./providers/idlewatcher";
|
||||
import { Route } from "./providers/routes";
|
||||
|
||||
//FIXME: fix this
|
||||
export type DockerRoutes = {
|
||||
[key: string]: Route & IdleWatcherConfig;
|
||||
};
|
File diff suppressed because one or more lines are too long
38
schemas/index.d.ts
vendored
38
schemas/index.d.ts
vendored
|
@ -1,38 +0,0 @@
|
|||
import * as AccessLog from "./config/access_log";
|
||||
import * as Autocert from "./config/autocert";
|
||||
import * as Config from "./config/config";
|
||||
import * as Entrypoint from "./config/entrypoint";
|
||||
import * as Notification from "./config/notification";
|
||||
import * as Providers from "./config/providers";
|
||||
import * as MiddlewareCompose from "./middlewares/middleware_compose";
|
||||
import * as Middlewares from "./middlewares/middlewares";
|
||||
import * as Healthcheck from "./providers/healthcheck";
|
||||
import * as Homepage from "./providers/homepage";
|
||||
import * as IdleWatcher from "./providers/idlewatcher";
|
||||
import * as LoadBalance from "./providers/loadbalance";
|
||||
import * as Routes from "./providers/routes";
|
||||
import * as GoDoxy from "./types";
|
||||
import ConfigSchema from "./config.schema.json";
|
||||
import DockerRoutesSchema from "./docker_routes.schema.json";
|
||||
import MiddlewareComposeSchema from "./middleware_compose.schema.json";
|
||||
import RoutesSchema from "./routes.schema.json";
|
||||
export {
|
||||
AccessLog,
|
||||
Autocert,
|
||||
Config,
|
||||
ConfigSchema,
|
||||
DockerRoutesSchema,
|
||||
Entrypoint,
|
||||
GoDoxy,
|
||||
Healthcheck,
|
||||
Homepage,
|
||||
IdleWatcher,
|
||||
LoadBalance,
|
||||
MiddlewareCompose,
|
||||
MiddlewareComposeSchema,
|
||||
Middlewares,
|
||||
Notification,
|
||||
Providers,
|
||||
Routes,
|
||||
RoutesSchema,
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
import * as AccessLog from "./config/access_log";
|
||||
import * as Autocert from "./config/autocert";
|
||||
import * as Config from "./config/config";
|
||||
import * as Entrypoint from "./config/entrypoint";
|
||||
import * as Notification from "./config/notification";
|
||||
import * as Providers from "./config/providers";
|
||||
import * as MiddlewareCompose from "./middlewares/middleware_compose";
|
||||
import * as Middlewares from "./middlewares/middlewares";
|
||||
import * as Healthcheck from "./providers/healthcheck";
|
||||
import * as Homepage from "./providers/homepage";
|
||||
import * as IdleWatcher from "./providers/idlewatcher";
|
||||
import * as LoadBalance from "./providers/loadbalance";
|
||||
import * as Routes from "./providers/routes";
|
||||
import * as GoDoxy from "./types";
|
||||
import ConfigSchema from "./config.schema.json";
|
||||
import DockerRoutesSchema from "./docker_routes.schema.json";
|
||||
import MiddlewareComposeSchema from "./middleware_compose.schema.json";
|
||||
import RoutesSchema from "./routes.schema.json";
|
||||
export { AccessLog, Autocert, Config, ConfigSchema, DockerRoutesSchema, Entrypoint, GoDoxy, Healthcheck, Homepage, IdleWatcher, LoadBalance, MiddlewareCompose, MiddlewareComposeSchema, Middlewares, Notification, Providers, Routes, RoutesSchema, };
|
|
@ -1,43 +0,0 @@
|
|||
import * as AccessLog from "./config/access_log";
|
||||
import * as Autocert from "./config/autocert";
|
||||
import * as Config from "./config/config";
|
||||
import * as Entrypoint from "./config/entrypoint";
|
||||
import * as Notification from "./config/notification";
|
||||
import * as Providers from "./config/providers";
|
||||
|
||||
import * as MiddlewareCompose from "./middlewares/middleware_compose";
|
||||
import * as Middlewares from "./middlewares/middlewares";
|
||||
|
||||
import * as Healthcheck from "./providers/healthcheck";
|
||||
import * as Homepage from "./providers/homepage";
|
||||
import * as IdleWatcher from "./providers/idlewatcher";
|
||||
import * as LoadBalance from "./providers/loadbalance";
|
||||
import * as Routes from "./providers/routes";
|
||||
|
||||
import * as GoDoxy from "./types";
|
||||
|
||||
import ConfigSchema from "./config.schema.json";
|
||||
import DockerRoutesSchema from "./docker_routes.schema.json";
|
||||
import MiddlewareComposeSchema from "./middleware_compose.schema.json";
|
||||
import RoutesSchema from "./routes.schema.json";
|
||||
|
||||
export {
|
||||
AccessLog,
|
||||
Autocert,
|
||||
Config,
|
||||
ConfigSchema,
|
||||
DockerRoutesSchema,
|
||||
Entrypoint,
|
||||
GoDoxy,
|
||||
Healthcheck,
|
||||
Homepage,
|
||||
IdleWatcher,
|
||||
LoadBalance,
|
||||
MiddlewareCompose,
|
||||
MiddlewareComposeSchema,
|
||||
Middlewares,
|
||||
Notification,
|
||||
Providers,
|
||||
Routes,
|
||||
RoutesSchema,
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
{"$schema":"http://json-schema.org/draft-07/schema#","definitions":{"CIDR":{"anyOf":[{"pattern":"^[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*$","type":"string"},{"pattern":"^.*:.*:.*:.*:.*:.*:.*:.*$","type":"string"},{"pattern":"^[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*/[0-9]*$","type":"string"},{"pattern":"^::[0-9]*$","type":"string"},{"pattern":"^.*::/[0-9]*$","type":"string"},{"pattern":"^.*:.*::/[0-9]*$","type":"string"}]},"Duration":{"pattern":"^([0-9]+(ms|s|m|h))+$","type":"string"},"HTTPHeader":{"description":"HTTP Header","pattern":"^[a-zA-Z0-9\\-]+$","type":"string"},"MiddlewareComposeMap":{"anyOf":[{"additionalProperties":false,"properties":{"use":{"enum":["CustomErrorPage","ErrorPage","customErrorPage","custom_error_page","errorPage","error_page"],"type":"string"}},"required":["use"],"type":"object"},{"additionalProperties":false,"properties":{"bypass":{"additionalProperties":false,"description":"Bypass redirect","properties":{"user_agents":{"description":"Bypass redirect for user agents","items":{"type":"string"},"type":"array"}},"type":"object"},"use":{"enum":["RedirectHTTP","redirectHTTP","redirect_http"],"type":"string"}},"required":["use"],"type":"object"},{"additionalProperties":false,"properties":{"use":{"enum":["SetXForwarded","setXForwarded","set_x_forwarded"],"type":"string"}},"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","cloudflareRealIp","cloudflare_real_ip"],"type":"string"}},"required":["use"],"type":"object"},{"additionalProperties":false,"properties":{"add_headers":{"additionalProperties":false,"description":"Add HTTP headers","items":{"type":"string"},"type":"array"},"add_prefix":{"description":"Add prefix to request URL","type":"string"},"hide_headers":{"description":"Hide HTTP headers","items":{"$ref":"#/definitions/HTTPHeader"},"type":"array"},"set_headers":{"additionalProperties":false,"description":"Set HTTP headers","items":{"type":"string"},"type":"array"},"use":{"enum":["ModifyRequest","Request","modifyRequest","modify_request","request"],"type":"string"}},"required":["use"],"type":"object"},{"additionalProperties":false,"properties":{"add_headers":{"additionalProperties":false,"description":"Add HTTP headers","items":{"type":"string"},"type":"array"},"hide_headers":{"description":"Hide HTTP headers","items":{"$ref":"#/definitions/HTTPHeader"},"type":"array"},"set_headers":{"additionalProperties":false,"description":"Set HTTP headers","items":{"type":"string"},"type":"array"},"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":{"$ref":"#/definitions/Duration","default":"1s","description":"Duration of the rate limit"},"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":{"$ref":"#/definitions/HTTPHeader","default":"X-Real-IP","description":"Header to get the client IP from"},"recursive":{"default":false,"description":"Recursive resolve the IP","type":"boolean"},"use":{"enum":["RealIP","realIP","real_ip"],"type":"string"}},"required":["from","use"],"type":"object"}]},"StatusCode":{"anyOf":[{"pattern":"^[0-9]*$","type":"string"},{"type":"number"}]}},"items":{"$ref":"#/definitions/MiddlewareComposeMap"},"type":"array"}
|
2
schemas/middlewares/middleware_compose.d.ts
vendored
2
schemas/middlewares/middleware_compose.d.ts
vendored
|
@ -1,2 +0,0 @@
|
|||
import { MiddlewareComposeMap } from "./middlewares";
|
||||
export type MiddlewareCompose = MiddlewareComposeMap[];
|
|
@ -1 +0,0 @@
|
|||
export {};
|
|
@ -1,3 +0,0 @@
|
|||
import { MiddlewareComposeMap } from "./middlewares";
|
||||
|
||||
export type MiddlewareCompose = MiddlewareComposeMap[];
|
186
schemas/middlewares/middlewares.d.ts
vendored
186
schemas/middlewares/middlewares.d.ts
vendored
|
@ -1,186 +0,0 @@
|
|||
import * as types from "../types";
|
||||
export type KeyOptMapping<
|
||||
T extends {
|
||||
use: string;
|
||||
},
|
||||
> = {
|
||||
[key in T["use"]]?: Omit<T, "use">;
|
||||
};
|
||||
export declare const ALL_MIDDLEWARES: readonly [
|
||||
"ErrorPage",
|
||||
"RedirectHTTP",
|
||||
"SetXForwarded",
|
||||
"HideXForwarded",
|
||||
"CIDRWhitelist",
|
||||
"CloudflareRealIP",
|
||||
"ModifyRequest",
|
||||
"ModifyResponse",
|
||||
"OIDC",
|
||||
"RateLimit",
|
||||
"RealIP",
|
||||
];
|
||||
/**
|
||||
* @type object
|
||||
* @patternProperties {"^.*@file$": {"type": "null"}}
|
||||
*/
|
||||
export type MiddlewareFileRef = {
|
||||
[key: `${string}@file`]: null;
|
||||
};
|
||||
export type MiddlewaresMap =
|
||||
| (KeyOptMapping<CustomErrorPage> &
|
||||
KeyOptMapping<RedirectHTTP> &
|
||||
KeyOptMapping<SetXForwarded> &
|
||||
KeyOptMapping<HideXForwarded> &
|
||||
KeyOptMapping<CIDRWhitelist> &
|
||||
KeyOptMapping<CloudflareRealIP> &
|
||||
KeyOptMapping<ModifyRequest> &
|
||||
KeyOptMapping<ModifyResponse> &
|
||||
KeyOptMapping<OIDC> &
|
||||
KeyOptMapping<RateLimit> &
|
||||
KeyOptMapping<RealIP>)
|
||||
| MiddlewareFileRef;
|
||||
export type MiddlewareComposeMap =
|
||||
| CustomErrorPage
|
||||
| RedirectHTTP
|
||||
| SetXForwarded
|
||||
| HideXForwarded
|
||||
| CIDRWhitelist
|
||||
| CloudflareRealIP
|
||||
| ModifyRequest
|
||||
| ModifyResponse
|
||||
| OIDC
|
||||
| RateLimit
|
||||
| RealIP;
|
||||
export type CustomErrorPage = {
|
||||
use:
|
||||
| "error_page"
|
||||
| "errorPage"
|
||||
| "ErrorPage"
|
||||
| "custom_error_page"
|
||||
| "customErrorPage"
|
||||
| "CustomErrorPage";
|
||||
};
|
||||
export type RedirectHTTP = {
|
||||
use: "redirect_http" | "redirectHTTP" | "RedirectHTTP";
|
||||
/** Bypass redirect */
|
||||
bypass?: {
|
||||
/** Bypass redirect for user agents */
|
||||
user_agents?: string[];
|
||||
};
|
||||
};
|
||||
export type SetXForwarded = {
|
||||
use: "set_x_forwarded" | "setXForwarded" | "SetXForwarded";
|
||||
};
|
||||
export type HideXForwarded = {
|
||||
use: "hide_x_forwarded" | "hideXForwarded" | "HideXForwarded";
|
||||
};
|
||||
export type CIDRWhitelist = {
|
||||
use: "cidr_whitelist" | "cidrWhitelist" | "CIDRWhitelist";
|
||||
allow: types.CIDR[];
|
||||
/** HTTP status code when blocked
|
||||
*
|
||||
* @default 403
|
||||
*/
|
||||
status_code?: types.StatusCode;
|
||||
/** HTTP status code when blocked (alias of status_code)
|
||||
*
|
||||
* @default 403
|
||||
*/
|
||||
status?: types.StatusCode;
|
||||
/** Error message when blocked
|
||||
*
|
||||
* @default "IP not allowed"
|
||||
*/
|
||||
message?: string;
|
||||
};
|
||||
export type CloudflareRealIP = {
|
||||
use: "cloudflare_real_ip" | "cloudflareRealIp" | "CloudflareRealIP";
|
||||
/** Recursively resolve the IP
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
recursive?: boolean;
|
||||
};
|
||||
export type ModifyRequest = {
|
||||
use:
|
||||
| "request"
|
||||
| "Request"
|
||||
| "modify_request"
|
||||
| "modifyRequest"
|
||||
| "ModifyRequest";
|
||||
/** Set HTTP headers */
|
||||
set_headers?: {
|
||||
[key: types.HTTPHeader]: string;
|
||||
};
|
||||
/** Add HTTP headers */
|
||||
add_headers?: {
|
||||
[key: types.HTTPHeader]: string;
|
||||
};
|
||||
/** Hide HTTP headers */
|
||||
hide_headers?: types.HTTPHeader[];
|
||||
/** Add prefix to request URL */
|
||||
add_prefix?: string;
|
||||
};
|
||||
export type ModifyResponse = {
|
||||
use:
|
||||
| "response"
|
||||
| "Response"
|
||||
| "modify_response"
|
||||
| "modifyResponse"
|
||||
| "ModifyResponse";
|
||||
/** Set HTTP headers */
|
||||
set_headers?: {
|
||||
[key: types.HTTPHeader]: string;
|
||||
};
|
||||
/** Add HTTP headers */
|
||||
add_headers?: {
|
||||
[key: types.HTTPHeader]: string;
|
||||
};
|
||||
/** Hide HTTP headers */
|
||||
hide_headers?: types.HTTPHeader[];
|
||||
};
|
||||
export type OIDC = {
|
||||
use: "oidc" | "OIDC";
|
||||
/** Allowed users
|
||||
*
|
||||
* @minItems 1
|
||||
*/
|
||||
allowed_users?: string[];
|
||||
/** Allowed groups
|
||||
*
|
||||
* @minItems 1
|
||||
*/
|
||||
allowed_groups?: string[];
|
||||
};
|
||||
export type RateLimit = {
|
||||
use: "rate_limit" | "rateLimit" | "RateLimit";
|
||||
/** Average number of requests allowed in a period
|
||||
*
|
||||
* @min 1
|
||||
*/
|
||||
average: number;
|
||||
/** Maximum number of requests allowed in a period
|
||||
*
|
||||
* @min 1
|
||||
*/
|
||||
burst: number;
|
||||
/** Duration of the rate limit
|
||||
*
|
||||
* @default 1s
|
||||
*/
|
||||
period?: types.Duration;
|
||||
};
|
||||
export type RealIP = {
|
||||
use: "real_ip" | "realIP" | "RealIP";
|
||||
/** Header to get the client IP from
|
||||
*
|
||||
* @default "X-Real-IP"
|
||||
*/
|
||||
header?: types.HTTPHeader;
|
||||
from: types.CIDR[];
|
||||
/** Recursive resolve the IP
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
recursive?: boolean;
|
||||
};
|
|
@ -1,13 +0,0 @@
|
|||
export const ALL_MIDDLEWARES = [
|
||||
"ErrorPage",
|
||||
"RedirectHTTP",
|
||||
"SetXForwarded",
|
||||
"HideXForwarded",
|
||||
"CIDRWhitelist",
|
||||
"CloudflareRealIP",
|
||||
"ModifyRequest",
|
||||
"ModifyResponse",
|
||||
"OIDC",
|
||||
"RateLimit",
|
||||
"RealIP",
|
||||
];
|
|
@ -1,190 +0,0 @@
|
|||
import * as types from "../types";
|
||||
|
||||
export type KeyOptMapping<T extends { use: string }> = {
|
||||
[key in T["use"]]?: Omit<T, "use">;
|
||||
};
|
||||
|
||||
export const ALL_MIDDLEWARES = [
|
||||
"ErrorPage",
|
||||
"RedirectHTTP",
|
||||
"SetXForwarded",
|
||||
"HideXForwarded",
|
||||
"CIDRWhitelist",
|
||||
"CloudflareRealIP",
|
||||
"ModifyRequest",
|
||||
"ModifyResponse",
|
||||
"OIDC",
|
||||
"RateLimit",
|
||||
"RealIP",
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* @type object
|
||||
* @patternProperties {"^.*@file$": {"type": "null"}}
|
||||
*/
|
||||
export type MiddlewareFileRef = {
|
||||
[key: `${string}@file`]: null;
|
||||
};
|
||||
|
||||
export type MiddlewaresMap =
|
||||
| (KeyOptMapping<CustomErrorPage> &
|
||||
KeyOptMapping<RedirectHTTP> &
|
||||
KeyOptMapping<SetXForwarded> &
|
||||
KeyOptMapping<HideXForwarded> &
|
||||
KeyOptMapping<CIDRWhitelist> &
|
||||
KeyOptMapping<CloudflareRealIP> &
|
||||
KeyOptMapping<ModifyRequest> &
|
||||
KeyOptMapping<ModifyResponse> &
|
||||
KeyOptMapping<OIDC> &
|
||||
KeyOptMapping<RateLimit> &
|
||||
KeyOptMapping<RealIP>)
|
||||
| MiddlewareFileRef;
|
||||
|
||||
export type MiddlewareComposeMap =
|
||||
| CustomErrorPage
|
||||
| RedirectHTTP
|
||||
| SetXForwarded
|
||||
| HideXForwarded
|
||||
| CIDRWhitelist
|
||||
| CloudflareRealIP
|
||||
| ModifyRequest
|
||||
| ModifyResponse
|
||||
| OIDC
|
||||
| RateLimit
|
||||
| RealIP;
|
||||
|
||||
export type CustomErrorPage = {
|
||||
use:
|
||||
| "error_page"
|
||||
| "errorPage"
|
||||
| "ErrorPage"
|
||||
| "custom_error_page"
|
||||
| "customErrorPage"
|
||||
| "CustomErrorPage";
|
||||
};
|
||||
|
||||
export type RedirectHTTP = {
|
||||
use: "redirect_http" | "redirectHTTP" | "RedirectHTTP";
|
||||
/** Bypass redirect */
|
||||
bypass?: {
|
||||
/** Bypass redirect for user agents */
|
||||
user_agents?: string[];
|
||||
};
|
||||
};
|
||||
|
||||
export type SetXForwarded = {
|
||||
use: "set_x_forwarded" | "setXForwarded" | "SetXForwarded";
|
||||
};
|
||||
export type HideXForwarded = {
|
||||
use: "hide_x_forwarded" | "hideXForwarded" | "HideXForwarded";
|
||||
};
|
||||
|
||||
export type CIDRWhitelist = {
|
||||
use: "cidr_whitelist" | "cidrWhitelist" | "CIDRWhitelist";
|
||||
/* Allowed CIDRs/IPs */
|
||||
allow: types.CIDR[];
|
||||
/** HTTP status code when blocked
|
||||
*
|
||||
* @default 403
|
||||
*/
|
||||
status_code?: types.StatusCode;
|
||||
/** HTTP status code when blocked (alias of status_code)
|
||||
*
|
||||
* @default 403
|
||||
*/
|
||||
status?: types.StatusCode;
|
||||
/** Error message when blocked
|
||||
*
|
||||
* @default "IP not allowed"
|
||||
*/
|
||||
message?: string;
|
||||
};
|
||||
|
||||
export type CloudflareRealIP = {
|
||||
use: "cloudflare_real_ip" | "cloudflareRealIp" | "CloudflareRealIP";
|
||||
/** Recursively resolve the IP
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
recursive?: boolean;
|
||||
};
|
||||
|
||||
export type ModifyRequest = {
|
||||
use:
|
||||
| "request"
|
||||
| "Request"
|
||||
| "modify_request"
|
||||
| "modifyRequest"
|
||||
| "ModifyRequest";
|
||||
/** Set HTTP headers */
|
||||
set_headers?: { [key: types.HTTPHeader]: string };
|
||||
/** Add HTTP headers */
|
||||
add_headers?: { [key: types.HTTPHeader]: string };
|
||||
/** Hide HTTP headers */
|
||||
hide_headers?: types.HTTPHeader[];
|
||||
/** Add prefix to request URL */
|
||||
add_prefix?: string;
|
||||
};
|
||||
|
||||
export type ModifyResponse = {
|
||||
use:
|
||||
| "response"
|
||||
| "Response"
|
||||
| "modify_response"
|
||||
| "modifyResponse"
|
||||
| "ModifyResponse";
|
||||
/** Set HTTP headers */
|
||||
set_headers?: { [key: types.HTTPHeader]: string };
|
||||
/** Add HTTP headers */
|
||||
add_headers?: { [key: types.HTTPHeader]: string };
|
||||
/** Hide HTTP headers */
|
||||
hide_headers?: types.HTTPHeader[];
|
||||
};
|
||||
|
||||
export type OIDC = {
|
||||
use: "oidc" | "OIDC";
|
||||
/** Allowed users
|
||||
*
|
||||
* @minItems 1
|
||||
*/
|
||||
allowed_users?: string[];
|
||||
/** Allowed groups
|
||||
*
|
||||
* @minItems 1
|
||||
*/
|
||||
allowed_groups?: string[];
|
||||
};
|
||||
|
||||
export type RateLimit = {
|
||||
use: "rate_limit" | "rateLimit" | "RateLimit";
|
||||
/** Average number of requests allowed in a period
|
||||
*
|
||||
* @min 1
|
||||
*/
|
||||
average: number;
|
||||
/** Maximum number of requests allowed in a period
|
||||
*
|
||||
* @min 1
|
||||
*/
|
||||
burst: number;
|
||||
/** Duration of the rate limit
|
||||
*
|
||||
* @default 1s
|
||||
*/
|
||||
period?: types.Duration;
|
||||
};
|
||||
|
||||
export type RealIP = {
|
||||
use: "real_ip" | "realIP" | "RealIP";
|
||||
/** Header to get the client IP from
|
||||
*
|
||||
* @default "X-Real-IP"
|
||||
*/
|
||||
header?: types.HTTPHeader;
|
||||
from: types.CIDR[];
|
||||
/** Recursive resolve the IP
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
recursive?: boolean;
|
||||
};
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"name": "godoxy-schemas",
|
||||
"version": "0.10.1-6",
|
||||
"description": "JSON Schema and typescript types for GoDoxy configuration",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yusing/godoxy"
|
||||
},
|
||||
"files": [
|
||||
"**/*.ts",
|
||||
"**/*.js",
|
||||
"*.schema.json",
|
||||
"../README.md",
|
||||
"../LICENSE"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "./index.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.ts",
|
||||
"require": "./index.js"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.5.3",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-json-schema": "^0.65.1"
|
||||
},
|
||||
"displayName": "GoDoxy Types",
|
||||
"packageManager": "bun@1.2.9",
|
||||
"publisher": "yusing",
|
||||
"scripts": {
|
||||
"format:write": "prettier --write \"**/*.ts\" --cache"
|
||||
}
|
||||
}
|
32
schemas/providers/healthcheck.d.ts
vendored
32
schemas/providers/healthcheck.d.ts
vendored
|
@ -1,32 +0,0 @@
|
|||
import { Duration, URI } from "../types";
|
||||
/**
|
||||
* @additionalProperties false
|
||||
*/
|
||||
export type HealthcheckConfig = {
|
||||
/** Disable healthcheck
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
disable?: boolean;
|
||||
/** Healthcheck path
|
||||
*
|
||||
* @default /
|
||||
*/
|
||||
path?: URI;
|
||||
/**
|
||||
* Use GET instead of HEAD
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
use_get?: boolean;
|
||||
/** Healthcheck interval
|
||||
*
|
||||
* @default 5s
|
||||
*/
|
||||
interval?: Duration;
|
||||
/** Healthcheck timeout
|
||||
*
|
||||
* @default 5s
|
||||
*/
|
||||
timeout?: Duration;
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
export {};
|
|
@ -1,33 +0,0 @@
|
|||
import { Duration, URI } from "../types";
|
||||
|
||||
/**
|
||||
* @additionalProperties false
|
||||
*/
|
||||
export type HealthcheckConfig = {
|
||||
/** Disable healthcheck
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
disable?: boolean;
|
||||
/** Healthcheck path
|
||||
*
|
||||
* @default /
|
||||
*/
|
||||
path?: URI;
|
||||
/**
|
||||
* Use GET instead of HEAD
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
use_get?: boolean;
|
||||
/** Healthcheck interval
|
||||
*
|
||||
* @default 5s
|
||||
*/
|
||||
interval?: Duration;
|
||||
/** Healthcheck timeout
|
||||
*
|
||||
* @default 5s
|
||||
*/
|
||||
timeout?: Duration;
|
||||
};
|
27
schemas/providers/homepage.d.ts
vendored
27
schemas/providers/homepage.d.ts
vendored
|
@ -1,27 +0,0 @@
|
|||
import { URL } from "../types";
|
||||
/**
|
||||
* @additionalProperties false
|
||||
*/
|
||||
export type HomepageConfig = {
|
||||
/** Whether show in dashboard
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
show?: boolean;
|
||||
name?: string;
|
||||
icon?: URL | WalkxcodeIcon | ExternalIcon | TargetRelativeIconPath;
|
||||
description?: string;
|
||||
url?: URL;
|
||||
category?: string;
|
||||
widget_config?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
/** Walkxcode icon
|
||||
*
|
||||
* @pattern ^(png|svg|webp)\/[\w\d\-_]+\.\1
|
||||
* @type string
|
||||
*/
|
||||
export type WalkxcodeIcon = string & {};
|
||||
export type ExternalIcon = `@${"selfhst" | "walkxcode"}/${string}.${string}`;
|
||||
export type TargetRelativeIconPath = `@target/${string}` | `/${string}`;
|
|
@ -1 +0,0 @@
|
|||
export {};
|
|
@ -1,39 +0,0 @@
|
|||
import { URL } from "../types";
|
||||
|
||||
/**
|
||||
* @additionalProperties false
|
||||
*/
|
||||
export type HomepageConfig = {
|
||||
/** Whether show in dashboard
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
show?: boolean;
|
||||
/* Display name on dashboard */
|
||||
name?: string;
|
||||
/* Display icon on dashboard */
|
||||
icon?: URL | WalkxcodeIcon | ExternalIcon | TargetRelativeIconPath;
|
||||
/* App description */
|
||||
description?: string;
|
||||
/* Override url */
|
||||
url?: URL;
|
||||
/* App category */
|
||||
category?: string;
|
||||
/* Widget config */
|
||||
widget_config?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
|
||||
/** Walkxcode icon
|
||||
*
|
||||
* @pattern ^(png|svg|webp)\/[\w\d\-_]+\.\1
|
||||
* @type string
|
||||
*/
|
||||
export type WalkxcodeIcon = string & {};
|
||||
|
||||
/* Walkxcode / selfh.st icon */
|
||||
export type ExternalIcon = `@${"selfhst" | "walkxcode"}/${string}.${string}`;
|
||||
|
||||
/* Relative path to proxy target */
|
||||
export type TargetRelativeIconPath = `@target/${string}` | `/${string}`;
|
35
schemas/providers/idlewatcher.d.ts
vendored
35
schemas/providers/idlewatcher.d.ts
vendored
|
@ -1,35 +0,0 @@
|
|||
import { Duration, URI } from "../types";
|
||||
export declare const STOP_METHODS: readonly ["pause", "stop", "kill"];
|
||||
export type StopMethod = (typeof STOP_METHODS)[number];
|
||||
export declare const STOP_SIGNALS: readonly [
|
||||
"",
|
||||
"SIGINT",
|
||||
"SIGTERM",
|
||||
"SIGHUP",
|
||||
"SIGQUIT",
|
||||
"INT",
|
||||
"TERM",
|
||||
"HUP",
|
||||
"QUIT",
|
||||
];
|
||||
export type Signal = (typeof STOP_SIGNALS)[number];
|
||||
export type IdleWatcherConfig = {
|
||||
idle_timeout?: Duration;
|
||||
/** Wake timeout
|
||||
*
|
||||
* @default 30s
|
||||
*/
|
||||
wake_timeout?: Duration;
|
||||
/** Stop timeout
|
||||
*
|
||||
* @default 30s
|
||||
*/
|
||||
stop_timeout?: Duration;
|
||||
/** Stop method
|
||||
*
|
||||
* @default stop
|
||||
*/
|
||||
stop_method?: StopMethod;
|
||||
stop_signal?: Signal;
|
||||
start_endpoint?: URI;
|
||||
};
|
|
@ -1,12 +0,0 @@
|
|||
export const STOP_METHODS = ["pause", "stop", "kill"];
|
||||
export const STOP_SIGNALS = [
|
||||
"",
|
||||
"SIGINT",
|
||||
"SIGTERM",
|
||||
"SIGHUP",
|
||||
"SIGQUIT",
|
||||
"INT",
|
||||
"TERM",
|
||||
"HUP",
|
||||
"QUIT",
|
||||
];
|
|
@ -1,41 +0,0 @@
|
|||
import { Duration, URI } from "../types";
|
||||
|
||||
export const STOP_METHODS = ["pause", "stop", "kill"] as const;
|
||||
export type StopMethod = (typeof STOP_METHODS)[number];
|
||||
|
||||
export const STOP_SIGNALS = [
|
||||
"",
|
||||
"SIGINT",
|
||||
"SIGTERM",
|
||||
"SIGHUP",
|
||||
"SIGQUIT",
|
||||
"INT",
|
||||
"TERM",
|
||||
"HUP",
|
||||
"QUIT",
|
||||
] as const;
|
||||
export type Signal = (typeof STOP_SIGNALS)[number];
|
||||
|
||||
export type IdleWatcherConfig = {
|
||||
/* Idle timeout */
|
||||
idle_timeout?: Duration;
|
||||
/** Wake timeout
|
||||
*
|
||||
* @default 30s
|
||||
*/
|
||||
wake_timeout?: Duration;
|
||||
/** Stop timeout
|
||||
*
|
||||
* @default 30s
|
||||
*/
|
||||
stop_timeout?: Duration;
|
||||
/** Stop method
|
||||
*
|
||||
* @default stop
|
||||
*/
|
||||
stop_method?: StopMethod;
|
||||
/* Stop signal */
|
||||
stop_signal?: Signal;
|
||||
/* Start endpoint (any path can wake the container if not specified) */
|
||||
start_endpoint?: URI;
|
||||
};
|
38
schemas/providers/loadbalance.d.ts
vendored
38
schemas/providers/loadbalance.d.ts
vendored
|
@ -1,38 +0,0 @@
|
|||
import { RealIP } from "../middlewares/middlewares";
|
||||
export declare const LOAD_BALANCE_MODES: readonly [
|
||||
"round_robin",
|
||||
"least_conn",
|
||||
"ip_hash",
|
||||
];
|
||||
export type LoadBalanceMode = (typeof LOAD_BALANCE_MODES)[number];
|
||||
export type LoadBalanceConfigBase = {
|
||||
/** Alias (subdomain or FDN) of load-balancer
|
||||
*
|
||||
* @minLength 1
|
||||
*/
|
||||
link: string;
|
||||
/** Load-balance weight (reserved for future use)
|
||||
*
|
||||
* @minimum 0
|
||||
* @maximum 100
|
||||
*/
|
||||
weight?: number;
|
||||
};
|
||||
export type LoadBalanceConfig = LoadBalanceConfigBase &
|
||||
(
|
||||
| {}
|
||||
| RoundRobinLoadBalanceConfig
|
||||
| LeastConnLoadBalanceConfig
|
||||
| IPHashLoadBalanceConfig
|
||||
);
|
||||
export type IPHashLoadBalanceConfig = {
|
||||
mode: "ip_hash";
|
||||
/** Real IP config, header to get client IP from */
|
||||
config: RealIP;
|
||||
};
|
||||
export type LeastConnLoadBalanceConfig = {
|
||||
mode: "least_conn";
|
||||
};
|
||||
export type RoundRobinLoadBalanceConfig = {
|
||||
mode: "round_robin";
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
export const LOAD_BALANCE_MODES = [
|
||||
"round_robin",
|
||||
"least_conn",
|
||||
"ip_hash",
|
||||
];
|
|
@ -1,44 +0,0 @@
|
|||
import { RealIP } from "../middlewares/middlewares";
|
||||
|
||||
export const LOAD_BALANCE_MODES = [
|
||||
"round_robin",
|
||||
"least_conn",
|
||||
"ip_hash",
|
||||
] as const;
|
||||
export type LoadBalanceMode = (typeof LOAD_BALANCE_MODES)[number];
|
||||
|
||||
export type LoadBalanceConfigBase = {
|
||||
/** Alias (subdomain or FDN) of load-balancer
|
||||
*
|
||||
* @minLength 1
|
||||
*/
|
||||
link: string;
|
||||
/** Load-balance weight (reserved for future use)
|
||||
*
|
||||
* @minimum 0
|
||||
* @maximum 100
|
||||
*/
|
||||
weight?: number;
|
||||
};
|
||||
|
||||
export type LoadBalanceConfig = LoadBalanceConfigBase &
|
||||
(
|
||||
| {} // linking other routes
|
||||
| RoundRobinLoadBalanceConfig
|
||||
| LeastConnLoadBalanceConfig
|
||||
| IPHashLoadBalanceConfig
|
||||
);
|
||||
|
||||
export type IPHashLoadBalanceConfig = {
|
||||
mode: "ip_hash";
|
||||
/** Real IP config, header to get client IP from */
|
||||
config: RealIP;
|
||||
};
|
||||
|
||||
export type LeastConnLoadBalanceConfig = {
|
||||
mode: "least_conn";
|
||||
};
|
||||
|
||||
export type RoundRobinLoadBalanceConfig = {
|
||||
mode: "round_robin";
|
||||
};
|
148
schemas/providers/routes.d.ts
vendored
148
schemas/providers/routes.d.ts
vendored
|
@ -1,148 +0,0 @@
|
|||
import { AccessLogConfig } from "../config/access_log";
|
||||
import { accessLogExamples } from "../config/entrypoint";
|
||||
import { MiddlewaresMap } from "../middlewares/middlewares";
|
||||
import {
|
||||
Duration,
|
||||
Hostname,
|
||||
IPv4,
|
||||
IPv6,
|
||||
PathPattern,
|
||||
Port,
|
||||
StreamPort,
|
||||
} from "../types";
|
||||
import { HealthcheckConfig } from "./healthcheck";
|
||||
import { HomepageConfig } from "./homepage";
|
||||
import { LoadBalanceConfig } from "./loadbalance";
|
||||
export declare const PROXY_SCHEMES: readonly ["http", "https"];
|
||||
export declare const STREAM_SCHEMES: readonly ["tcp", "udp"];
|
||||
export type ProxyScheme = (typeof PROXY_SCHEMES)[number];
|
||||
export type StreamScheme = (typeof STREAM_SCHEMES)[number];
|
||||
export type Route = ReverseProxyRoute | FileServerRoute | StreamRoute;
|
||||
export type Routes = {
|
||||
[key: string]: Route;
|
||||
};
|
||||
export type ReverseProxyRoute = {
|
||||
/** Alias (subdomain or FDN)
|
||||
* @minLength 1
|
||||
*/
|
||||
alias?: string;
|
||||
/** Proxy scheme
|
||||
*
|
||||
* @default http
|
||||
*/
|
||||
scheme?: ProxyScheme;
|
||||
/** Proxy host
|
||||
*
|
||||
* @default localhost
|
||||
*/
|
||||
host?: Hostname | IPv4 | IPv6;
|
||||
/** Proxy port
|
||||
*
|
||||
* @default 80
|
||||
*/
|
||||
port?: Port;
|
||||
/** Skip TLS verification
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
no_tls_verify?: boolean;
|
||||
/** Response header timeout
|
||||
*
|
||||
* @default 60s
|
||||
*/
|
||||
response_header_timeout?: Duration;
|
||||
/** Path patterns (only patterns that match will be proxied).
|
||||
*
|
||||
* See https://pkg.go.dev/net/http#hdr-Patterns-ServeMux
|
||||
*/
|
||||
path_patterns?: PathPattern[];
|
||||
/** Healthcheck config */
|
||||
healthcheck?: HealthcheckConfig;
|
||||
/** Load balance config */
|
||||
load_balance?: LoadBalanceConfig;
|
||||
/** Middlewares */
|
||||
middlewares?: MiddlewaresMap;
|
||||
/** Homepage config
|
||||
*
|
||||
* @examples require(".").homepageExamples
|
||||
*/
|
||||
homepage?: HomepageConfig;
|
||||
/** Access log config
|
||||
*
|
||||
* @examples require(".").accessLogExamples
|
||||
*/
|
||||
access_log?: AccessLogConfig;
|
||||
};
|
||||
export type FileServerRoute = {
|
||||
/** Alias (subdomain or FDN)
|
||||
* @minLength 1
|
||||
*/
|
||||
alias?: string;
|
||||
scheme: "fileserver";
|
||||
root: string;
|
||||
/** Path patterns (only patterns that match will be proxied).
|
||||
*
|
||||
* See https://pkg.go.dev/net/http#hdr-Patterns-ServeMux
|
||||
*/
|
||||
path_patterns?: PathPattern[];
|
||||
/** Middlewares */
|
||||
middlewares?: MiddlewaresMap;
|
||||
/** Homepage config
|
||||
*
|
||||
* @examples require(".").homepageExamples
|
||||
*/
|
||||
homepage?: HomepageConfig;
|
||||
/** Access log config
|
||||
*
|
||||
* @examples require(".").accessLogExamples
|
||||
*/
|
||||
access_log?: AccessLogConfig;
|
||||
/** Healthcheck config */
|
||||
healthcheck?: HealthcheckConfig;
|
||||
};
|
||||
export type StreamRoute = {
|
||||
/** Alias (subdomain or FDN)
|
||||
* @minLength 1
|
||||
*/
|
||||
alias?: string;
|
||||
/** Stream scheme
|
||||
*
|
||||
* @default tcp
|
||||
*/
|
||||
scheme?: StreamScheme;
|
||||
/** Stream host
|
||||
*
|
||||
* @default localhost
|
||||
*/
|
||||
host?: Hostname | IPv4 | IPv6;
|
||||
port: StreamPort;
|
||||
/** Healthcheck config */
|
||||
healthcheck?: HealthcheckConfig;
|
||||
};
|
||||
export declare const homepageExamples: (
|
||||
| {
|
||||
name: string;
|
||||
icon: string;
|
||||
category: string;
|
||||
}
|
||||
| {
|
||||
name: string;
|
||||
icon: string;
|
||||
category?: undefined;
|
||||
}
|
||||
)[];
|
||||
export declare const loadBalanceExamples: (
|
||||
| {
|
||||
link: string;
|
||||
mode: string;
|
||||
config?: undefined;
|
||||
}
|
||||
| {
|
||||
link: string;
|
||||
mode: string;
|
||||
config: {
|
||||
header: string;
|
||||
};
|
||||
}
|
||||
)[];
|
||||
export { accessLogExamples };
|
|
@ -1,28 +0,0 @@
|
|||
import { accessLogExamples } from "../config/entrypoint";
|
||||
export const PROXY_SCHEMES = ["http", "https"];
|
||||
export const STREAM_SCHEMES = ["tcp", "udp"];
|
||||
export const homepageExamples = [
|
||||
{
|
||||
name: "Sonarr",
|
||||
icon: "png/sonarr.png",
|
||||
category: "Arr suite",
|
||||
},
|
||||
{
|
||||
name: "App",
|
||||
icon: "@target/favicon.ico",
|
||||
},
|
||||
];
|
||||
export const loadBalanceExamples = [
|
||||
{
|
||||
link: "flaresolverr",
|
||||
mode: "round_robin",
|
||||
},
|
||||
{
|
||||
link: "service.domain.com",
|
||||
mode: "ip_hash",
|
||||
config: {
|
||||
header: "X-Real-IP",
|
||||
},
|
||||
},
|
||||
];
|
||||
export { accessLogExamples };
|
|
@ -1,156 +0,0 @@
|
|||
import { AccessLogConfig } from "../config/access_log";
|
||||
import { accessLogExamples } from "../config/entrypoint";
|
||||
import { MiddlewaresMap } from "../middlewares/middlewares";
|
||||
import {
|
||||
Duration,
|
||||
Hostname,
|
||||
IPv4,
|
||||
IPv6,
|
||||
PathPattern,
|
||||
Port,
|
||||
StreamPort,
|
||||
} from "../types";
|
||||
import { HealthcheckConfig } from "./healthcheck";
|
||||
import { HomepageConfig } from "./homepage";
|
||||
import { LoadBalanceConfig } from "./loadbalance";
|
||||
export const PROXY_SCHEMES = ["http", "https"] as const;
|
||||
export const STREAM_SCHEMES = ["tcp", "udp"] as const;
|
||||
|
||||
export type ProxyScheme = (typeof PROXY_SCHEMES)[number];
|
||||
export type StreamScheme = (typeof STREAM_SCHEMES)[number];
|
||||
|
||||
export type Route = ReverseProxyRoute | FileServerRoute | StreamRoute;
|
||||
export type Routes = {
|
||||
[key: string]: Route;
|
||||
};
|
||||
|
||||
export type ReverseProxyRoute = {
|
||||
/** Alias (subdomain or FDN)
|
||||
* @minLength 1
|
||||
*/
|
||||
alias?: string;
|
||||
/** Proxy scheme
|
||||
*
|
||||
* @default http
|
||||
*/
|
||||
scheme?: ProxyScheme;
|
||||
/** Proxy host
|
||||
*
|
||||
* @default localhost
|
||||
*/
|
||||
host?: Hostname | IPv4 | IPv6;
|
||||
/** Proxy port
|
||||
*
|
||||
* @default 80
|
||||
*/
|
||||
port?: Port;
|
||||
/** Skip TLS verification
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
no_tls_verify?: boolean;
|
||||
/** Response header timeout
|
||||
*
|
||||
* @default 60s
|
||||
*/
|
||||
response_header_timeout?: Duration;
|
||||
/** Path patterns (only patterns that match will be proxied).
|
||||
*
|
||||
* See https://pkg.go.dev/net/http#hdr-Patterns-ServeMux
|
||||
*/
|
||||
path_patterns?: PathPattern[];
|
||||
/** Healthcheck config */
|
||||
healthcheck?: HealthcheckConfig;
|
||||
/** Load balance config */
|
||||
load_balance?: LoadBalanceConfig;
|
||||
/** Middlewares */
|
||||
middlewares?: MiddlewaresMap;
|
||||
/** Homepage config
|
||||
*
|
||||
* @examples require(".").homepageExamples
|
||||
*/
|
||||
homepage?: HomepageConfig;
|
||||
/** Access log config
|
||||
*
|
||||
* @examples require(".").accessLogExamples
|
||||
*/
|
||||
access_log?: AccessLogConfig;
|
||||
};
|
||||
|
||||
export type FileServerRoute = {
|
||||
/** Alias (subdomain or FDN)
|
||||
* @minLength 1
|
||||
*/
|
||||
alias?: string;
|
||||
scheme: "fileserver";
|
||||
/* File server root path */
|
||||
root: string;
|
||||
/** Path patterns (only patterns that match will be proxied).
|
||||
*
|
||||
* See https://pkg.go.dev/net/http#hdr-Patterns-ServeMux
|
||||
*/
|
||||
path_patterns?: PathPattern[];
|
||||
/** Middlewares */
|
||||
middlewares?: MiddlewaresMap;
|
||||
/** Homepage config
|
||||
*
|
||||
* @examples require(".").homepageExamples
|
||||
*/
|
||||
homepage?: HomepageConfig;
|
||||
/** Access log config
|
||||
*
|
||||
* @examples require(".").accessLogExamples
|
||||
*/
|
||||
access_log?: AccessLogConfig;
|
||||
/** Healthcheck config */
|
||||
healthcheck?: HealthcheckConfig;
|
||||
};
|
||||
|
||||
export type StreamRoute = {
|
||||
/** Alias (subdomain or FDN)
|
||||
* @minLength 1
|
||||
*/
|
||||
alias?: string;
|
||||
/** Stream scheme
|
||||
*
|
||||
* @default tcp
|
||||
*/
|
||||
scheme?: StreamScheme;
|
||||
/** Stream host
|
||||
*
|
||||
* @default localhost
|
||||
*/
|
||||
host?: Hostname | IPv4 | IPv6;
|
||||
/* Stream port */
|
||||
port: StreamPort;
|
||||
/** Healthcheck config */
|
||||
healthcheck?: HealthcheckConfig;
|
||||
};
|
||||
|
||||
export const homepageExamples = [
|
||||
{
|
||||
name: "Sonarr",
|
||||
icon: "png/sonarr.png",
|
||||
category: "Arr suite",
|
||||
},
|
||||
{
|
||||
name: "App",
|
||||
icon: "@target/favicon.ico",
|
||||
},
|
||||
];
|
||||
|
||||
export const loadBalanceExamples = [
|
||||
{
|
||||
link: "flaresolverr",
|
||||
mode: "round_robin",
|
||||
},
|
||||
{
|
||||
link: "service.domain.com",
|
||||
mode: "ip_hash",
|
||||
config: {
|
||||
header: "X-Real-IP",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export { accessLogExamples };
|
File diff suppressed because one or more lines are too long
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"strict": false,
|
||||
"esModuleInterop": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"allowJs": false,
|
||||
"resolveJsonModule": true,
|
||||
"declaration": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
109
schemas/types.d.ts
vendored
109
schemas/types.d.ts
vendored
|
@ -1,109 +0,0 @@
|
|||
/**
|
||||
* @type "null"
|
||||
*/
|
||||
export type Null = null;
|
||||
export type Nullable<T> = T | Null;
|
||||
export type NullOrEmptyMap = {} | Null;
|
||||
export declare const HTTP_METHODS: readonly [
|
||||
"GET",
|
||||
"POST",
|
||||
"PUT",
|
||||
"PATCH",
|
||||
"DELETE",
|
||||
"CONNECT",
|
||||
"HEAD",
|
||||
"OPTIONS",
|
||||
"TRACE",
|
||||
];
|
||||
export type HTTPMethod = (typeof HTTP_METHODS)[number];
|
||||
/**
|
||||
* HTTP Header
|
||||
* @pattern ^[a-zA-Z0-9\-]+$
|
||||
* @type string
|
||||
*/
|
||||
export type HTTPHeader = string & {};
|
||||
/**
|
||||
* HTTP Query
|
||||
* @pattern ^[a-zA-Z0-9\-_]+$
|
||||
* @type string
|
||||
*/
|
||||
export type HTTPQuery = string & {};
|
||||
/**
|
||||
* HTTP Cookie
|
||||
* @pattern ^[a-zA-Z0-9\-_]+$
|
||||
* @type string
|
||||
*/
|
||||
export type HTTPCookie = string & {};
|
||||
export type StatusCode = number | `${number}`;
|
||||
export type StatusCodeRange = number | `${number}` | `${number}-${number}`;
|
||||
/**
|
||||
* @pattern ^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
|
||||
*/
|
||||
export type DomainName = string & {};
|
||||
/**
|
||||
* @pattern ^(\*\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
|
||||
*/
|
||||
export type DomainOrWildcard = string & {};
|
||||
/**
|
||||
* @format hostname
|
||||
* @type string
|
||||
*/
|
||||
export type Hostname = string & {};
|
||||
/**
|
||||
* @format ipv4
|
||||
* @type string
|
||||
*/
|
||||
export type IPv4 = string & {};
|
||||
/**
|
||||
* @format ipv6
|
||||
* @type string
|
||||
*/
|
||||
export type IPv6 = string & {};
|
||||
export type CIDR =
|
||||
| `${number}.${number}.${number}.${number}`
|
||||
| `${string}:${string}:${string}:${string}:${string}:${string}:${string}:${string}`
|
||||
| `${number}.${number}.${number}.${number}/${number}`
|
||||
| `::${number}`
|
||||
| `${string}::/${number}`
|
||||
| `${string}:${string}::/${number}`;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @maximum 65535
|
||||
*/
|
||||
export type Port = number | `${number}`;
|
||||
/**
|
||||
* @pattern ^\d+:\d+$
|
||||
* @type string
|
||||
*/
|
||||
export type StreamPort = string & {};
|
||||
/**
|
||||
* @format email
|
||||
* @type string
|
||||
*/
|
||||
export type Email = string & {};
|
||||
/**
|
||||
* @format uri
|
||||
* @type string
|
||||
*/
|
||||
export type URL = string & {};
|
||||
/**
|
||||
* @format uri-reference
|
||||
* @type string
|
||||
*/
|
||||
export type URI = string & {};
|
||||
/**
|
||||
* @pattern ^(?:([A-Z]+) )?(?:([a-zA-Z0-9.-]+)\\/)?(\\/[^\\s]*)$
|
||||
* @type string
|
||||
*/
|
||||
export type PathPattern = string & {};
|
||||
/**
|
||||
* @pattern ^([0-9]+(ms|s|m|h))+$
|
||||
* @type string
|
||||
*/
|
||||
export type Duration = string & {};
|
||||
/**
|
||||
* @format date-time
|
||||
* @type string
|
||||
*/
|
||||
export type DateTime = string & {};
|
|
@ -1,11 +0,0 @@
|
|||
export const HTTP_METHODS = [
|
||||
"GET",
|
||||
"POST",
|
||||
"PUT",
|
||||
"PATCH",
|
||||
"DELETE",
|
||||
"CONNECT",
|
||||
"HEAD",
|
||||
"OPTIONS",
|
||||
"TRACE",
|
||||
];
|
127
schemas/types.ts
127
schemas/types.ts
|
@ -1,127 +0,0 @@
|
|||
/**
|
||||
* @type "null"
|
||||
*/
|
||||
export type Null = null;
|
||||
export type Nullable<T> = T | Null;
|
||||
export type NullOrEmptyMap = {} | Null;
|
||||
|
||||
export const HTTP_METHODS = [
|
||||
"GET",
|
||||
"POST",
|
||||
"PUT",
|
||||
"PATCH",
|
||||
"DELETE",
|
||||
"CONNECT",
|
||||
"HEAD",
|
||||
"OPTIONS",
|
||||
"TRACE",
|
||||
] as const;
|
||||
|
||||
export type HTTPMethod = (typeof HTTP_METHODS)[number];
|
||||
|
||||
// "string & {}" Prevents skipping schema generation
|
||||
|
||||
/**
|
||||
* HTTP Header
|
||||
* @pattern ^[a-zA-Z0-9\-]+$
|
||||
* @type string
|
||||
*/
|
||||
export type HTTPHeader = string & {};
|
||||
|
||||
/**
|
||||
* HTTP Query
|
||||
* @pattern ^[a-zA-Z0-9\-_]+$
|
||||
* @type string
|
||||
*/
|
||||
export type HTTPQuery = string & {};
|
||||
/**
|
||||
* HTTP Cookie
|
||||
* @pattern ^[a-zA-Z0-9\-_]+$
|
||||
* @type string
|
||||
*/
|
||||
export type HTTPCookie = string & {};
|
||||
|
||||
export type StatusCode = number | `${number}`;
|
||||
export type StatusCodeRange = number | `${number}` | `${number}-${number}`;
|
||||
|
||||
/**
|
||||
* @pattern ^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
|
||||
*/
|
||||
export type DomainName = string & {};
|
||||
/**
|
||||
* @pattern ^(\*\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
|
||||
*/
|
||||
export type DomainOrWildcard = string & {};
|
||||
/**
|
||||
* @format hostname
|
||||
* @type string
|
||||
*/
|
||||
export type Hostname = string & {};
|
||||
/**
|
||||
* @format ipv4
|
||||
* @type string
|
||||
*/
|
||||
export type IPv4 = string & {};
|
||||
/**
|
||||
* @format ipv6
|
||||
* @type string
|
||||
*/
|
||||
export type IPv6 = string & {};
|
||||
|
||||
/* CIDR / IPv4 / IPv6 */
|
||||
export type CIDR =
|
||||
| `${number}.${number}.${number}.${number}`
|
||||
| `${string}:${string}:${string}:${string}:${string}:${string}:${string}:${string}`
|
||||
| `${number}.${number}.${number}.${number}/${number}`
|
||||
| `::${number}`
|
||||
| `${string}::/${number}`
|
||||
| `${string}:${string}::/${number}`;
|
||||
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @maximum 65535
|
||||
*/
|
||||
export type Port = number | `${number}`;
|
||||
|
||||
/**
|
||||
* @pattern ^\d+:\d+$
|
||||
* @type string
|
||||
*/
|
||||
export type StreamPort = string & {};
|
||||
|
||||
/**
|
||||
* @format email
|
||||
* @type string
|
||||
*/
|
||||
export type Email = string & {};
|
||||
|
||||
/**
|
||||
* @format uri
|
||||
* @type string
|
||||
*/
|
||||
export type URL = string & {};
|
||||
|
||||
/**
|
||||
* @format uri-reference
|
||||
* @type string
|
||||
*/
|
||||
export type URI = string & {};
|
||||
|
||||
/**
|
||||
* @pattern ^(?:([A-Z]+) )?(?:([a-zA-Z0-9.-]+)\\/)?(\\/[^\\s]*)$
|
||||
* @type string
|
||||
*/
|
||||
export type PathPattern = string & {};
|
||||
|
||||
/**
|
||||
* @pattern ^([0-9]+(ms|s|m|h))+$
|
||||
* @type string
|
||||
*/
|
||||
export type Duration = string & {};
|
||||
|
||||
/**
|
||||
* @format date-time
|
||||
* @type string
|
||||
*/
|
||||
export type DateTime = string & {};
|
Loading…
Add table
Reference in a new issue