import { URL } from 'url'; import http, { IncomingMessage, ServerResponse } from 'http'; import httpProxy from 'http-proxy'; import { pino, Logger } from 'pino'; import { ProxyOptions } from './interfaces/proxy-options.js'; import { ProxyRoute } from './interfaces/proxy-route.js'; import { RouteOptions } from './interfaces/route-options.js'; import { Resolver, ResolverFn } from './interfaces/resolver.js'; export declare class Redbird { private opts; logger?: Logger; routing: any; resolvers: Resolver[]; certs: any; lazyCerts: { [key: string]: { email: string; production: boolean; renewWithin: number; }; }; private _defaultResolver; private proxy; private agent; private server; private httpsServer; private letsencryptHost; private letsencryptServer; get defaultResolver(): any; constructor(opts?: ProxyOptions); setupHttpProxy(proxy: httpProxy, websocketsUpgrade: any, log: pino.Logger, opts: ProxyOptions): http.Server; /** * Special resolver for handling Let's Encrypt ACME challenges. * @param opts */ setupLetsencrypt(opts: ProxyOptions): void; setupHttpsProxy(proxy: httpProxy, websocketsUpgrade: any, sslOpts: any): void; addResolver(resolverFn: ResolverFn, priority?: number): this; removeResolver(resolverFn: ResolverFn): this; /** Register a new route. @src {String|URL} A string or a url parsed by node url module. Note that port is ignored, since the proxy just listens to one port. @target {String|URL} A string or a url parsed by node url module. @opts {Object} Route options. */ register(opts: { src: string | URL; target: string | URL; } & RouteOptions): Promise; register(src: string, opts: any): Promise; register(src: string | URL, target: string | URL, opts: RouteOptions): Promise; updateCertificates(domain: string, email: string, production: boolean, renewWithin: number, renew?: boolean): Promise; unregister(src: string | URL, target?: string | URL): Redbird; private applyResolvers; /** * Resolves to route * @param host * @param url * @returns {*} */ resolve(host: string, url?: string, req?: IncomingMessage): Promise; getTarget(src: string, req: IncomingMessage, res?: ServerResponse): Promise; getSource(req: IncomingMessage): string; close(): Promise; /** Routing table structure. An object with hostname as key, and an array as value. The array has one element per path associated to the given hostname. Every path has a Round-Robin value (rr) and urls array, with all the urls available for this target route. { hostA : [ { path: '/', rr: 3, urls: [] } ] } */ notFound(callback: any): void; shouldRedirectToHttps(target: any): boolean; } export declare const buildRoute: (route: string | ProxyRoute) => ProxyRoute | null; export declare const buildTarget: (target: string | URL, opts?: { ssl?: any; useTargetHostHeader?: boolean; }) => { sslRedirect: boolean; useTargetHostHeader: boolean; hash: string; host: string; hostname: string; href: string; origin: string; password: string; pathname: string; port: string; protocol: string; search: string; searchParams: import("url").URLSearchParams; username: string; } | { sslRedirect: boolean; useTargetHostHeader: boolean; query: string | null; auth: string | null; hash: string | null; host: string | null; hostname: string | null; href: string; path: string | null; pathname: string | null; protocol: string | null; search: string | null; slashes: boolean | null; port: string | null; };