1 | import Provider from './provider/Provider';
|
2 | export declare enum NodeTypeEnum {
|
3 | HTTPS = "https",
|
4 | HTTP = "http",
|
5 | Shadowsocks = "shadowsocks",
|
6 | Shadowsocksr = "shadowsocksr",
|
7 | Snell = "snell",
|
8 | Vmess = "vmess",
|
9 | Trojan = "trojan",
|
10 | Socks5 = "socks5"
|
11 | }
|
12 | export declare enum SupportProviderEnum {
|
13 | Clash = "clash",
|
14 | Custom = "custom",
|
15 | ShadowsocksSubscribe = "shadowsocks_subscribe",
|
16 | ShadowsocksrSubscribe = "shadowsocksr_subscribe",
|
17 | ShadowsocksJsonSubscribe = "shadowsocks_json_subscribe",
|
18 | V2rayNSubscribe = "v2rayn_subscribe",
|
19 | BlackSSL = "blackssl",
|
20 | Ssd = "ssd"
|
21 | }
|
22 | export interface CommandConfig {
|
23 | readonly output: string;
|
24 | readonly artifacts: ReadonlyArray<ArtifactConfig>;
|
25 | readonly remoteSnippets?: ReadonlyArray<RemoteSnippetConfig>;
|
26 | readonly urlBase: string;
|
27 | publicUrl: string;
|
28 | readonly providerDir: string;
|
29 | readonly templateDir: string;
|
30 | readonly configDir: string;
|
31 | readonly analytics?: boolean;
|
32 | readonly checkHostname?: boolean;
|
33 | readonly upload?: {
|
34 | readonly prefix?: string;
|
35 | readonly region?: string;
|
36 | readonly endpoint?: string;
|
37 | readonly bucket: string;
|
38 | readonly accessKeyId: string;
|
39 | readonly accessKeySecret: string;
|
40 | };
|
41 | readonly binPath?: {
|
42 | readonly shadowsocksr?: string;
|
43 | readonly v2ray?: string;
|
44 | vmess?: string;
|
45 | };
|
46 | readonly surgeConfig?: {
|
47 | readonly shadowsocksFormat?: 'ss' | 'custom';
|
48 | readonly v2ray?: 'native' | 'external';
|
49 | readonly resolveHostname?: boolean;
|
50 | };
|
51 | readonly quantumultXConfig?: {};
|
52 | readonly clashConfig?: {
|
53 | readonly ssrFormat: 'native' | 'legacy';
|
54 | };
|
55 | readonly gateway?: {
|
56 | readonly accessToken?: string;
|
57 | readonly auth?: boolean;
|
58 | readonly cookieMaxAge?: number;
|
59 | };
|
60 | readonly proxyTestUrl?: string;
|
61 | readonly proxyTestInterval?: number;
|
62 | readonly customFilters?: {
|
63 | readonly [name: string]: NodeNameFilterType | SortedNodeNameFilterType;
|
64 | };
|
65 | readonly customParams?: PlainObjectOf<string | boolean | number>;
|
66 | }
|
67 | export interface RemoteSnippetConfig {
|
68 | readonly url: string;
|
69 | readonly name: string;
|
70 | }
|
71 | export interface RemoteSnippet extends RemoteSnippetConfig {
|
72 | readonly main: (rule: string) => string;
|
73 | readonly text: string;
|
74 | }
|
75 | export interface ArtifactConfig {
|
76 | readonly name: string;
|
77 | readonly template: string | undefined;
|
78 | readonly provider: string;
|
79 | readonly combineProviders?: ReadonlyArray<string>;
|
80 | readonly categories?: ReadonlyArray<string>;
|
81 | readonly customParams?: PlainObjectOf<string | boolean | number>;
|
82 | readonly proxyGroupModifier?: ProxyGroupModifier;
|
83 | readonly destDir?: string;
|
84 | readonly templateString?: string;
|
85 | readonly downloadUrl?: string;
|
86 | }
|
87 | export interface ProviderConfig {
|
88 | readonly type: SupportProviderEnum;
|
89 | readonly nodeFilter?: NodeFilterType | SortedNodeNameFilterType;
|
90 | readonly netflixFilter?: NodeNameFilterType | SortedNodeNameFilterType;
|
91 | readonly youtubePremiumFilter?: NodeNameFilterType | SortedNodeNameFilterType;
|
92 | readonly startPort?: number;
|
93 | readonly customFilters?: {
|
94 | readonly [name: string]: NodeNameFilterType | SortedNodeNameFilterType;
|
95 | };
|
96 | readonly addFlag?: boolean;
|
97 | readonly tfo?: boolean;
|
98 | readonly mptcp?: boolean;
|
99 | readonly renameNode?: (name: string) => string;
|
100 | readonly relayUrl?: boolean;
|
101 | }
|
102 | export interface BlackSSLProviderConfig extends ProviderConfig {
|
103 | readonly username: string;
|
104 | readonly password: string;
|
105 | }
|
106 | export interface ShadowsocksJsonSubscribeProviderConfig extends ProviderConfig {
|
107 | readonly url: string;
|
108 | readonly udpRelay?: boolean;
|
109 | }
|
110 | export interface ShadowsocksSubscribeProviderConfig extends ProviderConfig {
|
111 | readonly url: string;
|
112 | readonly udpRelay?: boolean;
|
113 | }
|
114 | export interface ShadowsocksrSubscribeProviderConfig extends ProviderConfig {
|
115 | readonly url: string;
|
116 | readonly udpRelay?: boolean;
|
117 | }
|
118 | export interface V2rayNSubscribeProviderConfig extends ProviderConfig {
|
119 | readonly url: string;
|
120 | readonly compatibleMode?: boolean;
|
121 | readonly skipCertVerify?: boolean;
|
122 | readonly udpRelay?: boolean;
|
123 | readonly tls13?: boolean;
|
124 | }
|
125 | export interface ClashProviderConfig extends ProviderConfig {
|
126 | readonly url: string;
|
127 | readonly udpRelay?: boolean;
|
128 | readonly tls13?: boolean;
|
129 | }
|
130 | export interface SsdProviderConfig extends ProviderConfig {
|
131 | readonly url: string;
|
132 | readonly udpRelay?: boolean;
|
133 | }
|
134 | export interface CustomProviderConfig extends ProviderConfig {
|
135 | readonly nodeList: ReadonlyArray<any>;
|
136 | }
|
137 | export interface HttpNodeConfig extends SimpleNodeConfig {
|
138 | readonly type: NodeTypeEnum.HTTP;
|
139 | readonly hostname: string;
|
140 | readonly port: number | string;
|
141 | readonly username: string;
|
142 | readonly password: string;
|
143 | }
|
144 | export interface HttpsNodeConfig extends SimpleNodeConfig {
|
145 | readonly type: NodeTypeEnum.HTTPS;
|
146 | readonly hostname: string;
|
147 | readonly port: number | string;
|
148 | readonly username: string;
|
149 | readonly password: string;
|
150 | readonly tls13?: boolean;
|
151 | readonly skipCertVerify?: boolean;
|
152 | readonly sni?: string;
|
153 | }
|
154 | export interface ShadowsocksNodeConfig extends SimpleNodeConfig {
|
155 | readonly type: NodeTypeEnum.Shadowsocks;
|
156 | readonly hostname: string;
|
157 | readonly port: number | string;
|
158 | readonly method: string;
|
159 | readonly password: string;
|
160 | readonly 'udp-relay'?: boolean;
|
161 | readonly obfs?: 'tls' | 'http' | 'ws' | 'wss';
|
162 | readonly 'obfs-host'?: string;
|
163 | readonly 'obfs-uri'?: string;
|
164 | readonly skipCertVerify?: boolean;
|
165 | readonly wsHeaders?: Record<string, string>;
|
166 | readonly tls13?: boolean;
|
167 | readonly mux?: boolean;
|
168 | }
|
169 | export interface SnellNodeConfig extends SimpleNodeConfig {
|
170 | readonly type: NodeTypeEnum.Snell;
|
171 | readonly hostname: string;
|
172 | readonly port: number | string;
|
173 | readonly psk: string;
|
174 | readonly obfs: string;
|
175 | readonly 'obfs-host'?: string;
|
176 | readonly version?: string;
|
177 | }
|
178 | export interface ShadowsocksrNodeConfig extends SimpleNodeConfig {
|
179 | readonly type: NodeTypeEnum.Shadowsocksr;
|
180 | readonly hostname: string;
|
181 | readonly port: number | string;
|
182 | readonly method: string;
|
183 | readonly protocol: string;
|
184 | readonly obfs: string;
|
185 | readonly password: string;
|
186 | readonly obfsparam: string;
|
187 | readonly protoparam: string;
|
188 | readonly 'udp-relay'?: boolean;
|
189 | }
|
190 | export interface VmessNodeConfig extends SimpleNodeConfig {
|
191 | readonly type: NodeTypeEnum.Vmess;
|
192 | readonly hostname: string;
|
193 | readonly port: number | string;
|
194 | readonly method: 'auto' | 'aes-128-gcm' | 'chacha20-ietf-poly1305' | 'none';
|
195 | readonly uuid: string;
|
196 | readonly alterId: string;
|
197 | readonly network: 'tcp' | 'ws';
|
198 | readonly tls: boolean;
|
199 | readonly host?: string;
|
200 | readonly path?: string;
|
201 | readonly 'udp-relay'?: boolean;
|
202 | readonly tls13?: boolean;
|
203 | readonly skipCertVerify?: boolean;
|
204 | readonly wsHeaders?: Record<string, string>;
|
205 | }
|
206 | export interface TrojanNodeConfig extends SimpleNodeConfig {
|
207 | readonly type: NodeTypeEnum.Trojan;
|
208 | readonly hostname: string;
|
209 | readonly port: number | string;
|
210 | readonly password: string;
|
211 | readonly skipCertVerify?: boolean;
|
212 | readonly alpn?: ReadonlyArray<string>;
|
213 | readonly sni?: string;
|
214 | readonly 'udp-relay'?: boolean;
|
215 | readonly tls13?: boolean;
|
216 | }
|
217 | export interface Socks5NodeConfig extends SimpleNodeConfig {
|
218 | readonly type: NodeTypeEnum.Socks5;
|
219 | readonly hostname: string;
|
220 | readonly port: number | string;
|
221 | readonly username?: string;
|
222 | readonly password?: string;
|
223 | readonly tls?: boolean;
|
224 | readonly skipCertVerify?: boolean;
|
225 | readonly udpRelay?: boolean;
|
226 | readonly sni?: string;
|
227 | readonly clientCert?: string;
|
228 | }
|
229 | export interface SimpleNodeConfig {
|
230 | readonly type: NodeTypeEnum;
|
231 | nodeName: string;
|
232 | readonly enable?: boolean;
|
233 | tfo?: boolean;
|
234 | mptcp?: boolean;
|
235 | binPath?: string;
|
236 | localPort?: number;
|
237 | surgeConfig?: CommandConfig['surgeConfig'];
|
238 | clashConfig?: CommandConfig['clashConfig'];
|
239 | hostnameIp?: ReadonlyArray<string>;
|
240 | provider?: Provider;
|
241 | underlyingProxy?: string;
|
242 | }
|
243 | export interface PlainObject {
|
244 | readonly [name: string]: any;
|
245 | }
|
246 | export interface PlainObjectOf<T> {
|
247 | readonly [name: string]: T;
|
248 | }
|
249 | export interface CreateServerOptions {
|
250 | readonly cwd?: string;
|
251 | }
|
252 | export interface SubscriptionUserinfo {
|
253 | readonly upload: number;
|
254 | readonly download: number;
|
255 | readonly total: number;
|
256 | readonly expire: number;
|
257 | }
|
258 | export declare type NodeFilterType = (nodeConfig: PossibleNodeConfigType) => boolean;
|
259 | export declare type NodeNameFilterType = (simpleNodeConfig: SimpleNodeConfig) => boolean;
|
260 | export interface SortedNodeNameFilterType {
|
261 | readonly filter: <T>(nodeList: ReadonlyArray<T & SimpleNodeConfig>) => ReadonlyArray<T & SimpleNodeConfig>;
|
262 | readonly supportSort?: boolean;
|
263 | }
|
264 | export declare type PossibleNodeConfigType = HttpsNodeConfig | HttpNodeConfig | ShadowsocksNodeConfig | ShadowsocksrNodeConfig | SnellNodeConfig | VmessNodeConfig | TrojanNodeConfig | Socks5NodeConfig;
|
265 | export declare type ProxyGroupModifier = (nodeList: ReadonlyArray<PossibleNodeConfigType>, filters: PlainObjectOf<NodeNameFilterType | SortedNodeNameFilterType>) => ReadonlyArray<{
|
266 | readonly name: string;
|
267 | readonly type: 'select' | 'url-test' | 'fallback' | 'load-balance';
|
268 | readonly proxies?: ReadonlyArray<string>;
|
269 | readonly filter?: NodeNameFilterType;
|
270 | }>;
|