org.littleshoot.proxy.HttpProxyServerBootstrap Maven / Gradle / Ivy
Show all versions of littleproxy Show documentation
package org.littleshoot.proxy;
import java.net.InetSocketAddress;
/**
* Configures and starts an {@link HttpProxyServer}. The HttpProxyServer is
* built using {@link #start()}. Sensible defaults are available for all
* parameters such that {@link #start()} could be called immediately if you
* wish.
*/
public interface HttpProxyServerBootstrap {
/**
*
* Give the server a name (used for naming threads, useful for logging).
*
*
*
* Default = LittleProxy
*
*
* @param name
* @return
*/
HttpProxyServerBootstrap withName(String name);
/**
*
* Specify the {@link TransportProtocol} to use for incoming connections.
*
*
*
* Default = TCP
*
*
* @param transportProtocol
* @return
*/
HttpProxyServerBootstrap withTransportProtocol(
TransportProtocol transportProtocol);
/**
*
* Listen for incoming connections on the given address.
*
*
*
* Default = [bound ip]:8080
*
*
* @param address
* @return
*/
HttpProxyServerBootstrap withAddress(InetSocketAddress address);
/**
*
* Listen for incoming connections on the given port.
*
*
*
* Default = 8080
*
*
* @param port
* @return
*/
HttpProxyServerBootstrap withPort(int port);
/**
*
* Specify whether or not to only allow local connections.
*
*
*
* Default = true
*
*
* @param allowLocalOnly
* @return
*/
HttpProxyServerBootstrap withAllowLocalOnly(boolean allowLocalOnly);
/**
*
* Specify whether or not to listen on all interfaces.
*
*
*
* Default = false
*
*
* @param listenOnAllAddresses
* @return
*/
HttpProxyServerBootstrap withListenOnAllAddresses(
boolean listenOnAllAddresses);
/**
*
* Specify an {@link SslEngineSource} to use for encrypting inbound
* connections.
*
*
*
* Default = null
*
*
* @param sslEngineSource
* @return
*/
HttpProxyServerBootstrap withSslEngineSource(
SslEngineSource sslEngineSource);
/**
*
* Specify whether or not to authenticate inbound SSL clients (only applies
* if {@link #withSslEngineSource(SslEngineSource)} has been set).
*
*
*
* Default = true
*
*
* @param authenticateSslClients
* @return
*/
HttpProxyServerBootstrap withAuthenticateSslClients(
boolean authenticateSslClients);
/**
*
* Specify a {@link ProxyAuthenticator} to use for doing basic HTTP
* authentication of clients.
*
*
*
* Default = null
*
*
* @param proxyAuthenticator
* @return
*/
HttpProxyServerBootstrap withProxyAuthenticator(
ProxyAuthenticator proxyAuthenticator);
/**
*
* Specify a {@link ChainedProxyManager} to use for chaining requests to
* another proxy.
*
*
*
* Default = null
*
*
*
* Note - This and {@link #withManInTheMiddle(MitmManager)} are currently
* mutually exclusive.
*
*
* @param chainProxyManager
* @return
*/
HttpProxyServerBootstrap withChainProxyManager(
ChainedProxyManager chainProxyManager);
/**
*
* Specify an {@link MitmManager} to use for making this proxy act as an SSL
* man in the middle
*
*
*
* Default = null
*
*
*
* Note - This and {@link #withChainProxyManager(ChainedProxyManager)} are
* currently mutually exclusive.
*
*
* @param mitmManager
* @return
*/
HttpProxyServerBootstrap withManInTheMiddle(
MitmManager mitmManager);
/**
*
* Specify a {@link HttpFiltersSource} to use for filtering requests and/or
* responses through this proxy.
*
*
*
* Default = null
*
*
* @param filtersSource
* @return
*/
HttpProxyServerBootstrap withFiltersSource(
HttpFiltersSource filtersSource);
/**
*
* Specify whether or not to use secure DNS lookups for outbound
* connections.
*
*
*
* Default = false
*
*
* @param useDnsSec
* @return
*/
HttpProxyServerBootstrap withUseDnsSec(
boolean useDnsSec);
/**
*
* Specify whether or not to run this proxy as a transparent proxy.
*
*
*
* Default = false
*
*
* @param transparent
* @return
*/
HttpProxyServerBootstrap withTransparent(
boolean transparent);
/**
*
* Specify the timeout after which to disconnect idle connections, in
* seconds.
*
*
*
* Default = 70
*
*
* @param idleConnectionTimeout
* @return
*/
HttpProxyServerBootstrap withIdleConnectionTimeout(
int idleConnectionTimeout);
/**
*
* Add an {@link ActivityTracker} for tracking activity in this proxy.
*
*
* @param activityTracker
* @return
*/
HttpProxyServerBootstrap plusActivityTracker(ActivityTracker activityTracker);
/**
*
* Build and starts the server.
*
*
* @return the newly built and started server
*/
HttpProxyServer start();
}