org.littleshoot.proxy.ChainedProxyManager Java Examples
The following examples show how to use
org.littleshoot.proxy.ChainedProxyManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProxyToServerConnection.java From PowerTunnel with MIT License | 5 votes |
/** * Create a new ProxyToServerConnection. */ static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer, ClientToProxyConnection clientConnection, String serverHostAndPort, HttpFilters initialFilters, HttpRequest initialHttpRequest, GlobalTrafficShapingHandler globalTrafficShapingHandler) throws UnknownHostException { Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<>(); ChainedProxyManager chainedProxyManager = proxyServer .getChainProxyManager(); if (chainedProxyManager != null) { chainedProxyManager.lookupChainedProxies(initialHttpRequest, chainedProxies, clientConnection.getClientDetails()); if (chainedProxies.size() == 0) { // ChainedProxyManager returned no proxies, can't connect return null; } } return new ProxyToServerConnection(proxyServer, clientConnection, serverHostAndPort, chainedProxies.poll(), chainedProxies, initialFilters, globalTrafficShapingHandler); }
Example #2
Source File: ProxyToServerConnection.java From g4proxy with Apache License 2.0 | 5 votes |
/** * Create a new ProxyToServerConnection. * * @param proxyServer * @param clientConnection * @param serverHostAndPort * @param initialFilters * @param initialHttpRequest * @return * @throws UnknownHostException */ static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer, ClientToProxyConnection clientConnection, String serverHostAndPort, HttpFilters initialFilters, HttpRequest initialHttpRequest, GlobalTrafficShapingHandler globalTrafficShapingHandler) throws UnknownHostException { Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<ChainedProxy>(); ChainedProxyManager chainedProxyManager = proxyServer .getChainProxyManager(); if (chainedProxyManager != null) { chainedProxyManager.lookupChainedProxies(initialHttpRequest, chainedProxies); if (chainedProxies.size() == 0) { // ChainedProxyManager returned no proxies, can't connect return null; } } return new ProxyToServerConnection(proxyServer, clientConnection, serverHostAndPort, chainedProxies.poll(), chainedProxies, initialFilters, globalTrafficShapingHandler); }
Example #3
Source File: ProxyToServerConnection.java From yfs with Apache License 2.0 | 5 votes |
/** * Create a new ProxyToServerConnection. * * @param proxyServer * @param clientConnection * @param serverHostAndPort * @param initialFilters * @param initialHttpRequest * @return * @throws UnknownHostException */ static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer, ClientToProxyConnection clientConnection, String serverHostAndPort, HttpFilters initialFilters, HttpRequest initialHttpRequest, GlobalTrafficShapingHandler globalTrafficShapingHandler) throws UnknownHostException { Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<ChainedProxy>(); ChainedProxyManager chainedProxyManager = proxyServer .getChainProxyManager(); if (chainedProxyManager != null) { chainedProxyManager.lookupChainedProxies(initialHttpRequest, chainedProxies); if (chainedProxies.size() == 0) { // ChainedProxyManager returned no proxies, can't connect return null; } } return new ProxyToServerConnection(proxyServer, clientConnection, serverHostAndPort, chainedProxies.poll(), chainedProxies, initialFilters, globalTrafficShapingHandler); }
Example #4
Source File: BrowserMobProxyServer.java From Dream-Catcher with MIT License | 5 votes |
/** * Allows access to the LittleProxy {@link ChainedProxyManager} for fine-grained control of the chained proxies. To enable a single * chained proxy, {@link BrowserMobProxy#setChainedProxy(InetSocketAddress)} is generally more convenient. * * @param chainedProxyManager chained proxy manager to enable */ public void setChainedProxyManager(ChainedProxyManager chainedProxyManager) { if (isStarted()) { throw new IllegalStateException("Cannot configure chained proxy manager after proxy has started."); } this.chainedProxyManager = chainedProxyManager; }
Example #5
Source File: DefaultHttpProxyServer.java From g4proxy with Apache License 2.0 | 4 votes |
/** * Creates a new proxy server. * * @param serverGroup our ServerGroup for shared thread pools and such * @param transportProtocol The protocol to use for data transport * @param requestedAddress The address on which this server will listen * @param sslEngineSource (optional) if specified, this Proxy will encrypt inbound * connections from clients using an {@link SSLEngine} obtained * from this {@link SslEngineSource}. * @param authenticateSslClients Indicate whether or not to authenticate clients when using SSL * @param proxyAuthenticator (optional) If specified, requests to the proxy will be * authenticated using HTTP BASIC authentication per the provided * {@link ProxyAuthenticator} * @param chainProxyManager The proxy to send requests to if chaining proxies. Typically * <code>null</code>. * @param mitmManager The {@link MitmManager} to use for man in the middle'ing * CONNECT requests * @param filtersSource Source for {@link HttpFilters} * @param transparent If true, this proxy will run as a transparent proxy. This will * not modify the response, and will only modify the request to * amend the URI if the target is the origin server (to comply * with RFC 7230 section 5.3.1). * @param idleConnectionTimeout The timeout (in seconds) for auto-closing idle connections. * @param activityTrackers for tracking activity on this proxy * @param connectTimeout number of milliseconds to wait to connect to the upstream * server * @param serverResolver the {@link HostResolver} to use for resolving server addresses * @param readThrottleBytesPerSecond read throttle bandwidth * @param writeThrottleBytesPerSecond write throttle bandwidth * @param maxInitialLineLength * @param maxHeaderSize * @param maxChunkSize * @param allowRequestsToOriginServer when true, allow the proxy to handle requests that contain an origin-form URI, as defined in RFC 7230 5.3.1 */ private DefaultHttpProxyServer(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 allowRequestsToOriginServer) { this.serverGroup = serverGroup; this.transportProtocol = transportProtocol; this.requestedAddress = requestedAddress; this.sslEngineSource = sslEngineSource; this.authenticateSslClients = authenticateSslClients; this.proxyAuthenticator = proxyAuthenticator; this.chainProxyManager = chainProxyManager; this.mitmManager = mitmManager; this.filtersSource = filtersSource; this.transparent = transparent; this.idleConnectionTimeout = idleConnectionTimeout; if (activityTrackers != null) { this.activityTrackers.addAll(activityTrackers); } this.connectTimeout = connectTimeout; this.serverResolver = serverResolver; if (writeThrottleBytesPerSecond > 0 || readThrottleBytesPerSecond > 0) { this.globalTrafficShapingHandler = createGlobalTrafficShapingHandler(transportProtocol, readThrottleBytesPerSecond, writeThrottleBytesPerSecond); } else { this.globalTrafficShapingHandler = null; } this.localAddress = localAddress; if (proxyAlias == null) { // attempt to resolve the name of the local machine. if it cannot be resolved, use the fallback name. String hostname = ProxyUtils.getHostName(); if (hostname == null) { hostname = FALLBACK_PROXY_ALIAS; } this.proxyAlias = hostname; } else { this.proxyAlias = proxyAlias; } this.maxInitialLineLength = maxInitialLineLength; this.maxHeaderSize = maxHeaderSize; this.maxChunkSize = maxChunkSize; this.allowRequestsToOriginServer = allowRequestsToOriginServer; }
Example #6
Source File: DefaultHttpProxyServer.java From g4proxy with Apache License 2.0 | 4 votes |
protected ChainedProxyManager getChainProxyManager() { return chainProxyManager; }
Example #7
Source File: DefaultHttpProxyServer.java From g4proxy with Apache License 2.0 | 4 votes |
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) { this.serverGroup = serverGroup; this.transportProtocol = transportProtocol; this.requestedAddress = requestedAddress; this.port = requestedAddress.getPort(); this.sslEngineSource = sslEngineSource; this.authenticateSslClients = authenticateSslClients; this.proxyAuthenticator = proxyAuthenticator; this.chainProxyManager = chainProxyManager; this.mitmManager = mitmManager; this.filtersSource = filtersSource; this.transparent = transparent; this.idleConnectionTimeout = idleConnectionTimeout; if (activityTrackers != null) { this.activityTrackers.addAll(activityTrackers); } this.connectTimeout = connectTimeout; this.serverResolver = serverResolver; this.readThrottleBytesPerSecond = readThrottleBytesPerSecond; this.writeThrottleBytesPerSecond = writeThrottleBytesPerSecond; this.localAddress = localAddress; this.proxyAlias = proxyAlias; this.maxInitialLineLength = maxInitialLineLength; this.maxHeaderSize = maxHeaderSize; this.maxChunkSize = maxChunkSize; this.allowRequestToOriginServer = allowRequestToOriginServer; }
Example #8
Source File: DefaultHttpProxyServer.java From g4proxy with Apache License 2.0 | 4 votes |
@Override public HttpProxyServerBootstrap withChainProxyManager( ChainedProxyManager chainProxyManager) { this.chainProxyManager = chainProxyManager; return this; }
Example #9
Source File: BrowserUpProxyServer.java From browserup-proxy with Apache License 2.0 | 3 votes |
/** * Allows access to the LittleProxy {@link ChainedProxyManager} for fine-grained control of the chained proxies. To enable a single * chained proxy, {@link BrowserUpProxy#setChainedProxy(InetSocketAddress)} is generally more convenient. * * <b>Note:</b> The chained proxy manager must be enabled before calling {@link #start()}. * * @param chainedProxyManager chained proxy manager to enable */ public void setChainedProxyManager(ChainedProxyManager chainedProxyManager) { if (isStarted()) { throw new IllegalStateException("Cannot configure chained proxy manager after proxy has started."); } this.chainedProxyManager = chainedProxyManager; }
Example #10
Source File: BrowserMobProxyServer.java From CapturePacket with MIT License | 3 votes |
/** * Allows access to the LittleProxy {@link ChainedProxyManager} for fine-grained control of the chained proxies. To enable a single * chained proxy, {@link BrowserMobProxy#setChainedProxy(InetSocketAddress)} is generally more convenient. * * <b>Note:</b> The chained proxy manager must be enabled before calling {@link #start()}. * * @param chainedProxyManager chained proxy manager to enable */ public void setChainedProxyManager(ChainedProxyManager chainedProxyManager) { if (isStarted()) { throw new IllegalStateException("Cannot configure chained proxy manager after proxy has started."); } this.chainedProxyManager = chainedProxyManager; }
Example #11
Source File: BrowserMobProxyServer.java From AndroidHttpCapture with MIT License | 3 votes |
/** * Allows access to the LittleProxy {@link ChainedProxyManager} for fine-grained control of the chained proxies. To enable a single * chained proxy, {@link BrowserMobProxy#setChainedProxy(InetSocketAddress)} is generally more convenient. * * <b>Note:</b> The chained proxy manager must be enabled before calling {@link #start()}. * * @param chainedProxyManager chained proxy manager to enable */ public void setChainedProxyManager(ChainedProxyManager chainedProxyManager) { if (isStarted()) { throw new IllegalStateException("Cannot configure chained proxy manager after proxy has started."); } this.chainedProxyManager = chainedProxyManager; }