Skip to content

@pumpkin-plugins/port-mapping API / testing/fake-igd / FakeIgd

Class: FakeIgd ​

Defined in: tools/port-mapping/src/testing/fake-igd.ts:44

A router that speaks UPnP IGD and NAT-PMP, in memory, for tests. It knows nothing about sockets.

Constructors ​

Constructor ​

new FakeIgd(options?): FakeIgd

Defined in: tools/port-mapping/src/testing/fake-igd.ts:53

Creates a router. Everything is on by default.

Parameters ​

options? ​

FakeIgdOptions = {}

Returns ​

FakeIgd

Accessors ​

hasWebInterface ​

Get Signature ​

get hasWebInterface(): boolean

Defined in: tools/port-mapping/src/testing/fake-igd.ts:115

Whether the router has a web interface for FakeNetwork to connect to on port 80.

Returns ​

boolean


location ​

Get Signature ​

get location(): string

Defined in: tools/port-mapping/src/testing/fake-igd.ts:70

The LOCATION of this router's description document.

Returns ​

string

Methods ​

handleDatagram() ​

handleDatagram(to, data): Uint8Array<ArrayBufferLike>[]

Defined in: tools/port-mapping/src/testing/fake-igd.ts:78

Handles a UDP datagram sent to the router (or to the multicast group).

Parameters ​

to ​

Endpoint

data ​

Uint8Array

Returns ​

Uint8Array<ArrayBufferLike>[]

The datagrams the router sends back.


handleHttp() ​

handleHttp(method, path, headers, body): object

Defined in: tools/port-mapping/src/testing/fake-igd.ts:86

Handles an HTTP request to the router's server.

Parameters ​

method ​

string

path ​

string

headers ​

Record<string, string>

body ​

string

Returns ​

object

body ​

body: string

status ​

status: number

Pumpkin Plugins documentation