IpInterface
IPv4 and IPv6 interface addresses that preserve host bits alongside a prefix length.
Constructors
Decoding
fromString
Parses an IP interface address while preserving host bits.
Details
A missing prefix defaults to the address width. Use prefix: "required" to
require one.
Signature
declare function fromString(input: string, options?: ParseOptions): Result<IpInterface<IpAddress>, NetAddressError>ipv4FromString
Parses an IPv4 interface address while preserving host bits.
Details
A missing prefix defaults to 32. Use prefix: "required" to require one.
Signature
declare function ipv4FromString(input: string, options?: ParseOptions): Result<Ipv4Interface, NetAddressError>ipv6FromString
Parses an IPv6 interface address while preserving host bits.
Details
A missing prefix defaults to 128. Use prefix: "required" to require one.
Signature
declare function ipv6FromString(input: string, options?: ParseOptions): Result<Ipv6Interface, NetAddressError>Encoding
Guards
isIpInterface
Returns true when a value is an IP interface address.
Signature
declare function isIpInterface(u: unknown): u is IpInterface<IpAddress>isIpv4Interface
Returns true when a value is an IPv4 interface address.
Signature
declare function isIpv4Interface(u: unknown): u is Ipv4InterfaceisIpv6Interface
Returns true when a value is an IPv6 interface address.
Signature
declare function isIpv6Interface(u: unknown): u is Ipv6InterfaceModels
IpInterface interface
An IP host address and prefix length. Host bits are preserved.
Signature
interface IpInterface<out A extends NetAddress.IpAddress = NetAddress.IpAddress> extends Equal, Hash { readonly _tag: "IpInterface"; readonly "~effect/net/IpInterface": "~effect/net/IpInterface"; readonly address: A; readonly prefixLength: number; toJSON(): string; toString(): string;}Ipv4Interface type
An IPv4 host address and prefix length.
Signature
type Ipv4Interface = IpInterface<NetAddress.Ipv4Address>Ipv6Interface type
An IPv6 host address and prefix length.
Signature
type Ipv6Interface = IpInterface<NetAddress.Ipv6Address>Other
IpInterface
Companion types for parsing IP interface addresses.
Unsafe
fromStringUnsafe
Parses a trusted interface address, throwing on failure.
Signature
declare function fromStringUnsafe(input: string, options?: ParseOptions): IpInterfacemakeUnsafe
Creates a trusted interface address, throwing when its prefix length is invalid.
Signature
declare function makeUnsafe<A extends IpAddress>(address: A, prefixLength: number): IpInterface<A>