Evolution SDK

SingleHostName.ts

SingleHostName overview


Table of contents


constructors

withPort

Create a SingleHostName with a port.

Signature

export declare const withPort: (port: Port.Port, dnsName: DnsName.DnsName) => SingleHostName

Added in v2.0.0

withoutPort

Create a SingleHostName without a port.

Signature

export declare const withoutPort: (dnsName: DnsName.DnsName) => SingleHostName

Added in v2.0.0

encoding

toCBORBytes

Convert a SingleHostName to CBOR bytes.

Signature

export declare const toCBORBytes: (data: SingleHostName, options?: CBOR.CodecOptions) => any

Added in v2.0.0

toCBORHex

Convert a SingleHostName to CBOR hex string.

Signature

export declare const toCBORHex: (data: SingleHostName, options?: CBOR.CodecOptions) => string

Added in v2.0.0

generators

generator

Generate a random SingleHostName.

Signature

export declare const generator: FastCheck.Arbitrary<SingleHostName>

Added in v2.0.0

model

SingleHostName (class)

Schema for SingleHostName representing a network host with DNS name. single_host_name = (1, port/ nil, dns_name)

Used for A or AAAA DNS records.

Signature

export declare class SingleHostName

Added in v2.0.0

toJSON (method)

Convert to JSON-serializable format. Relies on Option's built-in toJSON() for port serialization. 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](): number

toCBORBytes (method)

Convert to CBOR bytes.

Signature

toCBORBytes(): Uint8Array

Added in v2.0.0

toCBORHex (method)

Convert to CBOR hex string.

Signature

toCBORHex(): string

Added in v2.0.0

[Symbol.for("nodejs.util.inspect.custom")] (method)

Signature

;[Symbol.for("nodejs.util.inspect.custom")]()

parsing

fromCBORBytes

Parse a SingleHostName from CBOR bytes.

Signature

export declare const fromCBORBytes: (bytes: Uint8Array, options?: CBOR.CodecOptions) => SingleHostName

Added in v2.0.0

fromCBORHex

Parse a SingleHostName from CBOR hex string.

Signature

export declare const fromCBORHex: (hex: string, options?: CBOR.CodecOptions) => SingleHostName

Added in v2.0.0

predicates

hasPort

Check if the host name has a port.

Signature

export declare const hasPort: (hostName: SingleHostName) => boolean

Added in v2.0.0

schemas

FromBytes

CBOR bytes transformation schema for SingleHostName.

Signature

export declare const FromBytes: (
  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<[1n]>, Schema.NullOr<typeof Schema.BigIntFromSelf>, typeof Schema.String]>,
    Schema.SchemaClass<SingleHostName, SingleHostName, never>,
    never
  >
>

Added in v2.0.0

FromCDDL

CDDL schema for SingleHostName. single_host_name = (1, port / nil, dns_name)

Signature

export declare const FromCDDL: Schema.transformOrFail<
  Schema.Tuple<[Schema.Literal<[1n]>, Schema.NullOr<typeof Schema.BigIntFromSelf>, typeof Schema.String]>,
  Schema.SchemaClass<SingleHostName, SingleHostName, never>,
  never
>

Added in v2.0.0

FromHex

CBOR hex transformation schema for SingleHostName.

Signature

export declare const FromHex: (
  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<[1n]>, Schema.NullOr<typeof Schema.BigIntFromSelf>, typeof Schema.String]>,
      Schema.SchemaClass<SingleHostName, SingleHostName, never>,
      never
    >
  >
>

Added in v2.0.0

testing

arbitrary

FastCheck arbitrary for SingleHostName instances. Alias to generator for consistency with other modules.

Signature

export declare const arbitrary: FastCheck.Arbitrary<SingleHostName>

Added in v2.0.0

transformation

getDnsName

Get the DNS name from a SingleHostName.

Signature

export declare const getDnsName: (hostName: SingleHostName) => DnsName.DnsName

Added in v2.0.0

getPort

Get the port from a SingleHostName, if it exists.

Signature

export declare const getPort: (hostName: SingleHostName) => Port.Port | undefined

Added in v2.0.0