UNPKG

@alltiptop/geoip-3xui-rules

Version:

Middleware server to set routing rules by countries for XRAY

35 lines (34 loc) 1.78 kB
export interface XuiOptions { /** URL of the upstream 3x-ui endpoint (without trailing slash). */ panelAddress: string; /** Username of the 3x-ui panel. */ username: string; /** Password of the 3x-ui panel. */ password: string; /** Intbound ID of the 3x-ui panel. */ inboundIds: number[]; /** Debug mode. */ debug?: boolean; } export declare const get3xui: ({ panelAddress, username, password, inboundIds, debug, }: XuiOptions) => Promise<{ getUserTags: (subscriptionId: string) => string[]; }>; export interface CoreOptions { /** URL of the upstream 3x-ui endpoint (without trailing slash). */ upstreamUrl: string; /** Secret path segment protecting this proxy, e.g. `abc123` → `/abc123/json/:id` */ secretUrl: string; /** Directory with JSON rule presets (`RU.json`, `EU.json`, `BASE.json` …). */ rulesDir: string; /** Directory with JSON overrides presets (`RU.json`, `EU.json`, `BASE.json` …). */ overridesDir?: string; /** Inject direct‑route rules for the requester’s own country. */ directSameCountry?: boolean; /** Enable Fastify logger. */ logger?: boolean; /** Public Domain URL of the service. */ publicURL?: string; /** Options for the 3x-ui panel. */ xuiOptions?: XuiOptions; } export declare function createServer({ upstreamUrl, secretUrl, rulesDir, overridesDir, directSameCountry, logger, publicURL, xuiOptions, }: CoreOptions): Promise<import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;