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 interfaceThis interface makes unit testing easier by avoiding direct calls to static methods. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ProxyDetectorImpl.AuthenticationProviderprivate static final ProxyDetectorImpl.AuthenticationProviderprivate static final com.google.common.base.Supplier<ProxySelector> private static final StringDeprecated.Use the standard Java proxy configuration instead with flags such as: -Dhttps.proxyHost=HOST -Dhttps.proxyPort=PORTprivate static final Loggerprivate final InetSocketAddress(package private) static final Stringprivate final com.google.common.base.Supplier<ProxySelector> -
Constructor Summary
ConstructorsConstructorDescriptionA proxy selector that uses the globalProxySelector.getDefault()andProxyDetectorImpl.AuthenticationProviderto detect proxy parameters.ProxyDetectorImpl(com.google.common.base.Supplier<ProxySelector> proxySelector, ProxyDetectorImpl.AuthenticationProvider authenticationProvider, String proxyEnvString) -
Method Summary
Modifier and TypeMethodDescriptionprivate ProxiedSocketAddressdetectProxy(InetSocketAddress targetAddr) private static InetSocketAddressoverrideProxy(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.AuthenticationProviderto 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:ProxyDetectorGiven 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
ProxiedSocketAddresscontains 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:
proxyForin 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.
-