Package org.drasyl.channel
Class TraversingDrasylServerChannelInitializer
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelInitializer<DrasylServerChannel>
org.drasyl.channel.RelayOnlyDrasylServerChannelInitializer
org.drasyl.channel.TraversingDrasylServerChannelInitializer
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class TraversingDrasylServerChannelInitializer
extends RelayOnlyDrasylServerChannelInitializer
A
ChannelInitializer for DrasylServerChannels that tries to traverse (if any)
NATs with a fallback to relaying all messages through super peers.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsFields inherited from class org.drasyl.channel.RelayOnlyDrasylServerChannelInitializer
BIND_PORT, bindAddress, identity, MAX_PEERS, MAX_TIME_OFFSET_MILLIS, maxPeers, maxTimeOffsetMillis, NETWORK_ID, networkId, PING_INTERVAL_MILLIS, PING_TIMEOUT_MILLIS, pingIntervalMillis, pingTimeoutMillis, protocolArmEnabled, SUPER_PEERS, superPeers -
Constructor Summary
ConstructorsConstructorDescriptionTraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup) Creates a new channel initializer with default values forbindPort,networkId,superPeers,pingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers,pingCommunicationTimeoutMillis, and enabled control plane message arming.TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, int bindPort) Creates a new channel initializer with default values fornetworkId,superPeers,pingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers,pingCommunicationTimeoutMillis, and enabled control plane message arming.TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress) Creates a new channel initializer with default values fornetworkId,superPeers,pingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers,pingCommunicationTimeoutMillis, and enabled control plane message arming.TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress, int networkId, Map<IdentityPublicKey, InetSocketAddress> superPeers) Creates a new channel initializer with default values forpingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers,pingCommunicationTimeoutMillis, and enabled control plane message arming.TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress, int networkId, Map<IdentityPublicKey, InetSocketAddress> superPeers, boolean protocolArmEnabled) Creates a new channel initializer with default values forpingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers, andpingCommunicationTimeoutMillis.TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress, int networkId, Map<IdentityPublicKey, InetSocketAddress> superPeers, boolean protocolArmEnabled, int pingIntervalMillis, int pingTimeoutMillis, int maxTimeOffsetMillis, int maxPeers, int pingCommunicationTimeoutMillis) -
Method Summary
Methods inherited from class io.netty.channel.ChannelInitializer
channelRegistered, exceptionCaught, handlerAdded, handlerRemovedMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Field Details
-
PING_COMMUNICATION_TIMEOUT_MILLIS
public static final int PING_COMMUNICATION_TIMEOUT_MILLIS- See Also:
-
-
Constructor Details
-
TraversingDrasylServerChannelInitializer
public TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress, int networkId, Map<IdentityPublicKey, InetSocketAddress> superPeers, boolean protocolArmEnabled, int pingIntervalMillis, int pingTimeoutMillis, int maxTimeOffsetMillis, int maxPeers, int pingCommunicationTimeoutMillis) - Parameters:
identity- own identityudpServerGroup- theNioEventLoopGroupthe underlying udp server should run onbindAddress- address the UDP server will bind to. Default value: 0.0.0.0:RelayOnlyDrasylServerChannelInitializer.BIND_PORTnetworkId- the network we belong to. Default value:RelayOnlyDrasylServerChannelInitializer.NETWORK_IDsuperPeers- list of super peers we register to. Default value:RelayOnlyDrasylServerChannelInitializer.SUPER_PEERSprotocolArmEnabled- iftrueall control plane messages will be encrypted/authenticated. Default value:truepingIntervalMillis- interval in millis between a ping. Default value:RelayOnlyDrasylServerChannelInitializer.PING_INTERVAL_MILLISpingTimeoutMillis- time in millis without ping response before a peer is assumed as unreachable. Default value:RelayOnlyDrasylServerChannelInitializer.PING_TIMEOUT_MILLISmaxTimeOffsetMillis- time millis offset of received messages' timestamp before discarding them. Default value:RelayOnlyDrasylServerChannelInitializer.MAX_TIME_OFFSET_MILLISmaxPeers- maximum number of peers to which a traversed connection should be maintained at the same time. Default value:RelayOnlyDrasylServerChannelInitializer.MAX_PEERSpingCommunicationTimeoutMillis- time in millis a traversed connection to a peer will be discarded without application traffic. Default value:PING_COMMUNICATION_TIMEOUT_MILLIS
-
TraversingDrasylServerChannelInitializer
public TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress, int networkId, Map<IdentityPublicKey, InetSocketAddress> superPeers, boolean protocolArmEnabled) Creates a new channel initializer with default values forpingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers, andpingCommunicationTimeoutMillis.- Parameters:
identity- own identityudpServerGroup- theNioEventLoopGroupthe underlying udp server should run onbindAddress- address the UDP server will bind to. Default value: 0.0.0.0:RelayOnlyDrasylServerChannelInitializer.BIND_PORTnetworkId- the network we belong to. Default value:RelayOnlyDrasylServerChannelInitializer.NETWORK_IDsuperPeers- list of super peers we register to. Default value:RelayOnlyDrasylServerChannelInitializer.SUPER_PEERSprotocolArmEnabled- iftrueall control plane messages will be encrypted/authenticated. Default value:true
-
TraversingDrasylServerChannelInitializer
public TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress, int networkId, Map<IdentityPublicKey, InetSocketAddress> superPeers) Creates a new channel initializer with default values forpingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers,pingCommunicationTimeoutMillis, and enabled control plane message arming.- Parameters:
identity- own identityudpServerGroup- theNioEventLoopGroupthe underlying udp server should run onbindAddress- address the UDP server will bind to. Default value: 0.0.0.0:RelayOnlyDrasylServerChannelInitializer.BIND_PORTnetworkId- the network we belong to. Default value:RelayOnlyDrasylServerChannelInitializer.NETWORK_IDsuperPeers- list of super peers we register to. Default value:RelayOnlyDrasylServerChannelInitializer.SUPER_PEERS
-
TraversingDrasylServerChannelInitializer
public TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress) Creates a new channel initializer with default values fornetworkId,superPeers,pingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers,pingCommunicationTimeoutMillis, and enabled control plane message arming.- Parameters:
identity- own identityudpServerGroup- theNioEventLoopGroupthe underlying udp server should run onbindAddress- address the UDP server will bind to. Default value: 0.0.0.0:RelayOnlyDrasylServerChannelInitializer.BIND_PORT
-
TraversingDrasylServerChannelInitializer
public TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup, int bindPort) Creates a new channel initializer with default values fornetworkId,superPeers,pingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers,pingCommunicationTimeoutMillis, and enabled control plane message arming.- Parameters:
identity- own identityudpServerGroup- theNioEventLoopGroupthe underlying udp server should run onbindPort- port the UDP server will bind to. Default value:RelayOnlyDrasylServerChannelInitializer.BIND_PORT
-
TraversingDrasylServerChannelInitializer
public TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.nio.NioEventLoopGroup udpServerGroup) Creates a new channel initializer with default values forbindPort,networkId,superPeers,pingIntervalMillis,pingTimeoutMillis,maxTimeOffsetMillis,maxPeers,pingCommunicationTimeoutMillis, and enabled control plane message arming.- Parameters:
identity- own identityudpServerGroup- theNioEventLoopGroupthe underlying udp server should run on
-
-
Method Details
-
initChannel
- Overrides:
initChannelin classRelayOnlyDrasylServerChannelInitializer
-