pub struct OptBuilder { /* private fields */ }
Expand description
Builds an OPT record as part of the additional section of a DNS message,
This type can be constructed by calling the opt
method on any other
builder type. See the module documentation for on overview
on building messages.
As OPT records are part of the additional section, this type will, when
constructed proceed to this section and append an OPT record without any
options to it. Options can be appened via the push
method.
The type also deref-muts to OptHeader
allowing you to modify the
header’s fields such as setting the
UDP payload size or the
DO bit.
Once you have adjusted the OPT record to your liking, you can return to
the additional section via additional
. Note, however, that the OPT
record should be the last record except for a possible TSIG record. You
can also finish the message via finish
or freeze
.
Implementations§
Source§impl OptBuilder
impl OptBuilder
Sourcepub fn push<O: OptData>(&mut self, option: &O) -> Result<(), ShortBuf>
pub fn push<O: OptData>(&mut self, option: &O) -> Result<(), ShortBuf>
Pushes an option to the OPT record.
The method is generic over anything that implements the OptData
trait representing an option. Alternatively, most of these types
provide a push
associated function that allows to construct an
option directly into a record from its data.
Sourcepub fn additional(self) -> AdditionalBuilder
pub fn additional(self) -> AdditionalBuilder
Completes the OPT record and returns to the additional section builder.
Methods from Deref<Target = OptHeader>§
pub fn udp_payload_size(&self) -> u16
pub fn set_udp_payload_size(&mut self, value: u16)
pub fn rcode(&self, header: Header) -> OptRcode
pub fn set_rcode(&mut self, rcode: OptRcode)
pub fn version(&self) -> u8
pub fn set_version(&mut self, version: u8)
pub fn dnssec_ok(&self) -> bool
pub fn set_dnssec_ok(&mut self, value: bool)
Trait Implementations§
Source§impl Clone for OptBuilder
impl Clone for OptBuilder
Source§fn clone(&self) -> OptBuilder
fn clone(&self) -> OptBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more