UNPKG

2.88 kBTypeScriptView Raw
1/// <reference types="node" />
2import { AgentOptions } from 'https';
3import { Destination } from '../connectivity/scp-cf/destination';
4import { ProxyConfiguration } from '../connectivity/scp-cf/connectivity-service-types';
5import { HttpAgentConfig, HttpsAgentConfig } from './agent-config';
6/**
7 * Determines the proxy strategy. If noProxy is set the ProxyConfiguration in the destination is omitted.
8 * For onPremProxy or internetProxy the connectivity service or environment variables are checked to fill the [[ProxyConfiguration]].
9 * @param destination - from which the proxy strategy is derived.
10 * @returns ProxyStrategy possible values are noProxy, internetProxy or onPremProxy.
11 */
12export declare function proxyStrategy(destination: Destination): ProxyStrategy;
13/**
14 * Parses the environment variable for the web proxy and extracts the values considering defaults like http for the protocol and 80 or 443 for the port.
15 * The general pattern to be parsed is `protocol://user:password@host:port`, where everything besides the host is optional.
16 * Special characters in the user and password need to be percent encoded.
17 * @param proxyEnvValue - Environment variable which is parsed.
18 * @returns Configuration with default values or `undefined` if the parsing failed.
19 */
20export declare function parseProxyEnv(proxyEnvValue: string): ProxyConfiguration | undefined;
21/**
22 * Adds the proxy configuration to a destination based on web proxies defined in environment variables. See [[ProxyConfiguration]] and [[proxyStrategy]] for details.
23 * @param destination - to which the proxy configuration is added.
24 * @returns Destination containing the configuration for web proxy.
25 */
26export declare function addProxyConfigurationInternet(destination: any): Destination;
27/**
28 * Builds the http(s)-agent config. Note that the proxy agent type like http or https is determined by the destination RUL protocol.
29 * The protocol from the proxy is unrelated to this and in most cases http.
30 * All additional options are forwarded to tls.connect and net.connect see https://github.com/TooTallNate/node-https-proxy-agent#new-httpsproxyagentobject-options
31 * @param destination - Destination containing the proxy configurations
32 * @param options - Additional options for the agent
33 * @returns The http(s)-agent containing the proxy configuration
34 */
35export declare function proxyAgent(destination: Destination, options?: AgentOptions): HttpAgentConfig | HttpsAgentConfig;
36/**
37 * Enum representing the different strategies for proxies on requests. Possible situations are "NO_PROXY", use the connectivity service proxy for On-Premise connection or a usual web proxy.
38 * See also [[ProxyConfiguration]] for more details.
39 */
40export declare enum ProxyStrategy {
41 NO_PROXY = 0,
42 ON_PREMISE_PROXY = 1,
43 INTERNET_PROXY = 2,
44 PRIVATELINK_PROXY = 3
45}
46//# sourceMappingURL=proxy-util.d.ts.map
\No newline at end of file