surgio
Version:
查看完整使用文档,前往 [surgio.royli.dev](https://surgio.royli.dev)。
55 lines (54 loc) • 4.03 kB
TypeScript
import { JsonObject } from 'type-fest';
import { CommandConfig, HttpsNodeConfig, NodeFilterType, NodeNameFilterType, NodeTypeEnum, PlainObjectOf, PossibleNodeConfigType, ProxyGroupModifier, RemoteSnippet, RemoteSnippetConfig, ShadowsocksNodeConfig, ShadowsocksrNodeConfig, SimpleNodeConfig, VmessNodeConfig } from '../types';
export declare const OBFS_UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148";
export declare const resolveRoot: (...args: readonly string[]) => string;
export declare const getDownloadUrl: (baseUrl: string, artifactName: string) => string;
export declare const getBlackSSLConfig: (config: {
readonly username: string;
readonly password: string;
}) => Promise<readonly HttpsNodeConfig[]>;
export declare const getShadowsocksJSONConfig: (config: {
readonly url: string;
readonly udpRelay: boolean;
}) => Promise<readonly ShadowsocksNodeConfig[]>;
export declare const getShadowsocksSubscription: (config: {
readonly url: string;
readonly udpRelay?: boolean;
}) => Promise<readonly ShadowsocksNodeConfig[]>;
export declare const getShadowsocksrSubscription: (config: {
readonly url: string;
}) => Promise<readonly ShadowsocksrNodeConfig[]>;
export declare const getV2rayNSubscription: (config: {
readonly url: string;
}) => Promise<readonly VmessNodeConfig[]>;
export declare const getSurgeNodes: (list: readonly PossibleNodeConfigType[], filter?: NodeFilterType) => string;
export declare const getClashNodes: (list: readonly PossibleNodeConfigType[], filter?: NodeFilterType) => readonly any[];
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;
/**
* @see https://github.com/shadowsocks/shadowsocks-org/wiki/SIP002-URI-Scheme
*/
export declare const getShadowsocksNodes: (list: readonly ShadowsocksNodeConfig[], groupName?: string) => string;
export declare const getShadowsocksrNodes: (list: readonly ShadowsocksrNodeConfig[], groupName: string) => string;
export declare const getV2rayNNodes: (list: readonly VmessNodeConfig[]) => string;
export declare const getQuantumultNodes: (list: readonly (HttpsNodeConfig | ShadowsocksNodeConfig | ShadowsocksrNodeConfig | VmessNodeConfig)[], groupName?: string) => string;
export declare const getShadowsocksNodesJSON: (list: readonly ShadowsocksNodeConfig[]) => string;
export declare const getNodeNames: (list: readonly SimpleNodeConfig[], nodeTypeList?: readonly NodeTypeEnum[], filter?: NodeNameFilterType) => string;
export declare const getClashNodeNames: (ruleName: string, ruleType: "select" | "url-test", nodeNameList: readonly SimpleNodeConfig[], nodeTypeList?: readonly NodeTypeEnum[], filter?: NodeNameFilterType) => {
readonly type: string;
readonly name: string;
readonly proxies: readonly string[];
readonly url?: string;
readonly interval?: number;
};
export declare const toYaml: (obj: JsonObject) => string;
export declare const pickAndFormatStringList: (obj: object, keyList: readonly string[]) => readonly string[];
export declare const decodeStringList: <T = object>(stringList: readonly string[]) => T;
export declare const loadConfig: (cwd: string, configPath: string, override?: Partial<CommandConfig>) => CommandConfig;
export declare const normalizeClashProxyGroupConfig: (nodeList: readonly PossibleNodeConfigType[], customFilters: PlainObjectOf<NodeNameFilterType>, proxyGroupModifier: ProxyGroupModifier) => readonly any[];
export declare const addProxyToSurgeRuleSet: (str: string, rule: string) => string;
export declare const loadRemoteSnippetList: (remoteSnippetList: readonly RemoteSnippetConfig[]) => Promise<readonly RemoteSnippet[]>;
export declare const ensureConfigFolder: (dir?: string) => string;
export declare const formatV2rayConfig: (localPort: string | number, nodeConfig: VmessNodeConfig) => JsonObject;