-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathanonymize_proxy.d.ts
More file actions
40 lines (40 loc) · 1.94 KB
/
anonymize_proxy.d.ts
File metadata and controls
40 lines (40 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import type { Buffer } from "node:buffer";
import type http from "node:http";
import type net from "node:net";
export interface AnonymizeProxyOptions {
url: string;
port: number;
ignoreProxyCertificate?: boolean;
}
/**
* Parses and validates a HTTP proxy URL. If the proxy requires authentication,
* or if it is an HTTPS proxy and `ignoreProxyCertificate` is `true`, then the function
* starts an open local proxy server that forwards to the upstream proxy.
*/
export declare const anonymizeProxy: (options: string | AnonymizeProxyOptions, callback?: ((error: Error | null) => void) | undefined) => Promise<string>;
/**
* Closes anonymous proxy previously started by `anonymizeProxy()`.
* If proxy was not found or was already closed, the function has no effect
* and its result if `false`. Otherwise the result is `true`.
* @param closeConnections If true, pending proxy connections are forcibly closed.
*/
export declare const closeAnonymizedProxy: (anonymizedProxyUrl: string, closeConnections: boolean, callback?: ((error: Error | null, result?: boolean) => void) | undefined) => Promise<boolean>;
type Callback = ({ response, socket, head, }: {
response: http.IncomingMessage;
socket: net.Socket;
head: Buffer;
}) => void;
/**
* Add a callback on 'tunnelConnectResponded' Event in order to get headers from CONNECT tunnel to proxy
* Useful for some proxies that are using headers to send information like ProxyMesh
* @returns `true` if the callback is successfully configured, otherwise `false` (e.g. when an
* invalid proxy URL is given).
*/
export declare const listenConnectAnonymizedProxy: (anonymizedProxyUrl: string, tunnelConnectRespondedCallback: Callback) => boolean;
export declare const statisticsAnonymizedProxy: (anonymizedProxyUrl: string) => number;
export {};
//# sourceMappingURL=anonymize_proxy.d.ts.map