Class NetherNetConstants

java.lang.Object
org.cloudburstmc.netty.channel.nethernet.NetherNetConstants

public class NetherNetConstants extends Object
  • Field Details

  • Constructor Details

    • NetherNetConstants

      public NetherNetConstants()
  • Method Details

    • encryptDiscoveryPacket

      public static byte[] encryptDiscoveryPacket(io.netty.buffer.ByteBuf packet) throws Exception
      Encrypts a discovery packet using AES encryption and HMAC-SHA256 for integrity.
      Parameters:
      packet - The ByteBuf containing the discovery packet to encrypt.
      Returns:
      The encrypted byte array ready for transmission.
      Throws:
      Exception - if encryption fails.
    • decryptDiscoveryPacket

      public static io.netty.buffer.ByteBuf decryptDiscoveryPacket(io.netty.buffer.ByteBuf input) throws Exception
      Decrypts a discovery packet and verifies its integrity.
      Parameters:
      input - The ByteBuf containing the received discovery packet.
      Returns:
      A ByteBuf with the decrypted payload, or null if verification fails.
      Throws:
      Exception - if decryption fails.
    • buildSignalConnectRequest

      public static String buildSignalConnectRequest(long connectionId, String sdp)
      Builds a signalling message for a CONNECTREQUEST.
      Parameters:
      connectionId - The unique connection ID.
      sdp - The SDP payload.
      Returns:
      The formatted signalling message.
    • buildSignalConnectResponse

      public static String buildSignalConnectResponse(long connectionId, String sdp)
      Builds a signalling message for a CONNECTRESPONSE.
      Parameters:
      connectionId - The unique connection ID.
      sdp - The SDP payload.
      Returns:
      The formatted signalling message.
    • buildSignalCandidateAdd

      public static String buildSignalCandidateAdd(long connectionId, String candidateSdp)
      Builds a signalling message for a CANDIDATEADD.
      Parameters:
      connectionId - The unique connection ID.
      candidateSdp - The candidate SDP string.
      Returns:
      The formatted signalling message.