interface AddressManager {
    addDNSMapping(domain, ipAddresses): void;
    addObservedAddr(addr): void;
    addPublicAddressMapping(internalIp, internalPort, externalIp, externalPort?, protocol?): void;
    confirmObservedAddr(addr, options?): void;
    getAddresses(): Multiaddr[];
    getAddressesWithMetadata(): NodeAddress[];
    getAnnounceAddrs(): Multiaddr[];
    getListenAddrs(): Multiaddr[];
    getObservedAddrs(): Multiaddr[];
    removeDNSMapping(domain): void;
    removeObservedAddr(addr): void;
    removePublicAddressMapping(internalIp, internalPort, externalIp, externalPort?, protocol?): void;
}

Methods

  • Adds a mapping between one or more IP addresses and a domain name - when getAddresses is invoked, where the IP addresses are present in a multiaddr, an additional multiaddr will be added with ip4 and ip6 tuples replaced with dns4 and `dns6 ones respectively.

    Parameters

    • domain: string
    • ipAddresses: string[]

    Returns void

  • Add a publicly routable address/port/protocol tuple that this node is reachable on. Where this node listens on a link-local (e.g. LAN) address with the same protocol for any transport, an additional listen address will be added with the IP and port replaced with this IP and port.

    It's possible to add a IPv6 address here and have it added to the address list, this is for the case when a router has an external IPv6 address with port forwarding configured, but it does IPv6 -> IPv4 NAT.

    Parameters

    • internalIp: string
    • internalPort: number
    • externalIp: string
    • Optional externalPort: number
    • Optional protocol: "tcp" | "udp"

    Returns void

  • Remove a publicly routable address that this node is no longer reachable on

    Parameters

    • internalIp: string
    • internalPort: number
    • externalIp: string
    • Optional externalPort: number
    • Optional protocol: "tcp" | "udp"

    Returns void