Class DefaultHttpProxyServer.DefaultHttpProxyServerBootstrap
- All Implemented Interfaces:
HttpProxyServerBootstrap
- Enclosing class:
- DefaultHttpProxyServer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final Collection<ActivityTracker>private booleanprivate booleanprivate booleanprivate ChainedProxyManagerprivate intprivate intprivate intprivate HttpFiltersSourceprivate intprivate InetSocketAddressprivate intprivate intprivate intprivate MitmManagerprivate Stringprivate intprivate Stringprivate ProxyAuthenticatorprivate intprivate longprivate InetSocketAddressprivate booleanprivate ServerGroupprivate HostResolverprivate SslEngineSourceprivate booleanprivate TransportProtocolprivate long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprivateprivateDefaultHttpProxyServerBootstrap(ServerGroup serverGroup, TransportProtocol transportProtocol, InetSocketAddress requestedAddress, SslEngineSource sslEngineSource, boolean authenticateSslClients, ProxyAuthenticator proxyAuthenticator, ChainedProxyManager chainProxyManager, MitmManager mitmManager, HttpFiltersSource filtersSource, boolean transparent, int idleConnectionTimeout, Collection<ActivityTracker> activityTrackers, int connectTimeout, HostResolver serverResolver, long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond, InetSocketAddress localAddress, String proxyAlias, int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean allowRequestToOriginServer) -
Method Summary
Modifier and TypeMethodDescriptionprivate DefaultHttpProxyServerbuild()private InetSocketAddressplusActivityTracker(ActivityTracker activityTracker) Add anActivityTrackerfor tracking activity in this proxy.start()Build and starts the server.withAcceptProxyProtocol(boolean acceptProxyProtocol) Specifies if the proxy server should accept a proxy protocol header.withAddress(InetSocketAddress address) Listen for incoming connections on the given address.withAllowLocalOnly(boolean allowLocalOnly) Specify whether or not to only allow local connections.withAllowRequestToOriginServer(boolean allowRequestToOriginServer) When true, the proxy will accept requests that appear to be directed at an origin server (i.e.withAuthenticateSslClients(boolean authenticateSslClients) Specify whether or not to authenticate inbound SSL clients (only applies ifHttpProxyServerBootstrap.withSslEngineSource(SslEngineSource)has been set).withChainProxyManager(ChainedProxyManager chainProxyManager) Specify aChainedProxyManagerto use for chaining requests to another proxy.withConnectTimeout(int connectTimeout) Specify the timeout for connecting to the upstream server on a new connection, in milliseconds.withFiltersSource(HttpFiltersSource filtersSource) Specify aHttpFiltersSourceto use for filtering requests and/or responses through this proxy.withIdleConnectionTimeout(int idleConnectionTimeout) Specify the timeout after which to disconnect idle connections, in seconds.withListenOnAllAddresses(boolean listenOnAllAddresses) Deprecated.withManInTheMiddle(MitmManager mitmManager) Specify anMitmManagerto use for making this proxy act as an SSL man in the middlewithMaxChunkSize(int maxChunkSize) withMaxHeaderSize(int maxHeaderSize) withMaxInitialLineLength(int maxInitialLineLength) Give the server a name (used for naming threads, useful for logging).withNetworkInterface(InetSocketAddress inetSocketAddress) All outgoing-communication of the proxy-instance is going' to be routed via the given network-interfacewithPort(int port) Listen for incoming connections on the given port.withProxyAlias(String alias) Sets the alias to use when adding Via headers to incoming and outgoing HTTP messages.withProxyAuthenticator(ProxyAuthenticator proxyAuthenticator) Specify aProxyAuthenticatorto use for doing basic HTTP authentication of clients.withSendProxyProtocol(boolean sendProxyProtocol) Specifies if the proxy server should send a proxy protocol header.withServerGroup(ServerGroup group) Specify a customServerGroupto use for managing this server's resources and such.withServerResolver(HostResolver serverResolver) Specify a customHostResolverfor resolving server addresses.withSslEngineSource(SslEngineSource sslEngineSource) Specify anSslEngineSourceto use for encrypting inbound connections.withThreadPoolConfiguration(ThreadPoolConfiguration configuration) Set the configuration parameters for the proxy's thread pools.withThrottling(long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond) Specify the read and/or write bandwidth throttles for this proxy server.withTransparent(boolean transparent) Specify whether or not to run this proxy as a transparent proxy.withTransportProtocol(TransportProtocol transportProtocol) Specify theTransportProtocolto use for incoming connections.withUseDnsSec(boolean useDnsSec) Specify whether or not to use secure DNS lookups for outbound connections.
-
Field Details
-
name
-
serverGroup
-
transportProtocol
-
requestedAddress
-
port
private int port -
allowLocalOnly
private boolean allowLocalOnly -
sslEngineSource
-
authenticateSslClients
private boolean authenticateSslClients -
proxyAuthenticator
-
chainProxyManager
-
mitmManager
-
filtersSource
-
transparent
private boolean transparent -
idleConnectionTimeout
private int idleConnectionTimeout -
activityTrackers
-
connectTimeout
private int connectTimeout -
serverResolver
-
readThrottleBytesPerSecond
private long readThrottleBytesPerSecond -
writeThrottleBytesPerSecond
private long writeThrottleBytesPerSecond -
localAddress
-
proxyAlias
-
clientToProxyAcceptorThreads
private int clientToProxyAcceptorThreads -
clientToProxyWorkerThreads
private int clientToProxyWorkerThreads -
proxyToServerWorkerThreads
private int proxyToServerWorkerThreads -
maxInitialLineLength
private int maxInitialLineLength -
maxHeaderSize
private int maxHeaderSize -
maxChunkSize
private int maxChunkSize -
allowRequestToOriginServer
private boolean allowRequestToOriginServer -
acceptProxyProtocol
private boolean acceptProxyProtocol -
sendProxyProtocol
private boolean sendProxyProtocol
-
-
Constructor Details
-
DefaultHttpProxyServerBootstrap
private DefaultHttpProxyServerBootstrap() -
DefaultHttpProxyServerBootstrap
private DefaultHttpProxyServerBootstrap(ServerGroup serverGroup, TransportProtocol transportProtocol, InetSocketAddress requestedAddress, SslEngineSource sslEngineSource, boolean authenticateSslClients, ProxyAuthenticator proxyAuthenticator, ChainedProxyManager chainProxyManager, MitmManager mitmManager, HttpFiltersSource filtersSource, boolean transparent, int idleConnectionTimeout, Collection<ActivityTracker> activityTrackers, int connectTimeout, HostResolver serverResolver, long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond, InetSocketAddress localAddress, String proxyAlias, int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean allowRequestToOriginServer) -
DefaultHttpProxyServerBootstrap
-
-
Method Details
-
withName
Description copied from interface:HttpProxyServerBootstrapGive the server a name (used for naming threads, useful for logging).
Default = LittleProxy
- Specified by:
withNamein interfaceHttpProxyServerBootstrap
-
withTransportProtocol
Description copied from interface:HttpProxyServerBootstrapSpecify the
TransportProtocolto use for incoming connections.Default = TCP
- Specified by:
withTransportProtocolin interfaceHttpProxyServerBootstrap
-
withAddress
Description copied from interface:HttpProxyServerBootstrapListen for incoming connections on the given address.
Default = [bound ip]:8080
- Specified by:
withAddressin interfaceHttpProxyServerBootstrap
-
withPort
Description copied from interface:HttpProxyServerBootstrapListen for incoming connections on the given port.
Default = 8080
- Specified by:
withPortin interfaceHttpProxyServerBootstrap
-
withNetworkInterface
Description copied from interface:HttpProxyServerBootstrapAll outgoing-communication of the proxy-instance is going' to be routed via the given network-interface- Specified by:
withNetworkInterfacein interfaceHttpProxyServerBootstrap- Parameters:
inetSocketAddress- to be used for outgoing communication
-
withProxyAlias
Description copied from interface:HttpProxyServerBootstrapSets the alias to use when adding Via headers to incoming and outgoing HTTP messages. The alias may be any pseudonym, or if not specified, defaults to the hostname of the local machine. See RFC 7230, section 5.7.1.- Specified by:
withProxyAliasin interfaceHttpProxyServerBootstrap- Parameters:
alias- the pseudonym to add to Via headers
-
withAllowLocalOnly
Description copied from interface:HttpProxyServerBootstrapSpecify whether or not to only allow local connections.
Default = true
- Specified by:
withAllowLocalOnlyin interfaceHttpProxyServerBootstrap
-
withListenOnAllAddresses
Deprecated.Description copied from interface:HttpProxyServerBootstrapThis method has no effect and will be removed in a future release.- Specified by:
withListenOnAllAddressesin interfaceHttpProxyServerBootstrap
-
withSslEngineSource
Description copied from interface:HttpProxyServerBootstrapSpecify an
SslEngineSourceto use for encrypting inbound connections. Enabling this will enable SSL client authentication by default (seeHttpProxyServerBootstrap.withAuthenticateSslClients(boolean))Default = null
Note - This and
HttpProxyServerBootstrap.withManInTheMiddle(MitmManager)are mutually exclusive.- Specified by:
withSslEngineSourcein interfaceHttpProxyServerBootstrap
-
withAuthenticateSslClients
Description copied from interface:HttpProxyServerBootstrapSpecify whether or not to authenticate inbound SSL clients (only applies if
HttpProxyServerBootstrap.withSslEngineSource(SslEngineSource)has been set).Default = true
- Specified by:
withAuthenticateSslClientsin interfaceHttpProxyServerBootstrap
-
withProxyAuthenticator
Description copied from interface:HttpProxyServerBootstrapSpecify a
ProxyAuthenticatorto use for doing basic HTTP authentication of clients.Default = null
- Specified by:
withProxyAuthenticatorin interfaceHttpProxyServerBootstrap
-
withChainProxyManager
Description copied from interface:HttpProxyServerBootstrapSpecify a
ChainedProxyManagerto use for chaining requests to another proxy.Default = null
- Specified by:
withChainProxyManagerin interfaceHttpProxyServerBootstrap
-
withManInTheMiddle
Description copied from interface:HttpProxyServerBootstrapSpecify an
MitmManagerto use for making this proxy act as an SSL man in the middleDefault = null
Note - This and
HttpProxyServerBootstrap.withSslEngineSource(SslEngineSource)are mutually exclusive.- Specified by:
withManInTheMiddlein interfaceHttpProxyServerBootstrap
-
withFiltersSource
Description copied from interface:HttpProxyServerBootstrapSpecify a
HttpFiltersSourceto use for filtering requests and/or responses through this proxy.Default = null
- Specified by:
withFiltersSourcein interfaceHttpProxyServerBootstrap
-
withUseDnsSec
Description copied from interface:HttpProxyServerBootstrapSpecify whether or not to use secure DNS lookups for outbound connections.
Default = false
- Specified by:
withUseDnsSecin interfaceHttpProxyServerBootstrap
-
withTransparent
Description copied from interface:HttpProxyServerBootstrapSpecify whether or not to run this proxy as a transparent proxy.
Default = false
- Specified by:
withTransparentin interfaceHttpProxyServerBootstrap
-
withIdleConnectionTimeout
Description copied from interface:HttpProxyServerBootstrapSpecify the timeout after which to disconnect idle connections, in seconds.
Default = 70
- Specified by:
withIdleConnectionTimeoutin interfaceHttpProxyServerBootstrap
-
withConnectTimeout
Description copied from interface:HttpProxyServerBootstrapSpecify the timeout for connecting to the upstream server on a new connection, in milliseconds.
Default = 40000
- Specified by:
withConnectTimeoutin interfaceHttpProxyServerBootstrap
-
withServerResolver
Description copied from interface:HttpProxyServerBootstrapSpecify a customHostResolverfor resolving server addresses.- Specified by:
withServerResolverin interfaceHttpProxyServerBootstrap
-
withServerGroup
Description copied from interface:HttpProxyServerBootstrapSpecify a customServerGroupto use for managing this server's resources and such. If one isn't provided, a default one will be created using theThreadPoolConfigurationprovided- Specified by:
withServerGroupin interfaceHttpProxyServerBootstrap- Parameters:
group- A custom server group
-
plusActivityTracker
Description copied from interface:HttpProxyServerBootstrapAdd an
ActivityTrackerfor tracking activity in this proxy.- Specified by:
plusActivityTrackerin interfaceHttpProxyServerBootstrap
-
withThrottling
public HttpProxyServerBootstrap withThrottling(long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond) Description copied from interface:HttpProxyServerBootstrapSpecify the read and/or write bandwidth throttles for this proxy server. 0 indicates not throttling.
- Specified by:
withThrottlingin interfaceHttpProxyServerBootstrap
-
withMaxInitialLineLength
- Specified by:
withMaxInitialLineLengthin interfaceHttpProxyServerBootstrap
-
withMaxHeaderSize
- Specified by:
withMaxHeaderSizein interfaceHttpProxyServerBootstrap
-
withMaxChunkSize
- Specified by:
withMaxChunkSizein interfaceHttpProxyServerBootstrap
-
withAllowRequestToOriginServer
Description copied from interface:HttpProxyServerBootstrapWhen true, the proxy will accept requests that appear to be directed at an origin server (i.e. the URI in the HTTP request will contain an origin-form, rather than an absolute-form, as specified in RFC 7230, section 5.3). This is useful when the proxy is acting as a gateway/reverse proxy. Note: This feature should not be enabled when running as a forward proxy; doing so may cause an infinite loop if the client requests the URI of the proxy.- Specified by:
withAllowRequestToOriginServerin interfaceHttpProxyServerBootstrap- Parameters:
allowRequestToOriginServer- when true, the proxy will accept origin-form HTTP requests
-
withAcceptProxyProtocol
Description copied from interface:HttpProxyServerBootstrapSpecifies if the proxy server should accept a proxy protocol header. Once set it works with request that include a proxy protocol header. The proxy server reads an incoming proxy protocol header from the client.- Specified by:
withAcceptProxyProtocolin interfaceHttpProxyServerBootstrap- Parameters:
acceptProxyProtocol- when true, the proxy will accept a proxy protocol header
-
withSendProxyProtocol
Description copied from interface:HttpProxyServerBootstrapSpecifies if the proxy server should send a proxy protocol header.- Specified by:
withSendProxyProtocolin interfaceHttpProxyServerBootstrap- Parameters:
sendProxyProtocol- when true, the proxy will send a proxy protocol header
-
start
Description copied from interface:HttpProxyServerBootstrapBuild and starts the server.
- Specified by:
startin interfaceHttpProxyServerBootstrap- Returns:
- the newly built and started server
-
withThreadPoolConfiguration
Description copied from interface:HttpProxyServerBootstrapSet the configuration parameters for the proxy's thread pools.- Specified by:
withThreadPoolConfigurationin interfaceHttpProxyServerBootstrap- Parameters:
configuration- thread pool configuration- Returns:
- proxy server bootstrap for chaining
-
build
-
determineListenAddress
-