Package io.netty.handler.ipfilter
Class UniqueIpFilter
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.ipfilter.AbstractRemoteAddressFilter<InetSocketAddress>
io.netty.handler.ipfilter.UniqueIpFilter
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
This class allows one to ensure that at all times for every IP address there is at most one
Channel
connected to the server.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
accept
(ChannelHandlerContext ctx, InetSocketAddress remoteAddress) This method is called immediately after aChannel
gets registered.Methods inherited from class io.netty.handler.ipfilter.AbstractRemoteAddressFilter
channelAccepted, channelActive, channelRegistered, channelRejected
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
connected
-
-
Constructor Details
-
UniqueIpFilter
public UniqueIpFilter()
-
-
Method Details
-
accept
protected boolean accept(ChannelHandlerContext ctx, InetSocketAddress remoteAddress) throws Exception Description copied from class:AbstractRemoteAddressFilter
This method is called immediately after aChannel
gets registered.- Specified by:
accept
in classAbstractRemoteAddressFilter<InetSocketAddress>
- Returns:
- Return true if connections from this IP address and port should be accepted. False otherwise.
- Throws:
Exception
-