pub enum Error {
TrailingDotMissing,
TrailingNulCharMissing,
InvalidLabelChar,
InvalidStructure,
TooLongDomainName,
TooLongLabel,
LabelCannotStartWithHyphen,
LabelCannotEndWithHyphen,
EmptyLabel,
}Expand description
Error when FQDN parsing goes wrong
Variants§
TrailingDotMissing
The trailing dot of the FQDN string is missing.
A valid FQDN string should be ended by a dot (e.g. github.com.).
TrailingNulCharMissing
The trailing nul byte of the FQDN bytes is missing.
A valid FQDN array of bytes should be ended by the nul byte (e.g. b"\x06github\x03com\x00")
InvalidLabelChar
An invalid character is found in a label of the FQDN.
The allowed characters in a FQDN label are letters, digits and '-'.
By default, this crate also accepts '_' in FQDN but this behavior could be deactivated with
the strict-rfc-1035 feature.
InvalidStructure
The analysed bytes are not consistent with a FQDN sequence of bytes.
Typically, the length bytes of labels are not consistent.
TooLongDomainName
The name of the domain is too long
By default, there is no limit except if the strict-rfc-1035 feature is selected and
then, the domain name should be less than 255 characters (including the trailing dot).
TooLongLabel
One label of the FQDN is too long
The returned error contains the excessive length.
By default, the limit is set to 255 characters but if the strict-rfc-1035 feature is selected,
then this limit is set to 63 (as said in the RFC).
LabelCannotStartWithHyphen
One label cannot start with a hyphen
The returned error contains the start position of the involved label
LabelCannotEndWithHyphen
One label cannot end with a hyphen
The returned error contains the start position of the involved label
EmptyLabel
One label is empty (e.g. starting dot as .github.com. or two following dots as github..com.)