Skip to content

parseIpv4Address

parseIpv4Address(text): BitAddress

Defined in: packages/net-address/src/ipv4/parse-ipv4.ts:53

Parses a dotted quad, strictly.

Exactly four decimal octets, no leading zeros, no octal, no hexadecimal, no abbreviated forms. Everything a C inet_aton would also accept — 127.1, 0177.0.0.1, 0x7f.0.0.1, 2130706433 — is rejected, because a parser that accepts them disagrees with the one the next hop uses, and that disagreement is how an allowlist gets bypassed. parseInetAtonIpv4Address is there when the legacy grammar is genuinely wanted.

string

BitAddress

The address, 32 bits wide.

NetAddressSyntaxError When text is not a strict dotted quad.