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
@UnstableApi
public class TraversingDrasylServerChannelInitializer
extends RelayOnlyDrasylServerChannelInitializer
A
ChannelInitializer
for DrasylServerChannel
s 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
Fields 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
ConstructorDescriptionTraversingDrasylServerChannelInitializer
(Identity identity, io.netty.channel.EventLoopGroup 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.EventLoopGroup 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.EventLoopGroup 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.EventLoopGroup 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.EventLoopGroup 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.EventLoopGroup 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, handlerRemoved
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggered
Methods 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.EventLoopGroup 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
- theEventLoopGroup
the underlying udp server should run onbindAddress
- address the UDP server will bind to. Default value: 0.0.0.0:RelayOnlyDrasylServerChannelInitializer.BIND_PORT
networkId
- the network we belong to. Default value:RelayOnlyDrasylServerChannelInitializer.NETWORK_ID
superPeers
- list of super peers we register to. Default value:RelayOnlyDrasylServerChannelInitializer.SUPER_PEERS
protocolArmEnabled
- iftrue
all control plane messages will be encrypted/authenticated. Default value:true
pingIntervalMillis
- interval in millis between a ping. Default value:RelayOnlyDrasylServerChannelInitializer.PING_INTERVAL_MILLIS
pingTimeoutMillis
- time in millis without ping response before a peer is assumed as unreachable. Default value:RelayOnlyDrasylServerChannelInitializer.PING_TIMEOUT_MILLIS
maxTimeOffsetMillis
- time millis offset of received messages' timestamp before discarding them. Default value:RelayOnlyDrasylServerChannelInitializer.MAX_TIME_OFFSET_MILLIS
maxPeers
- maximum number of peers to which a traversed connection should be maintained at the same time. Default value:RelayOnlyDrasylServerChannelInitializer.MAX_PEERS
pingCommunicationTimeoutMillis
- 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.EventLoopGroup 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
- theEventLoopGroup
the underlying udp server should run onbindAddress
- address the UDP server will bind to. Default value: 0.0.0.0:RelayOnlyDrasylServerChannelInitializer.BIND_PORT
networkId
- the network we belong to. Default value:RelayOnlyDrasylServerChannelInitializer.NETWORK_ID
superPeers
- list of super peers we register to. Default value:RelayOnlyDrasylServerChannelInitializer.SUPER_PEERS
protocolArmEnabled
- iftrue
all control plane messages will be encrypted/authenticated. Default value:true
-
TraversingDrasylServerChannelInitializer
public TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.EventLoopGroup 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
- theEventLoopGroup
the underlying udp server should run onbindAddress
- address the UDP server will bind to. Default value: 0.0.0.0:RelayOnlyDrasylServerChannelInitializer.BIND_PORT
networkId
- the network we belong to. Default value:RelayOnlyDrasylServerChannelInitializer.NETWORK_ID
superPeers
- list of super peers we register to. Default value:RelayOnlyDrasylServerChannelInitializer.SUPER_PEERS
-
TraversingDrasylServerChannelInitializer
public TraversingDrasylServerChannelInitializer(Identity identity, io.netty.channel.EventLoopGroup 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
- theEventLoopGroup
the 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.EventLoopGroup 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
- theEventLoopGroup
the 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.EventLoopGroup 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
- theEventLoopGroup
the underlying udp server should run on
-
-
Method Details
-
initChannel
- Overrides:
initChannel
in classRelayOnlyDrasylServerChannelInitializer
-