mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +02:00

* use auto generated schemas * go version bump and dependencies upgrade * clarify some error messages --------- Co-authored-by: yusing <yusing@6uo.me>
44 lines
937 B
TypeScript
44 lines
937 B
TypeScript
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";
|
|
};
|