Class DefaultDnsOptEcsRecord

java.lang.Object
All Implemented Interfaces:
DnsOptEcsRecord, DnsOptPseudoRecord, DnsRecord

public final class DefaultDnsOptEcsRecord extends AbstractDnsOptPseudoRrRecord implements DnsOptEcsRecord
Default DnsOptEcsRecord implementation.
  • Field Details

    • srcPrefixLength

      private final int srcPrefixLength
    • address

      private final byte[] address
  • Constructor Details

    • DefaultDnsOptEcsRecord

      public DefaultDnsOptEcsRecord(int maxPayloadSize, int extendedRcode, int version, int srcPrefixLength, byte[] address)
      Creates a new instance.
      Parameters:
      maxPayloadSize - the suggested max payload size in bytes
      extendedRcode - the extended rcode
      version - the version
      srcPrefixLength - the prefix length
      address - the bytes of the InetAddress to use
    • DefaultDnsOptEcsRecord

      public DefaultDnsOptEcsRecord(int maxPayloadSize, int srcPrefixLength, byte[] address)
      Creates a new instance.
      Parameters:
      maxPayloadSize - the suggested max payload size in bytes
      srcPrefixLength - the prefix length
      address - the bytes of the InetAddress to use
    • DefaultDnsOptEcsRecord

      @Deprecated public DefaultDnsOptEcsRecord(int maxPayloadSize, InternetProtocolFamily protocolFamily)
      Creates a new instance.
      Parameters:
      maxPayloadSize - the suggested max payload size in bytes
      protocolFamily - the InternetProtocolFamily to use. This should be the same as the one used to send the query.
    • DefaultDnsOptEcsRecord

      public DefaultDnsOptEcsRecord(int maxPayloadSize, SocketProtocolFamily socketProtocolFamily)
      Creates a new instance.
      Parameters:
      maxPayloadSize - the suggested max payload size in bytes
      socketProtocolFamily - the SocketProtocolFamily to use. This should be the same as the one used to send the query.
  • Method Details

    • localAddress

      private static byte[] localAddress(SocketProtocolFamily family)
    • verifyAddress

      private static byte[] verifyAddress(byte[] bytes)
    • sourcePrefixLength

      public int sourcePrefixLength()
      Description copied from interface: DnsOptEcsRecord
      Returns the leftmost number of significant bits of ADDRESS to be used for the lookup.
      Specified by:
      sourcePrefixLength in interface DnsOptEcsRecord
    • scopePrefixLength

      public int scopePrefixLength()
      Description copied from interface: DnsOptEcsRecord
      Returns the leftmost number of significant bits of ADDRESS that the response covers. In queries, it MUST be 0.
      Specified by:
      scopePrefixLength in interface DnsOptEcsRecord
    • address

      public byte[] address()
      Description copied from interface: DnsOptEcsRecord
      Returns the bytes of the InetAddress to use.
      Specified by:
      address in interface DnsOptEcsRecord
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class AbstractDnsOptPseudoRrRecord