interface Gateway {
    family: "IPv4" | "IPv6";
    host: string;
    id: string;
    port: number;
    externalIp(options?): Promise<string>;
    map(internalPort, internalHost, options?): Promise<PortMapping>;
    mapAll(internalPort, options?): AsyncGenerator<PortMapping, void, unknown>;
    stop(options?): Promise<void>;
    unmap(internalPort, options?): Promise<void>;
}

Properties

family: "IPv4" | "IPv6"

If IPv4, this gateway is capable of mapping IPv4 addresses, otherwise it will map IPv6 addresses

host: string

The network host that this gateway is accessible on

id: string

A unique identifier for this gateway

port: number

The port that this gateway uses

Methods

  • Map a local host:port pair to one on the external network interface

    If the mapping is successful, the external port number that was mapped is returned - this may be different from the requested port number if that port was not free.

    Parameters

    • internalPort: number
    • internalHost: string
    • Optional options: MapPortOptions

    Returns Promise<PortMapping>

  • Unmap a previously mapped port. If the port was not mapped this is a no-op.

    Parameters

    Returns Promise<void>