Top Description Fields Constructors Methods
io.netty5.handler.ipfilter

public Class UniqueIpFilter

extends AbstractRemoteAddressFilter<InetSocketAddress>
Class Inheritance
Imports
io.netty5.channel.Channel, .ChannelHandlerContext, java.net.InetAddress, .InetSocketAddress, java.util.Set, java.util.concurrent.ConcurrentHashMap

This class allows one to ensure that at all times for every IP address there is at most one Channel connected to the server.

Field Summary

Modifier and TypeField and Description
private final Set<InetAddress>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
accept(ChannelHandlerContext ctx, InetSocketAddress remoteAddress)

Implements abstract io.netty5.handler.ipfilter.AbstractRemoteAddressFilter.accept.

This method is called immediately after a io.netty5.channel.Channel gets registered.
public boolean
isSharable()

Overrides default io.netty5.channel.ChannelHandler.isSharable.

Returns true if this handler is sharable and thus can be added to more than one ChannelPipeline.
Inherited from io.netty5.handler.ipfilter.AbstractRemoteAddressFilter:
channelAcceptedchannelActivechannelRegisteredchannelRejected

Field Detail

connectedback to summary
private final Set<InetAddress> connected

Constructor Detail

UniqueIpFilterback to summary
public UniqueIpFilter()

Method Detail

acceptback to summary
protected boolean accept(ChannelHandlerContext ctx, InetSocketAddress remoteAddress)

Implements abstract io.netty5.handler.ipfilter.AbstractRemoteAddressFilter.accept.

Doc from io.netty5.handler.ipfilter.AbstractRemoteAddressFilter.accept.

This method is called immediately after a io.netty5.channel.Channel gets registered.

Returns:boolean

Return true if connections from this IP address and port should be accepted. False otherwise.

Annotations
@Override
isSharableback to summary
public boolean isSharable()

Overrides default io.netty5.channel.ChannelHandler.isSharable.

Doc from io.netty5.channel.ChannelHandler.isSharable.

Returns true if this handler is sharable and thus can be added to more than one ChannelPipeline. By default, this method returns false. If this method returns false, you have to create a new handler instance every time you add it to a pipeline because it has unshared state such as member variables.

Annotations
@Override