Package io.grpc.internal
Class ProxyDetectorImpl
java.lang.Object
io.grpc.internal.ProxyDetectorImpl
- All Implemented Interfaces:
ProxyDetector
A utility class that detects proxies using
ProxySelector
and detects authentication
credentials using Authenticator
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface
This interface makes unit testing easier by avoiding direct calls to static methods. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ProxyDetectorImpl.AuthenticationProvider
private static final ProxyDetectorImpl.AuthenticationProvider
private static final com.google.common.base.Supplier
<ProxySelector> private static final String
Deprecated.Use the standard Java proxy configuration instead with flags such as: -Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORTprivate static final Logger
private final InetSocketAddress
(package private) static final String
private final com.google.common.base.Supplier
<ProxySelector> -
Constructor Summary
ConstructorsConstructorDescriptionA proxy selector that uses the globalProxySelector.getDefault()
andProxyDetectorImpl.AuthenticationProvider
to detect proxy parameters.ProxyDetectorImpl
(com.google.common.base.Supplier<ProxySelector> proxySelector, ProxyDetectorImpl.AuthenticationProvider authenticationProvider, String proxyEnvString) -
Method Summary
Modifier and TypeMethodDescriptionprivate ProxiedSocketAddress
detectProxy
(InetSocketAddress targetAddr) private static InetSocketAddress
overrideProxy
(String proxyHostPort) GRPC_PROXY_EXP is deprecated but let's maintain compatibility for now.proxyFor
(SocketAddress targetServerAddress) Given a target address, returns a proxied address if a proxy should be used.
-
Field Details
-
log
-
DEFAULT_AUTHENTICATOR
-
DEFAULT_PROXY_SELECTOR
-
GRPC_PROXY_ENV_VAR
Deprecated.Use the standard Java proxy configuration instead with flags such as: -Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORTExperimental environment variable name for enabling proxy support.- See Also:
-
proxySelector
-
authenticationProvider
-
overrideProxyAddress
-
PROXY_SCHEME
- See Also:
-
-
Constructor Details
-
ProxyDetectorImpl
public ProxyDetectorImpl()A proxy selector that uses the globalProxySelector.getDefault()
andProxyDetectorImpl.AuthenticationProvider
to detect proxy parameters. -
ProxyDetectorImpl
ProxyDetectorImpl(com.google.common.base.Supplier<ProxySelector> proxySelector, ProxyDetectorImpl.AuthenticationProvider authenticationProvider, @Nullable String proxyEnvString)
-
-
Method Details
-
proxyFor
@Nullable public ProxiedSocketAddress proxyFor(SocketAddress targetServerAddress) throws IOException Description copied from interface:ProxyDetector
Given a target address, returns a proxied address if a proxy should be used. If no proxy should be used, then return value will benull
.If the returned
ProxiedSocketAddress
contains any address that needs to be resolved locally, it should be resolved before it's returned, and this method throws if unable to resolve it.- Specified by:
proxyFor
in interfaceProxyDetector
- Parameters:
targetServerAddress
- the target address, which is generally unresolved, because the proxy will resolve it.- Throws:
IOException
-
detectProxy
- Throws:
IOException
-
overrideProxy
GRPC_PROXY_EXP is deprecated but let's maintain compatibility for now.
-