Options
All
  • Public
  • Public/Protected
  • All
Menu

IServiceNode interface

IServiceNode are received through the on and once event listeners; they normally contain the network information and metadata necessary for you to be able to connect and use this service instance.

export
interface

IServiceNode

Hierarchy

  • IServiceNode

Index

Properties

Methods

Properties

addresses

addresses: string[]

List of available addresses

Some services may be running on machines with more than one network interface; here, you will find a list of all announced IP addresses to connect through those different interfaces.

type

{string[]}

memberof

IServiceNode

data

data: any

Metadata

This data is the same as the one that gets registered through IService.announce.

type

{*}

memberof

IServiceNode

host

host: string

Host name

type

{string}

memberof

IServiceNode

port

port: number

Port number

type

{number}

memberof

IServiceNode

Methods

getIp

  • getIp(version: 4 | 6, networks?: string[]): string | null
  • Retrieve an IP from the addresses list

    The network parameter is an array containing the network list where your service is. The CIDR notation is used to represent the networks.

    This method may return null if no addresses could be found within the list of provided networks, or if the node provides no networks.

    memberof

    IServiceNode

    Parameters

    • version: 4 | 6
    • Optional networks: string[]

    Returns string | null