PortForwarder

class wpinet.PortForwarder

Bases: pybind11_object

Forward ports to another host. This is primarily useful for accessing Ethernet-connected devices from a computer tethered to the Systemcore USB port.

add(port: SupportsInt | SupportsIndex, remote_host: str, remote_port: SupportsInt | SupportsIndex) None

Forward a local TCP port to a remote host and port. Note that local ports less than 1024 won’t work as a normal user.

Parameters:
  • port – local port number

  • remote_host – remote IP address / DNS name

  • remote_port – remote port number

static get_instance() wpinet._wpinet.PortForwarder

Get an instance of the PortForwarder class.

This is a singleton to guarantee that there is only a single instance regardless of how many times GetInstance is called.

remove(port: SupportsInt | SupportsIndex) None

Stop TCP forwarding on a port.

Parameters:

port – local port number