Manuscript Documentation
v2026.12.0

@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.

Manuscript
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.

Manuscript
fn contains(address IpAddress) Bool

Cidr.to_json#

Writes the canonical text as a JSON string.

Manuscript
fn to_json() JsonValue

Cidr.to_string#

Returns the canonical text of the masked range, such as 10.0.0.0/8.

Manuscript
fn to_string() String

DnsKind Enum#

The DNS record categories that resolve_dns can request.

Manuscript
enum DnsKind {
    A
    AAAA
    CNAME
    MX
    NS
    TXT
    PTR
    SRV
}

DnsKind.A#

IPv4 address records for the queried name.

Manuscript
A

DnsKind.AAAA#

IPv6 address records for the queried name.

Manuscript
AAAA

DnsKind.CNAME#

Canonical name alias records for the queried name.

Manuscript
CNAME

DnsKind.MX#

Mail exchange records with priority values.

Manuscript
MX

DnsKind.NS#

Name server records for the queried zone.

Manuscript
NS

DnsKind.PTR#

Reverse address pointer records for an IP.

Manuscript
PTR

DnsKind.SRV#

Service location records with priority, weight and port.

Manuscript
SRV

DnsKind.TXT#

Text records returned as string values.

Manuscript
TXT

DnsKind.to_string#

Returns the uppercase wire category.

Manuscript
fn to_string() String

DnsRecord Type#

DNS record data returned by a typed lookup.

Manuscript
type DnsRecord {
    kind DnsKind
    value String
    priority Int
    weight Int
    port Int
}

DnsRecord.kind#

The same typed category used by the query.

Manuscript
kind DnsKind

DnsRecord.port#

The service port of an SRV record; 0 for other kinds.

Manuscript
port Int

DnsRecord.priority#

The preference of an MX record or the priority of an SRV record, where lower values are tried first; 0 for other kinds.

Manuscript
priority Int

DnsRecord.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.

Manuscript
value String

DnsRecord.weight#

The relative weight of an SRV record among targets with the same priority; 0 for other kinds.

Manuscript
weight Int

IpAddress Native type#

A validated numeric IPv4/IPv6 address without a port or zone.

Manuscript
type IpAddress {
}

IpAddress.family#

Returns the normalized address family.

Manuscript
fn family() IpFamily

IpAddress.to_json#

Writes the canonical text as a JSON string.

Manuscript
fn to_json() JsonValue

IpAddress.to_string#

Returns canonical text; mapped IPv6 input is normalized to IPv4.

Manuscript
fn to_string() String

IpFamily Enum#

Numeric address families reported by IP values and host interfaces.

Manuscript
enum IpFamily {
    IPv4
    IPv6
}

IpFamily.IPv4#

A four-byte numeric address.

Manuscript
IPv4

IpFamily.IPv6#

A sixteen-byte numeric address.

Manuscript
IPv6

IpFamily.to_string#

Returns IPv4 or IPv6.

Manuscript
fn to_string() String

parse_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.

Manuscript
fn parse_cidr(text String) Result[Cidr, Error] { ... }

parse_ip Function#

Validates and canonicalizes an IPv4 or IPv6 address.

Manuscript
fn parse_ip(text String) Result[IpAddress, Error] { ... }