Skip to content

@pumpkin-plugins/port-mapping API / natpmp / parseMapping

Function: parseMapping() ​

parseMapping(data, protocol, internalPort): { externalPort: number; lifetime: number; } | undefined

Defined in: tools/port-mapping/src/natpmp.ts:58

Reads the answer to a mapping request.

Parameters ​

data ​

Uint8Array

protocol ​

"tcp" | "udp"

internalPort ​

number

Returns ​

{ externalPort: number; lifetime: number; } | undefined

The port and lifetime the router gave, or undefined when the datagram isn't that answer.

Throws ​

When the router answered with an error code.

Pumpkin Plugins documentation