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.
  • 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 identity
      udpServerGroup - the NioEventLoopGroup the underlying udp server should run on
      bindAddress - 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 - if true 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.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress, int networkId, Map<IdentityPublicKey,InetSocketAddress> superPeers, boolean protocolArmEnabled)
      Creates a new channel initializer with default values for pingIntervalMillis, pingTimeoutMillis, maxTimeOffsetMillis, maxPeers, and pingCommunicationTimeoutMillis.
      Parameters:
      identity - own identity
      udpServerGroup - the NioEventLoopGroup the underlying udp server should run on
      bindAddress - 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 - if true all 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 for pingIntervalMillis, pingTimeoutMillis, maxTimeOffsetMillis, maxPeers, pingCommunicationTimeoutMillis, and enabled control plane message arming.
      Parameters:
      identity - own identity
      udpServerGroup - the NioEventLoopGroup the underlying udp server should run on
      bindAddress - 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.nio.NioEventLoopGroup udpServerGroup, InetSocketAddress bindAddress)
      Creates a new channel initializer with default values for networkId, superPeers, pingIntervalMillis, pingTimeoutMillis, maxTimeOffsetMillis, maxPeers, pingCommunicationTimeoutMillis, and enabled control plane message arming.
      Parameters:
      identity - own identity
      udpServerGroup - the NioEventLoopGroup the underlying udp server should run on
      bindAddress - 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 for networkId, superPeers, pingIntervalMillis, pingTimeoutMillis, maxTimeOffsetMillis, maxPeers, pingCommunicationTimeoutMillis, and enabled control plane message arming.
      Parameters:
      identity - own identity
      udpServerGroup - the NioEventLoopGroup the underlying udp server should run on
      bindPort - 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 for bindPort, networkId, superPeers, pingIntervalMillis, pingTimeoutMillis, maxTimeOffsetMillis, maxPeers, pingCommunicationTimeoutMillis, and enabled control plane message arming.
      Parameters:
      identity - own identity
      udpServerGroup - the NioEventLoopGroup the underlying udp server should run on
  • Method Details