@ChannelHandler.Sharable public class RuleBasedIpFilter extends AbstractRemoteAddressFilter<java.net.InetSocketAddress>
IpFilterRule
过滤新的Channel
。
如果没有提供规则,则所有连接都将被接受。
如果您想对拒绝的Channel
明确采取措施,则应覆盖AbstractRemoteAddressFilter.channelRejected(ChannelHandlerContext, SocketAddress)
。
ChannelHandler.Sharable
Constructor and Description |
---|
RuleBasedIpFilter(IpFilterRule... rules) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(ChannelHandlerContext ctx, java.net.InetSocketAddress remoteAddress)
在 Channel 获得注册后立即调用此方法。
|
channelAccepted, channelActive, channelRegistered, channelRejected
channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded, handlerRemoved
public RuleBasedIpFilter(IpFilterRule... rules)
protected boolean accept(ChannelHandlerContext ctx, java.net.InetSocketAddress remoteAddress) throws java.lang.Exception
AbstractRemoteAddressFilter
Channel
获得注册后立即调用此方法。
accept
在课堂上
AbstractRemoteAddressFilter<java.net.InetSocketAddress>
java.lang.Exception
Copyright © 2008–2018 The Netty Project. All rights reserved.