minted_network library
Network addresses and names as well-modelled value types.
Every type is built on "parse, don't validate": no public constructor, so an instance that exists
is well-formed. parse reports why it refused, where tryParse just hands back null.
Classes
- Cidr
-
A CIDR block: a network address and how many leading bits of it the prefix covers, written
10.0.0.0/8or2001:db8::/32. Standards: RFC 4632 for v4, RFC 4291 §2.3 for v6. - CidrConstants
- The Cidr blocks the RFCs reserve. A single address is no block, so it lives in IpAddressConstants.
- CidrFailure
- Why a Cidr refused its input. Sealed rather than an enum, because 3 variants carry what failed, one of them another type's failure.
- CidrHostBitsSet
- Bits are set below the prefix, so this names a host rather than a network. networkAddress is the block the caller most likely meant.
- CidrInvalidAddress
-
The part before the
/isn't an IpAddress, and reason says why. - CidrMalformed
-
The text isn't an address followed by
/and a decimal prefix length. - CidrPrefixLengthOutOfRange
- The prefix length is a number, but not one this family has bits for.
- DnsNameFailure
- Why a DnsName refused its input. Sealed rather than an enum, because most variants echo the part of the input that failed.
- DnsNameInvalidCharacter
- character is ASCII but outside the letters, digits, hyphen and underscore this type takes.
- DnsNameLabelEmpty
- A label was empty, so 2 dots met or one sat at an edge. RFC 2181's one-octet minimum is the only shape rule left once the hyphen-edge rule goes.
- DnsNameLabelTooLong
- A label ran past the 63 octets RFC 2181 §11 allows one.
- DnsNameNotAscii
- Something outside ASCII got through, so this may be an internationalised name.
- DnsNameTooLong
- The whole name ran past 253 characters, RFC 1035's 255-octet wire limit in presentation form.
- HostnameConstants
- The Hostname values a standard reserves, plus the ones convention settled on.
- HostnameFailure
- Why a Hostname refused its input. Sealed rather than an enum, because most variants echo the part of the input that failed.
- HostnameInvalidCharacter
- character is ASCII but outside the letters, digits and hyphen RFC 1123 allows.
- HostnameLabelMalformed
- label is empty, or opens or closes with a hyphen, which RFC 1123 keeps for the interior.
- HostnameLabelTooLong
- A label ran past the 63 octets RFC 1035 allows one.
- HostnameNotAscii
- Something outside ASCII got through, so this may be an internationalised name.
- HostnameNumericTld
- The last label is all digits, which RFC 1123 says a host name never is. That's an address.
- HostnameTooLong
- The whole name ran past 253 characters, RFC 1035's 255-octet wire limit in presentation form.
- IpAddressConstants
- The individual IpAddress values the RFCs name. A range is a block, so it lives in CidrConstants.
- IpAddressFailure
- Why an IpAddress refused its input. Sealed rather than an enum, because 3 variants echo the part of the input that failed.
- IpAddressLeadingZero
- part carries a leading zero, which is refused rather than read.
- IpAddressMalformed
- The text is neither a dotted quad nor an RFC 4291 IPv6 address.
- IpAddressPartOutOfRange
- part is a well-formed number that doesn't fit its field: an octet past 255, or a hextet past 4 digits.
- IpAddressWrongOctetCount
- IpAddress.fromOctets got neither the 4 octets of IPv4 nor the 16 of IPv6.
- MacAddressConstants
- The MacAddress values IEEE and IANA single out.
- MacAddressFailure
- Why a MacAddress refused its input. Sealed rather than an enum, because MacAddressWrongOctetCount carries a count off the input.
- MacAddressMalformed
- The text is none of the 4 accepted notations, or mixes 2 of them.
- MacAddressWrongOctetCount
- The notation was recognised but held neither 6 octets (48-bit) nor 8 (64-bit). Also what MacAddress.fromOctets turns down.
- PortConstants
- The Port numbers IANA registered, plus the dev-server defaults convention settled on.
Enums
Extension Types
- DnsName
-
A DNS name: the permissive counterpart to Hostname, e.g.
_dmarc.example.com. Standards: RFC 2181 §11 for the syntax, RFC 8552 for the underscored names that need it. - Hostname
-
A hostname: the dot-separated name of a host on a network, e.g.
www.example.com. Standards: RFC 1123 §2.1 for the grammar, RFC 1035 §2.3.4 for the size limits. - IpAddress
-
An IP address, v4 or v6, in canonical text form:
192.0.2.1,2001:db8::1. Standards: RFC 791 and RFC 4291 for the addresses, RFC 5952 for the canonical IPv6 text. - MacAddress
-
A MAC address: the 48- or 64-bit address identifying an IEEE 802 network interface, e.g.
00:00:5e:00:53:00. IEEE Std 802 defines the address itself. RFC 9542 fixes the terminology and reserves the documentation ranges. - Port
-
A transport-layer port number,
0to65535. Standard: RFC 6335.