public class DefaultHttpProxyManager extends Object implements HttpProxyManager
Primary implementation of an HttpProxyManager.
DefaultHttpProxyManager is bootstrapped by calling bootstrap() or bootstrapFromFile(String),
and then calling DefaultHttpProxyManager.DefaultHttpProxyManagerBootstrap.start(). For example:
DefaultHttpProxyServer server = DefaultHttpProxyServer.bootstrap().withPort(8090).start();
| 限定符和类型 | 类和说明 |
|---|---|
private static class |
DefaultHttpProxyManager.DefaultHttpProxyManagerBootstrap |
| 限定符 | 构造器和说明 |
|---|---|
private |
DefaultHttpProxyManager(ProxyConfigOptions proxyConfigOptions,
HttpProxyConfigOptions httpProxyConfigOptions,
String applicationName,
ServerGroup serverGroup,
TransportProtocol transportProtocol,
InetSocketAddress requestedAddress,
SslEngineSource sslEngineSource,
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)
已过时。
|
private |
DefaultHttpProxyManager(ProxyConfigOptions proxyConfigOptions,
HttpProxyConfigOptions httpProxyConfigOptions,
String applicationName,
ServerGroup serverGroup,
TransportProtocol transportProtocol,
InetSocketAddress requestedAddress,
SslEngineSource sslEngineSource,
HttpFiltersSource filtersSource,
boolean transparent,
int tcpBackLog,
int udpBackLog,
int idleConnectionTimeout,
Collection<ActivityTracker> activityTrackers,
int connectTimeout,
HostResolver serverResolver,
boolean enabledThrottle,
long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond,
long throttleCheckIntervalMills,
long maxTrafficDelaySeconds,
InetSocketAddress localAddress,
String proxyAlias,
int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize,
boolean allowDuplicateContentLengths,
boolean gracefulShutdown,
int gracefulShutdownAwaitSeconds,
long eventThreadPoolGracefulShutdownQuietPeriodSeconds,
long eventThreadPoolGracefulShutdownTimeoutSeconds,
int eventThreadPoolGracefulShutdownAwaitSeconds) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
abort()
Stops the server and all related clones immediately, without waiting for traffic to stop.
|
static HttpProxyManagerBootstrap |
bootstrap()
Bootstrap a new
DefaultHttpProxyManager starting from scratch. |
static HttpProxyManagerBootstrap |
bootstrapFromFile(String path)
已过时。
|
DefaultHttpProxyManager.DefaultHttpProxyManagerBootstrap |
clone()
Clone the existing server, with a port 1 higher and everything else the same.
|
protected void |
closeAllChannels(boolean graceful)
Closes all channels opened by this proxy server.
|
private io.netty.handler.traffic.GlobalTrafficShapingHandler |
createGlobalTrafficShapingHandler(TransportProtocol transportProtocol,
long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond)
已过时。
|
private io.netty.handler.traffic.GlobalTrafficShapingHandler |
createGlobalTrafficShapingHandler(TransportProtocol transportProtocol,
long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond,
long throttleCheckIntervalMills,
long maxTrafficDelaySeconds)
Creates a new GlobalTrafficShapingHandler for this HttpProxyServer, using this proxy's proxyToServerEventLoop.
|
private void |
doStart() |
protected void |
doStop(boolean graceful)
Performs cleanup necessary to stop the server.
|
Collection<ActivityTracker> |
getActivityTrackers() |
int |
getConnectTimeout()
Returns the maximum time to wait, in milliseconds, to connect to a server.
|
HttpFiltersSource |
getFiltersSource() |
int |
getIdleConnectionTimeout() |
int |
getInitialBufferSize() |
InetSocketAddress |
getListenAddress()
Return the address on which this proxy is listening.
|
InetSocketAddress |
getLocalAddress() |
int |
getMaxChunkSize() |
int |
getMaxHeaderSize() |
int |
getMaxInitialLineLength() |
String |
getProxyAlias() |
EventLoopGroup |
getProxyToServerWorkerFor(TransportProtocol transportProtocol) |
long |
getReadThrottle() |
HostResolver |
getServerResolver() |
protected SslEngineSource |
getSslEngineSource() |
long |
getWriteThrottle() |
boolean |
isAllowDuplicateContentLengths() |
boolean |
isTransparent() |
boolean |
isValidateHeaders() |
void |
registerChannel(Channel channel)
Register a new
Channel with this server, for later closing. |
void |
setConnectTimeout(int connectTimeoutMs)
Sets the maximum time to wait, in milliseconds, to connect to a server.
|
void |
setIdleConnectionTimeout(int idleConnectionTimeout) |
void |
setThrottle(boolean enableThrottle,
long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond,
long throttleCheckIntervalMills,
long maxTrafficDelaySeconds)
Set the read/write throttle bandwidths (in bytes/second) for this proxy.
|
void |
setThrottle(long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond)
Set the read/write throttle bandwidths (in bytes/second) for this proxy.
|
private HttpProxyManager |
start() |
void |
stop()
Stops the server and all related clones.
|
private static final org.slf4j.Logger LOG
private final AtomicBoolean runningMutex
private final String applicationName
private final ProxyConfigOptions proxyConfigOptions
private final HttpProxyConfigOptions httpProxyConfigOptions
private final ServerGroup serverGroup
private final TransportProtocol transportProtocol
private final InetSocketAddress requestedAddress
private volatile InetSocketAddress localAddress
private volatile InetSocketAddress boundAddress
private final SslEngineSource sslEngineSource
private final HttpFiltersSource filtersSource
private final boolean transparent
private final int tcpBackLog
private final int udpBackLog
private volatile int connectTimeout
private volatile int idleConnectionTimeout
private final HostResolver serverResolver
private volatile boolean enableThrottle
private volatile io.netty.handler.traffic.GlobalTrafficShapingHandler globalTrafficShapingHandler
private final int maxInitialLineLength
private final int maxHeaderSize
private final int maxChunkSize
private final boolean validateHeaders
private final int initialBufferSize
private final boolean allowDuplicateContentLengths
private final boolean gracefulShutdown
private int gracefulShutdownAwaitSeconds
private long eventThreadPoolGracefulShutdownQuietPeriodSeconds
private long eventThreadPoolGracefulShutdownTimeoutSeconds
private int eventThreadPoolGracefulShutdownAwaitSeconds
private final String proxyAlias
private final AtomicBoolean stopped
private final Collection<ActivityTracker> activityTrackers
private final io.netty.channel.group.ChannelGroup allChannels
@Deprecated private DefaultHttpProxyManager(ProxyConfigOptions proxyConfigOptions, HttpProxyConfigOptions httpProxyConfigOptions, String applicationName, ServerGroup serverGroup, TransportProtocol transportProtocol, InetSocketAddress requestedAddress, SslEngineSource sslEngineSource, 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)
private DefaultHttpProxyManager(ProxyConfigOptions proxyConfigOptions, HttpProxyConfigOptions httpProxyConfigOptions, String applicationName, ServerGroup serverGroup, TransportProtocol transportProtocol, InetSocketAddress requestedAddress, SslEngineSource sslEngineSource, HttpFiltersSource filtersSource, boolean transparent, int tcpBackLog, int udpBackLog, int idleConnectionTimeout, Collection<ActivityTracker> activityTrackers, int connectTimeout, HostResolver serverResolver, boolean enabledThrottle, long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond, long throttleCheckIntervalMills, long maxTrafficDelaySeconds, InetSocketAddress localAddress, String proxyAlias, int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths, boolean gracefulShutdown, int gracefulShutdownAwaitSeconds, long eventThreadPoolGracefulShutdownQuietPeriodSeconds, long eventThreadPoolGracefulShutdownTimeoutSeconds, int eventThreadPoolGracefulShutdownAwaitSeconds)
public static HttpProxyManagerBootstrap bootstrap()
DefaultHttpProxyManager starting from scratch.@Deprecated public static HttpProxyManagerBootstrap bootstrapFromFile(String path)
@Deprecated private io.netty.handler.traffic.GlobalTrafficShapingHandler createGlobalTrafficShapingHandler(TransportProtocol transportProtocol, long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond)
createGlobalTrafficShapingHandler(TransportProtocol, long, long, long, long) replaced.transportProtocol - transport protocolreadThrottleBytesPerSecond - read BPSwriteThrottleBytesPerSecond - write BPSGlobalTrafficShapingHandlerprivate io.netty.handler.traffic.GlobalTrafficShapingHandler createGlobalTrafficShapingHandler(TransportProtocol transportProtocol, long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond, long throttleCheckIntervalMills, long maxTrafficDelaySeconds)
transportProtocol - transport protocolreadThrottleBytesPerSecond - read BPSwriteThrottleBytesPerSecond - write BPSthrottleCheckIntervalMills - check interval in millisecondsmaxTrafficDelaySeconds - throttle delay in secondsGlobalTrafficShapingHandlerpublic boolean isTransparent()
isTransparent 在接口中 ProxyManagerpublic int getIdleConnectionTimeout()
getIdleConnectionTimeout 在接口中 ProxyManagerpublic void setIdleConnectionTimeout(int idleConnectionTimeout)
setIdleConnectionTimeout 在接口中 ProxyManagerpublic int getConnectTimeout()
ProxyManagergetConnectTimeout 在接口中 ProxyManagerpublic void setConnectTimeout(int connectTimeoutMs)
ProxyManagersetConnectTimeout 在接口中 ProxyManagerconnectTimeoutMs - connection timeout in millisecondspublic HostResolver getServerResolver()
getServerResolver 在接口中 ProxyManagerpublic InetSocketAddress getLocalAddress()
getLocalAddress 在接口中 ProxyManagerpublic InetSocketAddress getListenAddress()
ProxyManagergetListenAddress 在接口中 ProxyManagerpublic void setThrottle(long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond)
ProxyManagerSet the read/write throttle bandwidths (in bytes/second) for this proxy.
setThrottle 在接口中 ProxyManagerreadThrottleBytesPerSecond - read BPSwriteThrottleBytesPerSecond - write BPSpublic void setThrottle(boolean enableThrottle,
long readThrottleBytesPerSecond,
long writeThrottleBytesPerSecond,
long throttleCheckIntervalMills,
long maxTrafficDelaySeconds)
ProxyManagerSet the read/write throttle bandwidths (in bytes/second) for this proxy.
setThrottle 在接口中 ProxyManagerenableThrottle - enables throttlereadThrottleBytesPerSecond - read BPSwriteThrottleBytesPerSecond - write BPSthrottleCheckIntervalMills - check interval in millisecondsmaxTrafficDelaySeconds - throttle delay in secondspublic long getReadThrottle()
public long getWriteThrottle()
public int getMaxInitialLineLength()
getMaxInitialLineLength 在接口中 HttpProxyManagerpublic int getMaxHeaderSize()
getMaxHeaderSize 在接口中 HttpProxyManagerpublic int getMaxChunkSize()
getMaxChunkSize 在接口中 HttpProxyManagerpublic boolean isValidateHeaders()
isValidateHeaders 在接口中 HttpProxyManagerpublic int getInitialBufferSize()
getInitialBufferSize 在接口中 HttpProxyManagerpublic boolean isAllowDuplicateContentLengths()
public DefaultHttpProxyManager.DefaultHttpProxyManagerBootstrap clone()
HttpProxyManagerClone the existing server, with a port 1 higher and everything else the same. If the proxy was started with port 0 (JVM-assigned port), the cloned proxy will also use a JVM-assigned port.
The new server will share event loops with the original server. The event loops will use whatever name was given to the first server in the clone group. The server group will not terminate until the original server and all clones terminate.
clone 在接口中 HttpProxyManagerclone 在类中 Objectpublic void stop()
ProxyManagerstop 在接口中 ProxyManagerpublic void abort()
ProxyManagerabort 在接口中 ProxyManagerprotected void doStop(boolean graceful)
graceful - when true, waits for requests to terminate before stopping the serverpublic void registerChannel(Channel channel)
Channel with this server, for later closing.registerChannel 在接口中 ProxyManagerchannel - channelprotected void closeAllChannels(boolean graceful)
graceful - when false, attempts to shutdown all channels immediately and ignores any channel-closing exceptionsprivate HttpProxyManager start()
private void doStart()
protected SslEngineSource getSslEngineSource()
public HttpFiltersSource getFiltersSource()
getFiltersSource 在接口中 HttpProxyManagerpublic Collection<ActivityTracker> getActivityTrackers()
getActivityTrackers 在接口中 ProxyManagerpublic String getProxyAlias()
getProxyAlias 在接口中 ProxyManagerpublic EventLoopGroup getProxyToServerWorkerFor(TransportProtocol transportProtocol)
getProxyToServerWorkerFor 在接口中 ProxyManagerCopyright © 2022 Zodiac. All rights reserved.