Package org.microproxy
Interface ChainedProxy
- All Superinterfaces:
SslContextSource
- All Known Implementing Classes:
ChainedProxyAdapter
An upstream proxy that requests are forwarded through.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidconnectionFailed(Throwable cause) Called when connecting fails; the proxy then tries the next chained proxy, if any.default voidCalled when the upstream proxy connection succeeds.default voidCalled when the upstream proxy connection closes.default voidfilterRequest(HttpObject httpObject) Last chance to modify each request object before it is sent to this proxy.Returns the upstream proxy address.default ChainedProxyTypeReturns the protocol spoken by the upstream proxy.default InetSocketAddressReturns the local address to bind when connecting, ornullfor any.default StringReturns the upstream authentication password, ornull.default SSLContextReturns the TLS context for this connection.default StringReturns user name for upstream authentication (HTTP Basic or SOCKS), ornull.default booleanhttp2()Whether to speak HTTP/2 to this proxy (anChainedProxyType.HTTPone) rather than HTTP/1.1: its connections are then shared, eachCONNECTtunnel and each plain-HTTP request a stream of one (RFC 9113 section 8.5), up to the proxy's SETTINGS_MAX_CONCURRENT_STREAMS, with another connection opened when they are full.default booleanReturns whether the connection to the chained proxy itself uses TLS (seegetSslContext()).Methods inherited from interface org.microproxy.SslContextSource
configure, getKeyMaterial
-
Method Details
-
getChainedProxyAddress
InetSocketAddress getChainedProxyAddress()Returns the upstream proxy address.- Returns:
- the upstream proxy address
-
getLocalAddress
Returns the local address to bind when connecting, ornullfor any.- Returns:
- the local address to bind when connecting, or
nullfor any
-
getChainedProxyType
Returns the protocol spoken by the upstream proxy.- Returns:
- the protocol spoken by the upstream proxy
-
getUsername
Returns user name for upstream authentication (HTTP Basic or SOCKS), ornull.- Returns:
- user name for upstream authentication (HTTP Basic or SOCKS), or
null
-
getPassword
Returns the upstream authentication password, ornull.- Returns:
- the upstream authentication password, or
null
-
requiresEncryption
default boolean requiresEncryption()Returns whether the connection to the chained proxy itself uses TLS (seegetSslContext()).- Returns:
- whether the connection to the chained proxy itself uses TLS (see
getSslContext())
-
http2
default boolean http2()Whether to speak HTTP/2 to this proxy (anChainedProxyType.HTTPone) rather than HTTP/1.1: its connections are then shared, eachCONNECTtunnel and each plain-HTTP request a stream of one (RFC 9113 section 8.5), up to the proxy's SETTINGS_MAX_CONCURRENT_STREAMS, with another connection opened when they are full. Over TLS (requiresEncryption())h2is offered with ALPN, next tohttp/1.1, which the proxy may choose instead; over plain TCP the proxy must speak HTTP/2 with prior knowledge (h2c). The connections are shared by every client, and by every chained proxy with the same address, TLS,SSLContextinstance, credentials and local address. Needs the http2-codec module on the class path, without which the proxy is reached over HTTP/1.1. The default is false.- Returns:
- whether to speak HTTP/2 to this proxy
-
getSslContext
Description copied from interface:SslContextSourceReturns the TLS context for this connection.- Specified by:
getSslContextin interfaceSslContextSource- Returns:
- the TLS context for this connection
-
filterRequest
Last chance to modify each request object before it is sent to this proxy.- Parameters:
httpObject- the request head or body piece
-
connectionSucceeded
default void connectionSucceeded()Called when the upstream proxy connection succeeds. -
connectionFailed
Called when connecting fails; the proxy then tries the next chained proxy, if any.- Parameters:
cause- the failure that triggered this event
-
disconnected
default void disconnected()Called when the upstream proxy connection closes.
-