Class PortMapper
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<InetAddressedMessage<io.netty.buffer.ByteBuf>>
org.drasyl.handler.remote.portmapper.PortMapper
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class PortMapper
extends io.netty.channel.SimpleChannelInboundHandler<InetAddressedMessage<io.netty.buffer.ByteBuf>>
This handler tries to create a port forwarding for the UDP server using different methods (PCP,
NAT-PMP, UPnP-IGD, etc.). For this purpose, the individual methods are tried one after one. If
all methods fail, the program waits for
RETRY_DELAY and then tries all methods again. It
never gives up.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, InetAddressedMessage<io.netty.buffer.ByteBuf> msg) voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
MAPPING_LIFETIME
-
RETRY_DELAY
-
-
Constructor Details
-
PortMapper
public PortMapper()
-
-
Method Details
-
acceptInboundMessage
- Overrides:
acceptInboundMessagein classio.netty.channel.SimpleChannelInboundHandler<InetAddressedMessage<io.netty.buffer.ByteBuf>>
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, InetAddressedMessage<io.netty.buffer.ByteBuf> msg) - Specified by:
channelRead0in classio.netty.channel.SimpleChannelInboundHandler<InetAddressedMessage<io.netty.buffer.ByteBuf>>
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter
-
userEventTriggered
- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter
-