@pumpkin-plugins/port-mapping API / network / Network
Interface: Network
Defined in: tools/port-mapping/src/network.ts:46
What the port mapping code needs from the host. A plugin implements it over WASI sockets.
Methods
dial()
dial(
to):Dial
Defined in: tools/port-mapping/src/network.ts:48
Starts a TCP connection.
Parameters
to
Returns
localAddress()
localAddress(
toward?):Ipv4|undefined
Defined in: tools/port-mapping/src/network.ts:53
The address this machine uses to reach toward, or the internet when that is omitted.
Parameters
toward?
Returns
Ipv4 | undefined
The address, or undefined when there is no route.
now()
now():
number
Defined in: tools/port-mapping/src/network.ts:55
The current time in milliseconds.
Returns
number
openDatagram()
openDatagram():
DatagramSocket
Defined in: tools/port-mapping/src/network.ts:57
Opens a UDP socket bound to any free port.
Returns
pause()?
optionalpause(ms):void
Defined in: tools/port-mapping/src/network.ts:63
Blocks the caller for about ms milliseconds without using the CPU. Only for code that is allowed to block, such as a shutdown waiting for the router. Without it such code polls in a loop.
Parameters
ms
number
Returns
void