@std/net/ip.ms#
Import each required symbol with import Name from "@std/net/ip.ms".
Cidr Native type#
A validated, masked numeric CIDR range.
type Cidr {
}Cidr.contains#
Reports whether address belongs to this CIDR range. The families must match: an
address written ::ffff:1.2.3.4 is normalized to IPv4, so an IPv4 range contains it
and a range written in ::ffff: form (which keeps its IPv6 spelling) contains no
IPv4 address.
fn contains(address IpAddress) BoolCidr.to_json#
Writes the canonical text as a JSON string.
fn to_json() JsonValueCidr.to_string#
Returns the canonical text of the masked range, such as 10.0.0.0/8.
fn to_string() StringDnsKind Enum#
The DNS record categories that resolve_dns can request.
enum DnsKind {
A
AAAA
CNAME
MX
NS
TXT
PTR
SRV
}DnsKind.A#
IPv4 address records for the queried name.
ADnsKind.AAAA#
IPv6 address records for the queried name.
AAAADnsKind.CNAME#
Canonical name alias records for the queried name.
CNAMEDnsKind.MX#
Mail exchange records with priority values.
MXDnsKind.NS#
Name server records for the queried zone.
NSDnsKind.PTR#
Reverse address pointer records for an IP.
PTRDnsKind.SRV#
Service location records with priority, weight and port.
SRVDnsKind.TXT#
Text records returned as string values.
TXTDnsKind.to_string#
Returns the uppercase wire category.
fn to_string() StringDnsRecord Type#
DNS record data returned by a typed lookup.
type DnsRecord {
kind DnsKind
value String
priority Int
weight Int
port Int
}DnsRecord.kind#
The same typed category used by the query.
kind DnsKindDnsRecord.port#
The service port of an SRV record; 0 for other kinds.
port IntDnsRecord.priority#
The preference of an MX record or the priority of an SRV record, where lower values are tried first; 0 for other kinds.
priority IntDnsRecord.value#
The record’s answer: an IP address for A and AAAA, the target host name for CNAME, MX, NS, PTR, and SRV, or the text for TXT.
value StringDnsRecord.weight#
The relative weight of an SRV record among targets with the same priority; 0 for other kinds.
weight IntIpAddress Native type#
A validated numeric IPv4/IPv6 address without a port or zone.
type IpAddress {
}IpAddress.family#
Returns the normalized address family.
fn family() IpFamilyIpAddress.to_json#
Writes the canonical text as a JSON string.
fn to_json() JsonValueIpAddress.to_string#
Returns canonical text; mapped IPv6 input is normalized to IPv4.
fn to_string() StringIpFamily Enum#
Numeric address families reported by IP values and host interfaces.
enum IpFamily {
IPv4
IPv6
}IpFamily.IPv4#
A four-byte numeric address.
IPv4IpFamily.IPv6#
A sixteen-byte numeric address.
IPv6IpFamily.to_string#
Returns IPv4 or IPv6.
fn to_string() Stringparse_cidr Function#
Validates and canonicalizes an IPv4 or IPv6 CIDR range: host bits are cleared, so
10.1.2.3/8 is 10.0.0.0/8, and the prefix length has no sign or leading zero.
fn parse_cidr(text String) Result[Cidr, Error] { ... }parse_ip Function#
Validates and canonicalizes an IPv4 or IPv6 address.
fn parse_ip(text String) Result[IpAddress, Error] { ... }