java.lang.Object
org.minidns.edns.Edns

public class Ednsextends Object
EDNS - Extension Mechanism for DNS.
See Also:
  • Field Details

    • FLAG_DNSSEC_OK

      public static final int FLAG_DNSSEC_OK
      Inform the dns server that the client supports DNSSEC.
      See Also:
    • udpPayloadSize

      public final int udpPayloadSize
      The UDP payload size.
    • extendedRcode

      public final int extendedRcode
      8-bit extended return code. RFC 6891 § 6.1.3 EXTENDED-RCODE
    • version

      public final int version
      8-bit version field. RFC 6891 § 6.1.3 VERSION
    • flags

      public final int flags
      16-bit flags. RFC 6891 § 6.1.4
    • variablePart

      public final List<EdnsOption> variablePart
      The list of EDNS options.
    • dnssecOk

      public final boolean dnssecOk
      Whether DNSSEC OK flag is set.
    • optRecord

      private Record<OPT> optRecord
      The OPT record carrying the version.
    • terminalOutputCache

      private String terminalOutputCache
      The cached rendered output.
  • Constructor Details

    • Edns

      public Edns(Record<OPT> optRecord)
      Creates an EDNS instance from an OPT record.
      Parameters:
      optRecord - the OPT record
    • Edns

      public Edns(Edns.Builder builder)
      Creates an EDNS instance from a builder.
      Parameters:
      builder - the builder containing EDNS configuration
  • Method Details

    • getEdnsOption

      public <O extends EdnsOption> O getEdnsOption(Edns.OptionCode optionCode)
      Finds an EDNS option by code in the variable part.
      Type Parameters:
      O - the option type the caller expects, so the unchecked cast to it is checked at the call site
      Parameters:
      optionCode - the code of the option to look for in the variable part
      Returns:
      the matching option, or null if the variable part carries no such code
    • asRecord

      public Record<OPT> asRecord()
      Converts this EDNS instance to an OPT record.
      Returns:
      the OPT record
    • asTerminalOutput

      public String asTerminalOutput()
      Returns the terminal output representation of this EDNS instance.
      Returns:
      the terminal output representation
    • toString

      public String toString()
      Renders the request as EDNS with its options on one line.
      Overrides:
      toString in class Object
    • fromRecord

      public static Edns fromRecord(Record<? extends Data> record)
      Creates an EDNS instance from a record if it's an OPT record.
      Parameters:
      record - the record to convert
      Returns:
      the EDNS instance if the record is an OPT record, null otherwise
    • builder

      public static Edns.Builder builder()
      Creates a new builder for constructing EDNS instances.
      Returns:
      a new builder