UNPKG

surgio

Version:

Generating rules for Surge, Clash, Quantumult like a PRO

91 lines (90 loc) 3.95 kB
import { NodeFilterType, PossibleNodeConfigType, ShadowsocksNodeConfig, ShadowsocksrNodeConfig, SortedNodeFilterType, VmessNodeConfig } from '../types'; export * from './surge'; export * from './surfboard'; export * from './clash'; export * from './singbox'; export * from './quantumult'; export * from './loon'; export * from './remote-snippet'; export * from './subscription'; export * from './time'; export * from './errors'; export * from './env-flag'; export { default as httpClient } from './http-client'; export declare const getDownloadUrl: (baseUrl: string | undefined, artifactName: string, inline?: boolean, accessToken?: string) => string; export declare const getUrl: (baseUrl: string, path: string, accessToken?: string) => string; export declare const toUrlSafeBase64: (str: string) => string; export declare const fromUrlSafeBase64: (str: string) => string; export declare const toBase64: (str: string) => string; export declare const fromBase64: (str: string) => string; export declare const toMD5: (str: string) => string; /** * @see https://github.com/shadowsocks/shadowsocks-org/wiki/SIP002-URI-Scheme */ export declare const getShadowsocksNodes: (list: ReadonlyArray<ShadowsocksNodeConfig>, groupName?: string) => string; export declare const getShadowsocksrNodes: (list: ReadonlyArray<ShadowsocksrNodeConfig>, groupName: string) => string; export declare const getV2rayNNodes: (list: ReadonlyArray<VmessNodeConfig>) => string; export declare const getShadowsocksNodesJSON: (list: ReadonlyArray<ShadowsocksNodeConfig>) => string; export declare const getNodeNames: (list: ReadonlyArray<PossibleNodeConfigType>, filter?: NodeFilterType | SortedNodeFilterType, separator?: string) => string; export declare const changeCase: (str: string, format: "camelCase" | "snakeCase" | "kebabCase") => string; export declare const pickAndFormatStringList: (obj: Record<string, any>, keyList: readonly string[], options?: { keyFormat?: "camelCase" | "snakeCase" | "kebabCase"; stringifyValue?: boolean; }) => readonly string[]; /** * Pick and format keys from an object * Input: * { * foo: 'bar', * bAr: 'bar', * bAz: 'baz', * } * * pickAndFormatKeys(obj, ['foo', 'bar'], { keyFormat: 'kebabCase' }) * * Output: * { * 'foo': 'bar', * 'b-ar': 'bar', * 'b-az': 'baz', * } */ export declare const pickAndFormatKeys: (obj: Record<string, any>, keyList: readonly string[], options?: { keyFormat?: "camelCase" | "snakeCase" | "kebabCase"; }) => Record<string, any>; export declare const decodeStringList: <T = Record<string, string | boolean>>(stringList: ReadonlyArray<string>) => T; export declare const ensureConfigFolder: (dir?: string) => string; export declare const lowercaseHeaderKeys: (headers: Record<string, string>) => Record<string, string>; export declare const isIp: (str: string) => boolean; export declare const isNow: () => boolean; export declare const isVercel: () => boolean; export declare const isHeroku: () => boolean; export declare const isGitHubActions: () => boolean; export declare const isGitLabCI: () => boolean; export declare const isRailway: () => boolean; export declare const isNetlify: () => boolean; export declare const isAWSLambda: () => boolean; export declare const isAWS: () => boolean; export declare const isFlyIO: () => boolean; export declare const isGFWFree: () => boolean; export declare const checkNotNullish: (val: unknown) => boolean; export declare const getPortFromHost: (host: string) => number; export declare const getHostnameFromHost: (host: string) => string; /** * Returned value must be in Mbps * * Input value can be: * - 1.2 Mbps * - 1.2 * - 1200 * - 1200 Kbps * - 1.2 Gbps * Return value will be: * - 1.2 * - 1.2 * - 1.2 * - 1.2 * - 1200 */ export declare const parseBitrate: (input: string | number) => number; export declare const getHeader: (headers: Record<string, string> | undefined, key: string) => string | undefined;