SingleHostAddr.ts
SingleHostAddr overview
Table of contents
constructors
withBothIPs
Create a SingleHostAddr with both IPv4 and IPv6 addresses.
Signature
export declare const withBothIPs: (port: Port.Port, ipv4: IPv4.IPv4, ipv6: IPv6.IPv6) => SingleHostAddrAdded in v2.0.0
withIPv4
Create a SingleHostAddr with IPv4 address.
Signature
export declare const withIPv4: (port: Port.Port, ipv4: IPv4.IPv4) => SingleHostAddrAdded in v2.0.0
withIPv6
Create a SingleHostAddr with IPv6 address.
Signature
export declare const withIPv6: (port: Port.Port, ipv6: IPv6.IPv6) => SingleHostAddrAdded in v2.0.0
encoding
toCBORBytes
Encode SingleHostAddr to CBOR bytes.
Signature
export declare const toCBORBytes: (data: SingleHostAddr, options?: CBOR.CodecOptions) => anyAdded in v2.0.0
toCBORHex
Encode SingleHostAddr to CBOR hex string.
Signature
export declare const toCBORHex: (data: SingleHostAddr, options?: CBOR.CodecOptions) => stringAdded in v2.0.0
model
SingleHostAddr (class)
Schema for SingleHostAddr representing a network host with IP addresses. single_host_addr = (0, port/ nil, ipv4/ nil, ipv6/ nil)
Signature
export declare class SingleHostAddrAdded in v2.0.0
toJSON (method)
Convert to JSON-serializable format. Converts bigint port values to strings for JSON compatibility.
Signature
toJSON()Added in v2.0.0
toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): numbertoCBORBytes (method)
Convert to CBOR bytes.
Signature
toCBORBytes(): Uint8ArrayAdded in v2.0.0
toCBORHex (method)
Convert to CBOR hex string.
Signature
toCBORHex(): stringAdded in v2.0.0
parsing
fromCBORBytes
Parse SingleHostAddr from CBOR bytes.
Signature
export declare const fromCBORBytes: (bytes: Uint8Array, options?: CBOR.CodecOptions) => SingleHostAddrAdded in v2.0.0
fromCBORHex
Parse SingleHostAddr from CBOR hex string.
Signature
export declare const fromCBORHex: (hex: string, options?: CBOR.CodecOptions) => SingleHostAddrAdded in v2.0.0
predicates
hasIPv4
Check if the host address has an IPv4 address.
Signature
export declare const hasIPv4: (hostAddr: SingleHostAddr) => booleanAdded in v2.0.0
hasIPv6
Check if the host address has an IPv6 address.
Signature
export declare const hasIPv6: (hostAddr: SingleHostAddr) => booleanAdded in v2.0.0
hasPort
Check if the host address has a port.
Signature
export declare const hasPort: (hostAddr: SingleHostAddr) => booleanAdded in v2.0.0
schemas
FromCBORBytes
CBOR bytes transformation schema for SingleHostAddr.
Signature
export declare const FromCBORBytes: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
never
>,
Schema.transformOrFail<
Schema.Tuple<
[
Schema.Literal<[0n]>,
Schema.NullOr<typeof Schema.BigIntFromSelf>,
Schema.NullOr<typeof Schema.Uint8ArrayFromSelf>,
Schema.NullOr<typeof Schema.Uint8ArrayFromSelf>
]
>,
Schema.SchemaClass<SingleHostAddr, SingleHostAddr, never>,
never
>
>Added in v2.0.0
FromCBORHex
CBOR hex transformation schema for SingleHostAddr.
Signature
export declare const FromCBORHex: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.Schema<Uint8Array, string, never>,
Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
never
>,
Schema.transformOrFail<
Schema.Tuple<
[
Schema.Literal<[0n]>,
Schema.NullOr<typeof Schema.BigIntFromSelf>,
Schema.NullOr<typeof Schema.Uint8ArrayFromSelf>,
Schema.NullOr<typeof Schema.Uint8ArrayFromSelf>
]
>,
Schema.SchemaClass<SingleHostAddr, SingleHostAddr, never>,
never
>
>
>Added in v2.0.0
FromCDDL
CDDL schema for SingleHostAddr. single_host_addr = (0, port / nil, ipv4 / nil, ipv6 / nil)
Signature
export declare const FromCDDL: Schema.transformOrFail<
Schema.Tuple<
[
Schema.Literal<[0n]>,
Schema.NullOr<typeof Schema.BigIntFromSelf>,
Schema.NullOr<typeof Schema.Uint8ArrayFromSelf>,
Schema.NullOr<typeof Schema.Uint8ArrayFromSelf>
]
>,
Schema.SchemaClass<SingleHostAddr, SingleHostAddr, never>,
never
>Added in v2.0.0
testing
arbitrary
FastCheck arbitrary for generating random SingleHostAddr instances
Signature
export declare const arbitrary: FastCheck.Arbitrary<SingleHostAddr>Added in v2.0.0