fix npm package

This commit is contained in:
yusing
2025-01-25 02:36:22 +08:00
parent 4c311fd78e
commit 9e181d25ce
39 changed files with 984 additions and 5 deletions

32
schemas/providers/healthcheck.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
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;
};

View File

@@ -0,0 +1 @@
export {};

22
schemas/providers/homepage.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
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;
};
};
export type WalkxcodeIcon = `${"png" | "svg" | "webp"}/${string}/${string}.${string}`;
export type ExternalIcon = `@${"selfhst" | "walkxcode"}/${string}.${string}`;
export type TargetRelativeIconPath = `@target/${string}` | `/${string}`;

View File

@@ -0,0 +1 @@
export {};

25
schemas/providers/idlewatcher.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
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;
};

View File

@@ -0,0 +1,12 @@
export const STOP_METHODS = ["pause", "stop", "kill"];
export const STOP_SIGNALS = [
"",
"SIGINT",
"SIGTERM",
"SIGHUP",
"SIGQUIT",
"INT",
"TERM",
"HUP",
"QUIT",
];

28
schemas/providers/loadbalance.d.ts vendored Normal file
View File

@@ -0,0 +1,28 @@
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";
};

View File

@@ -0,0 +1,5 @@
export const LOAD_BALANCE_MODES = [
"round_robin",
"least_conn",
"ip_hash",
];

102
schemas/providers/routes.d.ts vendored Normal file
View File

@@ -0,0 +1,102 @@
import { AccessLogConfig } from "../config/access_log";
import { accessLogExamples } from "../config/entrypoint";
import { MiddlewaresMap } from "../middlewares/middlewares";
import { 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 | 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;
/** 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 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 };

View File

@@ -0,0 +1,28 @@
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 };