Record Class InitialPacketShape

java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.connection.InitialPacketShape
Record Components:
firstPacketNumber - the number of the first Initial packet, when not randomFirstPacketNumber
padToDatagramSize - whether Initial datagrams are padded to the datagram size (the transport's initialMtu), not only to the 1200 bytes RFC 9000 requires
chaosProtection - whether CRYPTO data is cut up and shuffled with PING and PADDING frames (ChaosProtector, Chrome's "chaos protection")
randomFirstPacketNumber - whether the first packet number is random, as neqo (Firefox) makes it: 1 to 32, and one time in eight up to 1024 more
sniSlicing - whether the ClientHello is cut in two at the middle of its server name and the halves sent in reverse order, spread over packets of about equal size (neqo's "SNI slicing")
padAfterPacket - whether an Initial datagram is padded with zero bytes after its packets, as neqo pads it, rather than with PADDING frames inside the packet

public record InitialPacketShape(long firstPacketNumber, boolean padToDatagramSize, boolean chaosProtection, boolean randomFirstPacketNumber, boolean sniSlicing, boolean padAfterPacket) extends Record
How a client's Initial packets look on the wire, the parts of a browser's QUIC fingerprint they make: the first packet number, how an Initial datagram is padded, and how the ClientHello's CRYPTO data is laid out.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final InitialPacketShape
    Chrome 156's, as captured: packet numbers from 1, datagrams padded to their size (1250 bytes with the transport's initial MTU set to 1250, as Chrome's is), chaos protection on.
    static final InitialPacketShape
    Firefox 159's (neqo), as captured: a random first packet number, SNI slicing, and datagrams padded to their size (1252 bytes over IPv4) with zero bytes after the packet.
  • Constructor Summary

    Constructors
    Constructor
    Description
    InitialPacketShape(long firstPacketNumber, boolean padToDatagramSize, boolean chaosProtection)
    A shape with a fixed first packet number, padded with PADDING frames, without SNI slicing.
    InitialPacketShape(long firstPacketNumber, boolean padToDatagramSize, boolean chaosProtection, boolean randomFirstPacketNumber, boolean sniSlicing, boolean padAfterPacket)
    Creates an instance of a InitialPacketShape record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the chaosProtection record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    long
    Returns the value of the firstPacketNumber record component.
    long
    The number of a connection's first Initial packet.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the padAfterPacket record component.
    boolean
    Returns the value of the padToDatagramSize record component.
    boolean
    Returns the value of the randomFirstPacketNumber record component.
    boolean
    Returns the value of the sniSlicing record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • CHROME

      public static final InitialPacketShape CHROME
      Chrome 156's, as captured: packet numbers from 1, datagrams padded to their size (1250 bytes with the transport's initial MTU set to 1250, as Chrome's is), chaos protection on.
    • FIREFOX

      public static final InitialPacketShape FIREFOX
      Firefox 159's (neqo), as captured: a random first packet number, SNI slicing, and datagrams padded to their size (1252 bytes over IPv4) with zero bytes after the packet.
  • Constructor Details

    • InitialPacketShape

      public InitialPacketShape(long firstPacketNumber, boolean padToDatagramSize, boolean chaosProtection, boolean randomFirstPacketNumber, boolean sniSlicing, boolean padAfterPacket)
      Creates an instance of a InitialPacketShape record class.
      Parameters:
      firstPacketNumber - the value for the firstPacketNumber record component
      padToDatagramSize - the value for the padToDatagramSize record component
      chaosProtection - the value for the chaosProtection record component
      randomFirstPacketNumber - the value for the randomFirstPacketNumber record component
      sniSlicing - the value for the sniSlicing record component
      padAfterPacket - the value for the padAfterPacket record component
    • InitialPacketShape

      public InitialPacketShape(long firstPacketNumber, boolean padToDatagramSize, boolean chaosProtection)
      A shape with a fixed first packet number, padded with PADDING frames, without SNI slicing.
  • Method Details

    • firstPacketNumber

      public long firstPacketNumber(RandomGenerator random)
      The number of a connection's first Initial packet.
      Parameters:
      random - the source of a random one
      Returns:
      the number
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • firstPacketNumber

      public long firstPacketNumber()
      Returns the value of the firstPacketNumber record component.
      Returns:
      the value of the firstPacketNumber record component
    • padToDatagramSize

      public boolean padToDatagramSize()
      Returns the value of the padToDatagramSize record component.
      Returns:
      the value of the padToDatagramSize record component
    • chaosProtection

      public boolean chaosProtection()
      Returns the value of the chaosProtection record component.
      Returns:
      the value of the chaosProtection record component
    • randomFirstPacketNumber

      public boolean randomFirstPacketNumber()
      Returns the value of the randomFirstPacketNumber record component.
      Returns:
      the value of the randomFirstPacketNumber record component
    • sniSlicing

      public boolean sniSlicing()
      Returns the value of the sniSlicing record component.
      Returns:
      the value of the sniSlicing record component
    • padAfterPacket

      public boolean padAfterPacket()
      Returns the value of the padAfterPacket record component.
      Returns:
      the value of the padAfterPacket record component