public abstract class AbstractRemoteAddressFilter<T extends SocketAddress>
extends org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
Channels
based on their IP address.
*
You should inherit from this class if you would like to implement your own IP-based filter. Basically you have to
implement accept(ChannelHandlerContext, SocketAddress) to decided whether you want to accept or reject
a connection from the remote address.
*
Furthermore overriding channelRejected(ChannelHandlerContext, SocketAddress) gives you the
flexibility to respond to rejected (denied) connections. If you do not want to send a response, just have it return
null. Take a look at {RuleBasedIpFilter} for details.| Constructor and Description |
|---|
AbstractRemoteAddressFilter() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
accept(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
T remoteAddress)
This method is called immediately after a
io.netty.channel.Channel gets registered. |
protected void |
channelAccepted(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
T remoteAddress)
This method is called if
remoteAddress gets accepted by
accept(ChannelHandlerContext, SocketAddress). |
void |
channelActive(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRegistered(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx) |
protected org.apache.flink.shaded.netty4.io.netty.channel.ChannelFuture |
channelRejected(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
T remoteAddress)
This method is called if
remoteAddress gets rejected by
accept(ChannelHandlerContext, SocketAddress). |
channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharablepublic void channelRegistered(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelRegistered in interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerchannelRegistered in class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelActive(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelActive in interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerchannelActive in class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapterExceptionprotected abstract boolean accept(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
T remoteAddress)
throws Exception
io.netty.channel.Channel gets registered.Exceptionprotected void channelAccepted(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
T remoteAddress)
remoteAddress gets accepted by
accept(ChannelHandlerContext, SocketAddress). You should override it if you would like to handle
(e.g. respond to) accepted addresses.protected org.apache.flink.shaded.netty4.io.netty.channel.ChannelFuture channelRejected(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
T remoteAddress)
remoteAddress gets rejected by
accept(ChannelHandlerContext, SocketAddress). You should override it if you would like to handle
(e.g. respond to) rejected addresses.ChannelFuture if you perform I/O operations, so that
the Channel can be closed once it completes. Null otherwise.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.