Package org.drasyl.channel
Class RelayOnlyDrasylServerChannelInitializer
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelInitializer<DrasylServerChannel>
org.drasyl.channel.RelayOnlyDrasylServerChannelInitializer
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
TraversingDrasylServerChannelInitializer
@UnstableApi
public class RelayOnlyDrasylServerChannelInitializer
extends io.netty.channel.ChannelInitializer<DrasylServerChannel>
A
ChannelInitializer
for DrasylServerChannel
s that relays 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
Modifier and TypeFieldDescriptionstatic final int
protected final InetSocketAddress
protected final Identity
protected static final LoopbackHandler
static final int
static final int
protected final int
protected final int
static final int
protected final int
static final int
static final int
protected final int
protected final int
protected final boolean
static final Map<IdentityPublicKey,
InetSocketAddress> protected final Map<IdentityPublicKey,
InetSocketAddress> protected static final UnarmedMessageDecoder
-
Constructor Summary
ConstructorDescriptionRelayOnlyDrasylServerChannelInitializer
(Identity identity, io.netty.channel.EventLoopGroup udpServerGroup) Creates a new channel initializer with default values forbindPort
,networkId
,superPeers
,pingIntervalMillis
,pingTimeoutMillis
,maxTimeOffsetMillis
,maxPeers
, and enabled control plane message arming.RelayOnlyDrasylServerChannelInitializer
(Identity identity, io.netty.channel.EventLoopGroup udpServerGroup, int bindPort) Creates a new channel initializer with default values fornetworkId
,superPeers
,pingIntervalMillis
,pingTimeoutMillis
,maxTimeOffsetMillis
,maxPeers
, and enabled control plane message arming.RelayOnlyDrasylServerChannelInitializer
(Identity identity, io.netty.channel.EventLoopGroup udpServerGroup, InetSocketAddress bindAddress) Creates a new channel initializer with default values fornetworkId
,superPeers
,pingIntervalMillis
,pingTimeoutMillis
,maxTimeOffsetMillis
,maxPeers
, and enabled control plane message arming.RelayOnlyDrasylServerChannelInitializer
(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
, and enabled control plane message arming.RelayOnlyDrasylServerChannelInitializer
(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
, andmaxPeers
.RelayOnlyDrasylServerChannelInitializer
(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) -
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
-
BIND_PORT
public static final int BIND_PORT- See Also:
-
NETWORK_ID
public static final int NETWORK_ID- See Also:
-
SUPER_PEERS
-
PING_INTERVAL_MILLIS
public static final int PING_INTERVAL_MILLIS- See Also:
-
PING_TIMEOUT_MILLIS
public static final int PING_TIMEOUT_MILLIS- See Also:
-
MAX_TIME_OFFSET_MILLIS
public static final int MAX_TIME_OFFSET_MILLIS- See Also:
-
MAX_PEERS
public static final int MAX_PEERS- See Also:
-
UNARMED_MESSAGE_DECODER
-
LOOPBACK_HANDLER
-
identity
-
bindAddress
-
networkId
protected final int networkId -
superPeers
-
protocolArmEnabled
protected final boolean protocolArmEnabled -
pingIntervalMillis
protected final int pingIntervalMillis -
pingTimeoutMillis
protected final int pingTimeoutMillis -
maxTimeOffsetMillis
protected final int maxTimeOffsetMillis -
maxPeers
protected final int maxPeers
-
-
Constructor Details
-
RelayOnlyDrasylServerChannelInitializer
public RelayOnlyDrasylServerChannelInitializer(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) - Parameters:
identity
- own identityudpServerGroup
- theNioEventLoopGroup
the underlying udp server should run onbindAddress
- address the UDP server will bind to. Default value: 0.0.0.0:BIND_PORT
networkId
- the network we belong to. Default value:NETWORK_ID
superPeers
- list of super peers we register to. Default value:SUPER_PEERS
protocolArmEnabled
- iftrue
all control plane messages will be encrypted/authenticated. Default value:true
pingIntervalMillis
- interval in millis between a ping. Default value:PING_INTERVAL_MILLIS
pingTimeoutMillis
- time in millis without ping response before a peer is assumed as unreachable. Default value:PING_TIMEOUT_MILLIS
maxTimeOffsetMillis
- time millis offset of received messages' timestamp before discarding them. Default value:MAX_TIME_OFFSET_MILLIS
maxPeers
- maximum number of peers to which a traversed connection should be maintained at the same time. Default value:MAX_PEERS
-
RelayOnlyDrasylServerChannelInitializer
public RelayOnlyDrasylServerChannelInitializer(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
, andmaxPeers
.- Parameters:
identity
- own identityudpServerGroup
- theNioEventLoopGroup
the underlying udp server should run onbindAddress
- address the UDP server will bind to. Default value: 0.0.0.0:BIND_PORT
networkId
- the network we belong to. Default value:NETWORK_ID
superPeers
- list of super peers we register to. Default value:SUPER_PEERS
protocolArmEnabled
- iftrue
all control plane messages will be encrypted/authenticated. Default value:true
-
RelayOnlyDrasylServerChannelInitializer
public RelayOnlyDrasylServerChannelInitializer(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
, and enabled control plane message arming.- Parameters:
identity
- own identityudpServerGroup
- theNioEventLoopGroup
the underlying udp server should run onbindAddress
- address the UDP server will bind to. Default value: 0.0.0.0:BIND_PORT
networkId
- the network we belong to. Default value:NETWORK_ID
superPeers
- list of super peers we register to. Default value:SUPER_PEERS
-
RelayOnlyDrasylServerChannelInitializer
public RelayOnlyDrasylServerChannelInitializer(Identity identity, io.netty.channel.EventLoopGroup udpServerGroup, InetSocketAddress bindAddress) Creates a new channel initializer with default values fornetworkId
,superPeers
,pingIntervalMillis
,pingTimeoutMillis
,maxTimeOffsetMillis
,maxPeers
, and enabled control plane message arming.- Parameters:
identity
- own identityudpServerGroup
- theNioEventLoopGroup
the underlying udp server should run onbindAddress
- address the UDP server will bind to. Default value: 0.0.0.0:BIND_PORT
-
RelayOnlyDrasylServerChannelInitializer
public RelayOnlyDrasylServerChannelInitializer(Identity identity, io.netty.channel.EventLoopGroup udpServerGroup, int bindPort) Creates a new channel initializer with default values fornetworkId
,superPeers
,pingIntervalMillis
,pingTimeoutMillis
,maxTimeOffsetMillis
,maxPeers
, and enabled control plane message arming.- Parameters:
identity
- own identityudpServerGroup
- theNioEventLoopGroup
the underlying udp server should run onbindPort
- port the UDP server will bind to. Default value:BIND_PORT
-
RelayOnlyDrasylServerChannelInitializer
public RelayOnlyDrasylServerChannelInitializer(Identity identity, io.netty.channel.EventLoopGroup udpServerGroup) Creates a new channel initializer with default values forbindPort
,networkId
,superPeers
,pingIntervalMillis
,pingTimeoutMillis
,maxTimeOffsetMillis
,maxPeers
, and enabled control plane message arming.- Parameters:
identity
- own identityudpServerGroup
- theNioEventLoopGroup
the underlying udp server should run on
-
-
Method Details
-
initChannel
- Specified by:
initChannel
in classio.netty.channel.ChannelInitializer<DrasylServerChannel>
-